Unread messages

LAST EDIT Apr 25 2024

Users can have unread messages in a channel because new messages arrived while they were away, or because they explictly marked a message as unread.

Marking a message as unread

Copied!

You can mark a message as unread from client-side:

Or from server-side by providing a user id:

For performance reasons it's only possible to mark any of the last 100 messages of the channel as unread.

Marking a channel as read

Copied!

You can mark all messages in a channel as read like this on the client-side:

Or from server-side by providing a user id:

Last read message

Copied!

The last_read_message_id field tells which was the last read message that a given user read in the channel.

Read state

Copied!

When you retrieve a channel from the API (e.g. using query channels), the read state for all members is included in the response.

The read state includes the number of unread messages, the last read message id, and when the user read the channel. An example:

The last read message id is updated in the following events:

  • message.read

  • notification.mark_read

  • notification.mark_unread

Jump to last read message

Copied!

This is how you can jump to the last read message inside a given channel: