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.

Retrieve number of members who haven't received a message

You can retrieve the number of members who haven’t received a specific message in a group channel. When the value of zero is returned, it means that the message has been successfully delivered to all members in the channel.

const createChannelParams: GroupChannelCreateParams = {
    invitedUserIds: [USER_2, USER_3],
};

const channel = await sb.groupChannel.createChannel(createParams);
channel.sendUserMessage({
    message: 'Hi Sendbirdians!',
})
    .onSucceeded((message: UserMessage) => {
    const numberOfUndeliveredMembers = channel.getUndeliveredMemberCount(message);
    // The number of members who haven’t received the message.
    // ...
    })
    .onFailed((err: SendbirdError, message: UserMessage) => {
    // Handle error.
    });