Retrieve conversation list
Paginate and retrieve the conversation list for the current account using the OpenIM React Native SDK.
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
| Parameter | Type | Required | Description |
|---|---|---|---|
offset | number | Yes | Pagination offset index. Pass 0 for the initial page, then increment by the accumulated count. |
count | number | Yes | Maximum 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:
| Field | Type | Description |
|---|---|---|
conversationID | string | Primary conversation identifier. |
conversationType | SessionType | Conversation type: single or group chat. |
userID | string | Target user ID in single chats; empty string in group chats. |
groupID | string | Target group ID in group chats; empty string in single chats. |
showName | string | Display name of the conversation. |
faceURL | string | Avatar image URL for the conversation. |
recvMsgOpt | MessageReceiveOptType | Notification receive options for this conversation. |
unreadCount | number | Total unread message count in this conversation. |
groupAtType | GroupAtType | Group @ mention status; not used in single chats. |
latestMsg | string | Serialized JSON string of the most recent message. |
latestMsgSendTime | number | Send timestamp of the latest message in Unix milliseconds. |
draftText | string | Local message draft saved on this device. |
draftTextTime | number | Timestamp when the draft was last updated. |
isPrivateChatEnterprise | boolean | Whether private chat (burn-after-reading) is enabled. |
burnDurationEnterprise | number | Burn-after-reading countdown duration in seconds. |
isMsgDestructEnterprise | boolean | Whether server message destruction is enabled. |
msgDestructTimeEnterprise | number | Automated server message destruction period in seconds. |
isPinned | boolean | Whether the conversation is pinned to the top. |
isMarkedEnterprise <span className="enterprise-field-badge">Commercial</span> | boolean | Whether the conversation is marked. |
isNotInGroup | boolean | Whether the current user is no longer a member of this group. |
attachedInfo | string | SDK internal metadata. |
ex | string (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.
Was this page helpful?