Browse SDKs · React Native
Platform
SDKsReact Native

Get conversation ID

Generate or retrieve a deterministic conversation ID based on target ID and session type with the OpenIM React Native SDK.

Copy

Derive the deterministic conversation ID locally based on the chat target ID and session type using getConversationIDBySessionType():

const conversationID = await OpenIMSDK.getConversationIDBySessionType({
  sourceID: targetUserID,
  sessionType: SessionType.Single,
});

Parameters

ParameterTypeRequiredDescription
sourceIDstringYesTarget identifier: user ID for direct 1-on-1 chats, or group ID for group chats.
sessionTypeSessionTypeYesConversation session type: SessionType.Single for direct chats, or SessionType.Group for group chats.

Return value

Resolves to a string representing the deterministic conversationID. This identifier serves as the primary key for locating conversation records, filtering events, and executing conversation-specific operations.