/ SDKs / .NET
SDKs
Chat SDKs .NET v4
Chat SDKs .NET
Chat SDKs
.NET
Version 4

Retrieve number of unread items

Copy link

You can retrieve the count of a user's unread messages, unread mentioned messages, or invitations received in group channels and Supergroup channels. You can use this action to display the number of unread items in the UI so that users may check them. This is only available in group channels and Supergroup channels.

To get the count, use the GetUnreadItemCount() method with SbUnreadItemKey.

try {
  final unreadItemCount = await SendbirdChat.getUnreadItemCount([
    UnreadItemKey.nonSuperGroupChannelUnreadMessageCount,
  ]);
  // unreadItemCount.nonSuperGroupChannelUnreadMessageCount
} catch (e) {
  // Handle error.
}

The following table lists some of the properties in SbUnreadItemKey. To see the comprehensive list of all properties in SbUnreadItemKey, see the API reference.

Property nameDescription

GroupChannelInvitationCount

The number of invitations from group channels and Supergroup channels the user has received.

GroupChannelUnreadMentionCount

The number of messages in group channels and Supergroup channels where the user was mentioned but the user hasn't read.

GroupChannelUnreadMessageCount

The number of messages in group channels and Supergroup channels the user hasn't read.

NonSuperGroupChannelInvitationCount

The number of invitations from group channels the user has received.

NonSuperGroupChannelUnreadMentionCount

The number of messages in group channels where the user was mentioned but the user hasn't read.

NonSuperGroupChannelUnreadMessageCount

The number of messages in group channels the user hasn't read.

SuperGroupChannelInvitationCount

The number of invitations from Supergroup channels the user has received.

SuperGroupChannelUnreadMentionCount

The number of messages in Supergroup channels where the user was mentioned but the user hasn't read.

SuperGroupChannelUnreadMessageCount

The number of messages in Supergroup channels the user hasn't read.