Skip to main content

Starting March 27, 2026, RC is rebranded as Nexconn. Existing RC SDK customers can continue using this documentation. New customers should refer to the Nexconn developer documentation.

Get Unread Messages in a Conversation

The IMLib SDK supports retrieving unread messages from specified conversations, enabling apps to jump to the first unread message or display all unread @ mentions.

Get the First Unread Message in a Conversation

You can use getFirstUnreadMessage: to obtain the earliest unread message in a conversation.

Method Signature

- (void)getFirstUnreadMessage:(RCConversationType)conversationType
targetId:(NSString *)targetId
completion:(nullable void(^)(RCMessage *_Nullable message))completion;

Parameters

ParameterTypeDescription
conversationTypeRCConversationTypeConversation type. Use ConversationType_PRIVATE for one-to-one chats
targetIdNSStringTarget ID of the conversation
completionBlockCallback that returns an RCMessage object.

Example

[[RCCoreClient sharedCoreClient] getFirstUnreadMessage:ConversationType_PRIVATE targetId:@"targetId" completion:^(RCMessage * _Nullable message) {

}];

Get Unread @ Mentions in a Conversation

tip
  • Versions below 5.2.5 only provide the getUnreadMentionedMessages method without count and desc parameters, returning a maximum of 10 messages per call.
  • Starting from version 5.2.5, getUnreadMentionedMessages supports count and desc parameters. This method is only available in RCCoreClient.
  • Starting from version 5.3.0, it's recommended to use the asynchronous interface below, while the original synchronous interface is deprecated.

Retrieves the earliest or latest unread @ mentions in a conversation, with a maximum of 100 messages returned.

Method Signature

- (void)getUnreadMentionedMessages:(RCConversationType)conversationType
targetId:(NSString *)targetId
completion:(nullable void(^)(NSArray<RCMessage *> *_Nullable messages))completion;

Parameters

ParameterTypeDescription
conversationTypeRCConversationTypeConversation type
targetIdNSStringConversation ID
countintNumber of messages (max 100)
descBOOLYES: Fetch the latest count messages. NO: Fetch the earliest count messages.
completionBlockAsync callback that returns a list of message objects (RCMessage).

Example Code

[[RCCoreClient sharedRCCoreClient]
getUnreadMentionedMessages:ConversationType_PRIVATE
targetId:@"targetId"
count:count
desc: NO
completion:completion:^(RCMessage * _Nullable message) {

}];