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
Adding 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 most useful in direct chats or in small group chats to indicate which users have read a particular message. They're not commonly used in high-occupancy chats, or in broadcasts with many users.
Removing a receipt from a message
Use removeMessageAction() to remove a receipt from a message. A receipt can only be removed by the user who added that receipt.
Fetching message receipts
Use getMessageActions() to fetch receipts in a channel 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.
Fetching messages with receipts
Use the includeMessageActions flag (fetchActions in Swift) with the fetchMessages() method to fetch past messages in a channel along with receipts that were added to those messages.
To fetch the 25 most recent messages in a channel, 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.
Start and End parameters
Messages are always returned in chronological order — from oldest to newest — within the timetoken range you request.
If you specify only the start parameter (without end), you will receive messages older than the start timetoken value.
If you specify only the end parameter (without start), you will receive messages from the last (most recent) message going back to that timetoken value.
Specify values for both start and end to retrieve messages between those timetokens (inclusive of the end value).