Message Counts

Retrieve the count of unread messages since the last read timestamp using the messageCounts method.

Retrieve unread message counts

If you store the timestamp of the last message that a user read, you can use the messageCounts method to fetch how many messages have been sent since that last message for a given channel.

chat.messageCounts([
    { channelId: "alpha", timestamp: 1617883692337 },
    { channelId: "bravo", timestamp: 1617883692337 }
]).then((res) => {
    const { channels } = res;
    channels.forEach(channel => {
        const { id, count } = channel;
        // Use `id` and `count` to update the unread counts for each channel.
    });
});

.messageCounts(channelTimestampPairs: array)

Last updated

Logo

© Copyright 2024 ALO.ai, Inc. • All Rights Reserved