Group Message Read Receipt
Users can initiate a read receipt request for messages they’ve sent. Once initiated, they can see how many people have read the message.
Initiate Read Receipt Request
Initiate a read receipt request for a message.
Method
sendGroupReadReceiptRequest(
message: RCIMIWMessage,
callback: IRCIMIWSendGroupReadReceiptRequestCallback
): Promise<number>;
Parameter Description
Parameter | Type | Description |
---|---|---|
message | RCIMIWMessage | The message for which the read receipt is requested |
callback | IRCIMIWSendGroupReadReceiptRequestCallback | Callback for the interface call result. |
Return Value
Return Value | Description |
---|---|
number | The status code of the current interface operation. 0 indicates a successful call. The specific result needs to be implemented in the interface callback. Non-zero indicates that the current interface call operation failed, and the interface callback will not be triggered. For detailed errors, refer to the error codes. |
Code Example
const callback = {
onGroupReadReceiptRequestSent: (code: number, message: RCIMIWMessage) => {
//...
},
};
let code = await engine.sendGroupReadReceiptRequest(message, callback);
Listen to Group Read Receipt Requests
Method
setOnGroupMessageReadReceiptRequestReceivedListener(listener?: (targetId: string, messageUId: string) => void): void;
Parameter Description
Parameter | Type | Description |
---|---|---|
targetId | string | Conversation ID |
messageUId | string | The messageUid of the message |
Code Example
engine?.setOnGroupMessageReadReceiptRequestReceivedListener((targetId: string, messageUId: string) => {
//...
});
Respond to Read Receipt Requests
Upon receiving a read receipt request, the recipient needs to respond to the request, notifying the sender that the message has been read. Multiple messages in the same conversation can be responded to at once.
Method
sendGroupReadReceiptResponse(
targetId: string,
channelId: string,
messages: Array<RCIMIWMessage>,
callback: IRCIMIWSendGroupReadReceiptResponseCallback
): Promise<number>;
Parameter Description
Parameter | Type | Description |
---|---|---|
targetId | string | Conversation ID |
channelId | string | Channel ID, only supported for ultra groups. For other conversation types, pass null. |
messages | Array<RCIMIWMessage> | List of messages in the conversation for which read receipts are to be sent |
callback | IRCIMIWSendGroupReadReceiptResponseCallback | Callback for the interface call result. |
Return Value
Return Value | Description |
---|---|
number | The status code of the current interface operation. 0 indicates a successful call. The specific result needs to be implemented in the interface callback. Non-zero indicates that the current interface call operation failed, and the interface callback will not be triggered. For detailed errors, refer to the error codes. |
Example Code
const callback = {
onGroupReadReceiptResponseSent: (code: number, message: Array<RCIMIWMessage>) => {
//...
},
};
let code = await engine.sendGroupReadReceiptResponse(targetId, channelId, messages, callback);
Listen to Group Read Receipt Responses
Method
setOnGroupMessageReadReceiptResponseReceivedListener(listener?: (targetId: string, messageUId: string, respondUserIds: Map<string, number>) => void): void;
Parameter Description
Parameter | Type | Description |
---|---|---|
targetId | string | Conversation ID |
messageUId | string | The messageUid of the message for which the read receipt response was received |
respondUserIds | Map<string, number> | List of users who responded to this message in the conversation. Key: user ID; Value: response time. |
Code Example
engine?.setOnGroupMessageReadReceiptResponseReceivedListener(
(targetId: string, messageUId: string, respondUserIds: Map<string, number>) => {
//...
}
);