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 fetchMessages() to fetch historical messages in a space with receipts from storage using start and end timestamps.
You can also fetch the most recent messages in a space by passing the start timestamp and a count of number of messages to fetch. Keep in mind that you will still receive a maximum of 100 messages. Iterative call history adjusting the timetokens to page through the full set of results if more than 100 messages need to be fetched.
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).