TIMMsgSendMessageReadReceipts
Introduction
Send message read receipts
If a message sender wants to know who has or has not read the message, the sender needs to enable the message read receipt feature.
After this feature is enabled, the sender can set whether a message requires a read receipt when sending the message; if yes, the sender will receive a receipt after the message is read by the receiver.
Read receipts are supported for both one-to-one and group messages in the same way.
Specifying a group type for which to support message read receipts:
Log in to the IM console, select Feature Configuration > Login and Message > Group Message Read Receipts.
Once success, total unread count will not change, but the message sender will receive MsgReadedReceiptCallback, which includes the read receipts info.
Ultimate package only. Buy Ultimate package to enable this feature.
Only support C2C or Group message. When calling on group messages, messages in msg_array must belong to the same group conversation.
Parameter details
Parameter name | Parameter type | Required | Description |
---|---|---|---|
msgSendGroupMessageReceipts | MsgSendGroupMessageReceiptsParam | yes | Param of sending message read receipts |
Returned template
Promise<commonResult<string>>
{
code: TIMResult | TIMErrCode;
desc?: string | undefined;
json_param?: string | undefined;
json_params?: string | undefined;
user_data?: string | undefined;
}
Return value details
name | type | description |
---|---|---|
code | TIMResult | TIMErrCode | Request result: Error codes. 0 means success. |
desc | string | undefined | The description of the error. It will be empty if success. |
json_param | string | undefined | Return value of calling API |
json_params | string | undefined | Return value of calling API. Compatible field, which is returned in some cases. |
user_data | string | undefined | ImSDK is responsible for transporting user-defined data without any processing |
Code example
import TimRender from "im_electron_sdk/dist/renderer";
const timRenderInstance = new TimRender();
import { MsgGetMsgListParams, Json_get_msg_param, MsgSendGroupMessageReceiptsParam } from "im_electron_sdk/dist/interfaces";
let convId = ""
let convType = 0
let msgParam: Json_get_msg_param = {
msg_getmsglist_param_last_msg: '', // optional
msg_getmsglist_param_count: 0, // optional
msg_getmsglist_param_is_ramble: false, // optional
msg_getmsglist_param_is_forward: false, // optional
msg_getmsglist_param_last_msg_seq: 0, // optional
msg_getmsglist_param_time_begin: 0, // optional
msg_getmsglist_param_time_period: 0, // optional
}
let param1: MsgGetMsgListParams = {
conv_id: convId,// required
conv_type: convType,// required
params: msgParam,// required
user_data: '' // optional
}
const { code1, json_params } = await timRenderInstance.TIMMsgGetMsgList(param1)
if (code1 == 0) {
let param: MsgSendGroupMessageReceiptsParam = {
json_msg_array: JSON.stringify([json_params[0]]),// required
user_data: "" // required
}
const { code } = await timRenderInstance.TIMMsgSendMessageReadReceipts(param);
if (code == 0) {
// success
}
}