Chat / JavaScript
Chat JavaScript v4
Chat JavaScript
Chat
JavaScript
Home
/
Chat
/
JavaScript
/
Message
This is the new Docs for Chat SDK v4 for JavaScript. To see the previous Docs, click here.

Mark messages as delivered

Delivery receipt can be used to see whether a message has successfully been delivered to all the intended recipients by the Sendbird server. Call the markAsDelivered() method to mark a message as delivered as a group channel member, who is online, receives the message from the Sendbird server. For a group channel member who is offline, markAsDelivered() should be called when they come back from the background or go back online.

Using a static methodUsing an instance method
await sb.groupChannel.markAsDelivered(CHANNEL_URL);

When a message is delivered to a group channel member who is online, the message is marked as delivered and other members who are online are notified of delivery receipt through the onUndeliveredMemberCountUpdated() method in the channel event handler. However, when it is delivered to a group channel member who is offline as a push notification, the message can be marked as delivered through the groupChannel.markAsDelivered() method, and other members who are online are notified of the delivery receipt through onUndeliveredMemberCountUpdated().

const channelHandler = new GroupChannelHandler({
    onDeliveryReceiptUpdated = (channel: GroupChannel) => {
        // ...
    },
});
sb.groupChannel.addGroupChannelHandler(UNIQUE_HANDLER_ID, channelHandler);