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

Retrieve number of unread items

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, call the getUnreadItemCount(key:completionHandler:) method using UnreadItemKey.

The following table lists some of the properties in UnreadItemKey. To see the comprehensive list of all properties in UnreadItemKey, 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.

nonSuperInvitationCount

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

nonSuperUnreadMentionCount

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

nonSuperUnreadMessageCount

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

superInvitationCount

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

superUnreadMentionCount

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

superUnreadMessageCount

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

SendbirdChat.getUnreadItemCount(
    key: [.groupChannelUnreadMessageCount, .groupChannelUnreadMentionCount]
) { count, error in

}