Read Receipt

Description

After enabling the "Message Read Receipt" feature, the TUIChat component will monitor message scrolling. When unread messages appear within the recipient's chat window's visible zone, it will automatically trigger the sending of read receipts to the sender, meticulously tracking the read status of each message.
Note:
Beginning with version v2.0.0, TUIKit supports message read receipts for both group chats and one-to-one chats. This feature is exclusive to the premium edition,please purchase the premium edition to use.




How to Enable Message Read Receipt

Specifying a Group Type that Supports Read Receipts

For group message read receipts, first, proceed to the Chat Console > Chat > Configuration > Group Configuration > Read receipts for group messages to set the group type that supports read receipt messages.
Note:
Live Chat Groups (AVChatRoom) or Communities (Community) do not support the read receipt feature.

User-side Control for Enabling\Disabling Read Receipt

Note:
After configuring the read receipt for group chats in the console, the read receipt capability is enabled by default. Unless specifically required, there is no need for user-side switch operation.
The user-side also supports manual enabling\disabling of the read receipt capability (which is enabled by default). However, if it is disabled, others cannot see whether they have read (i.e., read receipts will not be sent), likewise one cannot see whether others have read their messages (will not display their sent message's read status).
After successful Sign in, use the TUIUserService.switchMessageReadStatus(isDisplay: boolean) Api to control this switch.
import { TUIUserService } from "@tencentcloud/chat-uikit-engine";

TUIUserService.switchMessageReadStatus(true); // Enable
TUIUserService.switchMessageReadStatus(false); // Disable

Supplementary Materials

Note:
The below content is only for supporting reading material. The read receipt function is already included in the flagship TUIKit. There is no need for user-initiated application.

ReadReceipt Rules for Group and Direct Messaging

After activating the read receipt function, the Message's needReadReceipt field is preset as true, when the message is in the visible position of the other party's message list, a read receipt will be sent. However, one should be aware that the rules for direct messages and group messages differ before and after the activation of the read receipts function.

Group Messaging Read Receipts Rules

1. Before activating the read receipt function in group messages:
Not displaying read status.
2. After group chat enables read receipts:
Get the read count and unread count based on the Message's readReceiptInfo.
For read count of 0: display "Unread".
For unread count of 0: display "All read".
Otherwise, display "x people read", where x is the read count.

Read receipt rules for one-to-one chats

1. Before enabling read receipts in one-to-one chats:
Display the read status, but it is a full read, when the user clicks to enter the conversation, regardless of whether they see the message, all unread messages will be marked as read. Judge whether the message is read or unread based on the Message's isPeerRead.
2. After enabling read receipts in one-to-one chats:
Based on the Message singular readReceiptInfo.isReceiptPeerRead field (boolean) access for read status, it can be determined whether it is in a state of "read" or "unread".

FAQs

1. Error: The usage of this API is not supported by the package. Please upgrade to the premium version.

The "Group Message Read Receipt" feature is only supported by the flagship package. The error message means your current package does not support this capability.

2. How to disable the read feature?

Please refer to the content of Section 2.2 of this document, use TUIUserService.switchMessageReadStatus(isDisplay: boolean) to turn off the read function.
import { TUIUserService } from "@tencentcloud/chat-uikit-engine";

TUIUserService.switchMessageReadStatus(false);

Exchange and Feedback

Join the Telegram technical exchange group or WhatsApp discussion group, enjoy the support of professional engineers, and resolve your issues.