Browse SDKs · React Native
Platform
SDKsReact Native

Retrieve conversation list

Paginate and retrieve the conversation list for the current account using the OpenIM React Native SDK.

Copy

Paginate and load local conversation records for the authenticated user with getConversationListSplit() to establish the initial list snapshot:

const conversations = await OpenIMSDK.getConversationListSplit({
  offset: 0,
  count: 50,
});

Parameters

ParameterTypeRequiredDescription
offsetnumberYesPagination offset index. Pass 0 for the initial page, then increment by the accumulated count.
countnumberYesMaximum number of conversations to retrieve per batch.

Return value

Resolves to an array of ConversationItem[] for the requested page. When the returned array length is less than count, the end of the list has been reached.

Conversation properties

A ConversationItem object includes display attributes, unread counters, and account-specific preferences:

FieldTypeDescription
conversationIDstringPrimary conversation identifier.
conversationTypeSessionTypeConversation type: single or group chat.
userIDstringTarget user ID in single chats; empty string in group chats.
groupIDstringTarget group ID in group chats; empty string in single chats.
showNamestringDisplay name of the conversation.
faceURLstringAvatar image URL for the conversation.
recvMsgOptMessageReceiveOptTypeNotification receive options for this conversation.
unreadCountnumberTotal unread message count in this conversation.
groupAtTypeGroupAtTypeGroup @ mention status; not used in single chats.
latestMsgstringSerialized JSON string of the most recent message.
latestMsgSendTimenumberSend timestamp of the latest message in Unix milliseconds.
draftTextstringLocal message draft saved on this device.
draftTextTimenumberTimestamp when the draft was last updated.
isPrivateChatEnterprisebooleanWhether private chat (burn-after-reading) is enabled.
burnDurationEnterprisenumberBurn-after-reading countdown duration in seconds.
isMsgDestructEnterprisebooleanWhether server message destruction is enabled.
msgDestructTimeEnterprisenumberAutomated server message destruction period in seconds.
isPinnedbooleanWhether the conversation is pinned to the top.
isMarkedEnterprise <span className="enterprise-field-badge">Commercial</span>booleanWhether the conversation is marked.
isNotInGroupbooleanWhether the current user is no longer a member of this group.
attachedInfostringSDK internal metadata.
exstring (optional)Custom business extension string.
remarkEnterprise <span className="enterprise-field-badge">Commercial</span>string (optional)Custom conversation remark for the current user.

When accumulating paginated results, always deduplicate and merge records using conversationID as the primary key. When refreshing the list, re-query from offset: 0.

Listen for conversation changes

The SDK triggers OnNewConversation when a new conversation entry is created, and OnConversationChanged when an existing conversation mutates (such as new message arrival, unread counter changes, draft updates, or pin toggle). Both event payloads provide ConversationItem[]. Reconcile incoming incremental items into your state keyed by conversationID.

function handleNewConversation(conversations: ConversationItem[]) {
  // Merge new conversations into UI state
}

function handleConversationChanged(conversations: ConversationItem[]) {
  // Update existing conversation entries by conversationID
}

// Register listeners
OpenIMSDK.on(OpenIMEvent.OnNewConversation, handleNewConversation);
OpenIMSDK.on(OpenIMEvent.OnConversationChanged, handleConversationChanged);

// Remove listeners
OpenIMSDK.off(OpenIMEvent.OnNewConversation, handleNewConversation);
OpenIMSDK.off(OpenIMEvent.OnConversationChanged, handleConversationChanged);

Unregister these listeners when the user logs out, switches accounts, or the conversation list unmounts.