A Receipt is state on a message that indicate that the message has been delivered or read. Receipts are generated by the recipient of a message back to the original sender or to all users in the chat room.
There are two main types of message receipts:
Delivered state indicates that the message has been delivered to the recipient
Read state indicates that the message has been read by the recipient
Add a message receipt
Use addMessageAction() to add a receipt to a message. You may want to use a value of message_delivered to indicate a message has been delivered, and a value of message_read to indicate the message has been displayed to the user.
You'll need to implement client-side logic to determine how and when you want to mark a message as delivered or read. For instance, messages should be marked as read when a user scrolls through the message in the chat room.
Message Receipts are more useful in direct chats or in small group chats to indicate which users have read a particular message. They are not commonly used in high-occupancy chats or in a broadcast with many users.
Remove a receipt from a message
Use removeMessageAction() to remove a receipt from a message. The receipt can only be removed by the user who added that receipt.
Get message receipts in a space
Use getMessageActions() to fetch receipts in a space from storage using start and end timestamps. This method can be used to fetch new receipts that were added after a certain timestamp when the user returns to the application.
Get messages with receipts
Use the includeMessageActions flag enabled to fetch past messages in a space along with receipts that were added to those messages.
To fetch the 25 most recent messages in a space, fetch messages and specify neither the start nor the end parameter. If there are more than 25 messages to be fetched, you can iterate through the message history by adjusting the start and end timetokens to page through the full set of results.
Using Start and End Parameters
If only the start parameter is specified (without end), you will receive messages that are older than and up to that start timetoken value.
If only the end parameter is specified (without start) you will receive messages that match that end timetoken value and newer.
Specifying values for both start and end parameters will return messages between those timetoken values (inclusive on the end value).