Group Chat Message 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 a Receipt Request
Initiate a read receipt request for a message.
Method
Future<int> sendGroupReadReceiptRequest(RCIMIWMessage message, {IRCIMIWSendGroupReadReceiptRequestCallback? callback});
Parameter Description
Parameter Name | Parameter Type | Description |
---|---|---|
message | RCIMIWMessage | The message for which a read receipt is requested |
callback | IRCIMIWSendGroupReadReceiptRequestCallback | Event callback. SDK supports callback from version 5.3.1. Other callback methods are deprecated starting from version 5.4.0. If the callback parameter is provided, only the callback will be triggered. |
Return Value
Return Value | Description |
---|---|
Future<int> | The status code of the current operation. 0 indicates success, and the specific result needs to be implemented in the interface callback. Non-zero indicates failure, and the interface callback will not be triggered. Refer to the error codes for details. |
Code Example
IRCIMIWSendGroupReadReceiptRequestCallback? callback = IRCIMIWSendGroupReadReceiptRequestCallback(onGroupReadReceiptRequestSent: (int? code, RCIMIWMessage? message) {
//...
});
int? ret = await engine?.sendGroupReadReceiptRequest(message, callback:callback);
Callback Method
-
onGroupReadReceiptRequestSent
Listener for the interface call result.
Function(int? code, RCIMIWMessage? message)? onGroupReadReceiptRequestSent;
Parameter Description
Parameter Name | Parameter Type | Description |
---|---|---|
code | int | The status code of the interface callback. 0 indicates success, non-zero indicates an exception. |
message | RCIMIWMessage | The message for which a read receipt is requested |
Code Example
engine?.onGroupReadReceiptRequestSent = (int? code, RCIMIWMessage? message) {
//...
};
Listen to Group Chat Receipt Requests
Method
Function(String? targetId, String? messageUId)? onGroupMessageReadReceiptRequestReceived;
Parameter Description
Parameter Name | Parameter Type | Description |
---|---|---|
targetId | String | The conversation ID |
messageUId | String | The of the message |
Code Example
engine?.onGroupMessageReadReceiptRequestReceived = (String? targetId, String? messageUId) {
//...
};
Respond to Receipt Requests
Upon receiving a receipt request, the recipient needs to respond to notify the sender that the message has been read. Multiple messages in the same conversation can be responded to at once.
Method
Future<int> sendGroupReadReceiptResponse(String targetId, String? channelId, List<RCIMIWMessage> messages, {IRCIMIWSendGroupReadReceiptResponseCallback? callback});
Parameter Description
Parameter Name | Parameter Type | Description |
---|---|---|
targetId | String | The conversation ID |
channelId | String | The channel ID, only supported for ultra groups. For other conversation types, pass null. |
messages | List<RCIMIWMessage> | The list of messages in the conversation for which read receipts are to be sent |
callback | IRCIMIWSendGroupReadReceiptResponseCallback | Event callback. SDK supports callback from version 5.3.1. Other callback methods are deprecated starting from version 5.4.0. If the callback parameter is provided, only the callback will be triggered. |
Return Value
Return Value | Description |
---|---|
Future<int> | The status code of the current operation. 0 indicates success, and the specific result needs to be implemented in the interface callback. Non-zero indicates failure, and the interface callback will not be triggered. Refer to the error codes for details. |
Example Code
IRCIMIWSendGroupReadReceiptResponseCallback? callback = IRCIMIWSendGroupReadReceiptResponseCallback(onGroupReadReceiptResponseSent: (int? code, List<RCIMIWMessage>? message) {
//...
});
int? ret = await engine?.sendGroupReadReceiptResponse(targetId, channelId, messages, callback:callback);
Callback Method
-
onGroupReadReceiptResponseSent
Listener for the interface call result.
Function(int? code, String? targetId, String? channelId, List<RCIMIWMessage>? messages)? onGroupReadReceiptResponseSent;
Parameter Description
Parameter Name | Parameter Type | Description |
---|---|---|
code | int | The status code of the interface callback. 0 indicates success, non-zero indicates an exception. |
targetId | String | The conversation ID |
channelId | String | The channel ID, only supported for ultra groups. For other conversation types, pass null. |
messages | List<RCIMIWMessage> | The list of messages in the conversation for which read receipts are to be sent |
Code Example
engine?.onGroupReadReceiptResponseSent = (int? code, String? targetId, String? channelId, List<RCIMIWMessage>? messages) {
//...
};
Listen to Group Chat Receipt Responses
Method
Function(String? targetId, String? messageUId, Map? respondUserIds)? onGroupMessageReadReceiptResponseReceived;
Parameter Description
Parameter Name | Parameter Type | Description |
---|---|---|
targetId | String | The conversation ID |
messageUId | String | The of the message for which the receipt response was received |
respondUserIds | Map<String, Long> | The list of users in the conversation who responded to this message. Key: user ID; Value: response time. |
Code Example
engine?.onGroupMessageReadReceiptResponseReceived = (String? targetId, String? messageUId, Map? respondUserIds) {
//...
};