Skip to main content

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​

ParameterTypeDescription
messageRCIMIWMessageThe message for which the read receipt is requested
callbackIRCIMIWSendGroupReadReceiptRequestCallbackCallback for the interface call result.

Return Value​

Return ValueDescription
numberThe 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​

ParameterTypeDescription
targetIdstringConversation ID
messageUIdstringThe 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​

ParameterTypeDescription
targetIdstringConversation ID
channelIdstringChannel ID, only supported for ultra groups. For other conversation types, pass null.
messagesArray<RCIMIWMessage>List of messages in the conversation for which read receipts are to be sent
callbackIRCIMIWSendGroupReadReceiptResponseCallbackCallback for the interface call result.

Return Value​

Return ValueDescription
numberThe 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​

ParameterTypeDescription
targetIdstringConversation ID
messageUIdstringThe messageUid of the message for which the read receipt response was received
respondUserIdsMap<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>) => {
//...
}
);