please select
  • UIKit
  • SDK
  • Server APIs
Chat/
SDK/
Flutter/
Message/
SDK
  • Install Chat SDK
    • Install
  • Initialize Chat SDK
    • Initialize
  • Login And Logout
    • Login and Logout
  • Message
    • Message Overview
    • Sending Message
    • Receiving Message
    • Historical Message
    • Forwarding Message
    • Modifying Message
    • Message Inserting
    • Deleting Message
    • Clearing Messages
    • Recalling Message
    • Online Message
    • Read Receipt
    • Querying Message
    • Group @ Message
    • Targeted Group Message
    • Notification Muting
    • Message Extension
  • Conversation
    • Conversation Overview
    • Conversation List
    • Getting Conversation
    • Conversation Unread Count
    • Pinning Conversation to the Top
    • Deleting Conversation
    • Conversation Draft
    • Conversation Group
  • Group
    • Group Overview
    • Group Management
    • Group Profile
    • Group Member Management
    • Group Member Profile
    • Custom Group Attribute
  • User
    • User Profile
    • Friend Management
    • Friend List
    • Blocklist
  • Offline Push
    • Offline Push
  • Signaling
    • Signaling Management
  • Local Search
    • Searching for Message
    • Searching for Friend
    • Searching Group
    • Searching for Group Member
  • API Reference
    • Client APIs
  • Guideline for Beginners
  • Console Guide
    • Creating and Upgrading an Application
    • Basic Configuration
    • Feature Configuration
    • Account Management
    • Group Management
    • Webhook Configuration
  • Product Introduction
    • Message Management
      • One-to-One Message
      • Message Storage
      • Offline Push
      • Group Message
      • Message Formats
    • Account System
      • Login Authentication
      • Online Status Management
    • Group Related
      • Group System
      • Group Management
    • User Profile and Relationship Chain
      • Profile Management
      • Relationship Chain Management
  • Purchase Guide
    • Billing Overview
    • Pricing
  • Error Codes

Read Receipt

Feature Description

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.
Note:
To use this feature, you need to purchase the Ultimate edition.
Read receipts for group messages are supported only by Flutter v3.8.0.

Message Read Receipt

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.

Specifying that a message requires a read receipt (by the sender)

After creating a message, the sender specifies that the message requires a read receipt through the needReadReceipt field in V2TimMessage (Details) and then sends the message to the conversation.
Sample code:
V2TimValueCallback<V2TimMsgCreateInfoResult> createCustomMessageRes =
await TencentImSDKPlugin.v2TIMManager
.getMessageManager()
.createCustomMessage(
data: 'Typing...',
);
// Set `needReadReceipt` to `true` when sending the message
TencentImSDKPlugin.v2TIMManager.getMessageManager().sendMessage(id: createCustomMessageRes.data.id, receiver: "", groupID: "groupID",onlineUserOnly: true,needReadReceipt: true);

Sending a message read receipt (by the receiver)

After receiving the message, the receiver determines whether the message requires a read receipt based on the needReadReceipt field in V2TIMMessage (Details). If yes, after the user reads the message, the receiver calls the sendMessageReadReceipts API (Details) to send a read receipt.
Sample code:
V2TimCallback sendMessageReadReceipts = await TencentImSDKPlugin.v2TIMManager.getMessageManager().sendMessageReadReceipts(messageIDList: ['msgids']);
if(sendMessageReadReceipts.code == 0){
// Succeeded
}else{
// Failed
}

Listening for a message read receipt notification (by the sender)

After the receiver sends a message read receipt, the sender can listen for a receipt notification through onRecvMessageReadReceipts in V2TimAdvancedMsgListener (Details) and update the UI based on the notification to display the message as, for example, "Read by two members".
Sample code:
onRecvMessageReadReceipts: (List<V2TimMessageReceipt> receiptList) {
receiptList.forEach((element) {
element.groupID; // Group ID
element.msgID; // Message ID
element.readCount;// Latest read count of the group message
element.unreadCount;// Latest unread count of the group message
element.userID; // ID of the other party of the one-to-one message
});
},

Pulling message read receipt information (by the sender)

After entering the message list, the sender pulls historical messages first, and then calls the getMessageReadReceipts API (Details) to pull the message read receipt information.
The V2TimessageReceipt field of the message read receipt is as described below:
Attribute
Definition
Description
msgID
Message ID
Unique message ID
userID
ID of the receiver
If the message is a one-to-one message, this field indicates the ID of the receiver.
timestamp
Time when the receiver marks the message as read
This field is invalid when a message is read. If the message is a one-to-one message, when the receiver calls the markC2CMessageAsRead API to mark the message as read, the sender will receive the onRecvC2CReadReceipt callback which contains the timestamp information.
groupID
Group ID
If the message is a group message, this field indicates the group ID.
readCount
Number of members who have read the group message
If the message is a group message, this field indicates the number of members who have read the message.
unreadCount
Number of members who have not read the group message
If the message is a group message, this field indicates the number of members who have not read the message.
Sample code:
V2TimValueCallback<List<V2TimMessageReceipt>> getMessageReadReceipts = await TencentImSDKPlugin.v2TIMManager.getMessageManager().getMessageReadReceipts(messageIDList: []);
if(getMessageReadReceipts.code == 0){
getMessageReadReceipts.data.forEach((element) {
// Parse the group message read receipt
element.groupID;
element.msgID;
element.readCount;
element.timestamp;
element.unreadCount;
element.userID;
});
}

Pulling the list of members who have or have not read a group message (by the sender)

To view the list of members who have or have not read a group message, the sender can call the getGroupMessageReadMemberListAPI (Details) to pull the member list by page.
V2TimValueCallback<V2TimGroupMessageReadMemberList> getGroupMessageReadMemberList = await TencentImSDKPlugin.v2TIMManager.getMessageManager().getGroupMessageReadMemberList(messageID: "", filter: GetGroupMessageReadMemberListFilter.V2TIM_GROUP_MESSAGE_READ_MEMBERS_FILTER_READ,);

if(getGroupMessageReadMemberList.code == 0){
// Get the list of members who have or have not read the group message
getGroupMessageReadMemberList.data.isFinished;
getGroupMessageReadMemberList.data.memberInfoList;
getGroupMessageReadMemberList.data.nextSeq;
}