Mark Messages as Delivered
In other words, as a recipient, how do I inform the sender that I’ve received a message? You can mark the messages for a particular conversation as read using themarkAsDelivered() method. This method takes the below parameters as input:
Messages for both user & group conversations can be marked as read using this method.
Ideally, you would like to mark all the messages as delivered for any conversation when the user opens the chat window for that conversation. This includes two scenarios:
- When the list of messages for the conversation is fetched: In this case you need to obtain the last message in the list of messages and pass the message ID of that message to the markAsDelivered() method.
- When the user is on the chat window and a real-time message is received: In this case you need to obtain the message ID of the message and pass it to the markAsDelivered() method.
- User
Mark as Delivered
UsemarkAsDelivered() to mark messages as delivered. You can pass either a message object or individual parameters.
Using Message Object
- TypeScript
- JavaScript
Using Parameters
- TypeScript (User)
- JavaScript (User)
- TypeScript (Group)
- JavaScript (Group)
Mark Conversation as Delivered
UsemarkConversationAsDelivered() to mark all messages in a conversation as delivered.
markConversationAsDelivered() resolves with a string on success.
- TypeScript (User)
- JavaScript (User)
- TypeScript (Group)
- JavaScript (Group)
Mark as Read
UsemarkAsRead() to mark messages as read. You can pass either a message object or individual parameters.
Using Message Object
- TypeScript
- JavaScript
Using Parameters
- TypeScript (User)
- JavaScript (User)
- TypeScript (Group)
- JavaScript (Group)
Mark Conversation as Read
UsemarkConversationAsRead() to mark all messages in a conversation as read.
- TypeScript (User)
- JavaScript (User)
- TypeScript (Group)
- JavaScript (Group)
Real-Time Receipt Events
Register aMessageListener to receive delivery and read receipt events.
- TypeScript
- JavaScript
MessageReceipt objects. The message receipt contains the below parameters:
The
markAsDelivered() and markAsRead() methods are fire-and-forget — they do not return a MessageReceipt object. Use the listener callbacks above to receive delivery and read confirmations.
You will receive a list of MessageReceipt objects.
The following features will be available only if the Enhanced Messaging Status feature is enabled for your app.
onMessagesDeliveredToAllevent,onMessagesReadByAllevent,deliveredAtfield in a group message,readAtfield in a group message.markMessageAsUnreadmethod.
MessageReceipt Object
The listener callbacks receive aMessageReceipt object:
Get Receipt History
UsegetMessageReceipts() to fetch delivery and read receipts for a specific message. Useful for group messages to see which members have received/read the message.
- TypeScript
- JavaScript
MessageReceipt objects.
Missed Receipts
When fetching messages, each message object includesdeliveredAt and readAt timestamps indicating when the message was delivered and read.
The following features require Enhanced Messaging Status to be enabled for
your app: -
onMessagesDeliveredToAll event - onMessagesReadByAll event -
deliveredAt field in group messages - readAt field in group messages -
markMessageAsUnread() methodMark as Unread
UsemarkAsUnread() to mark a message as unread. This is useful for “mark as unread” functionality in conversation lists. Pass a message object (TextMessage, MediaMessage, or CustomMessage).
- TypeScript
- JavaScript
Next Steps
Typing Indicators
Show real-time typing status in conversations
Receive Messages
Listen for incoming messages in real time
Retrieve Conversations
Fetch conversation list with unread counts
All Real-Time Listeners
Complete reference for all SDK event listeners