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.
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
| Parameter | Type | Required | Description |
|---|---|---|---|
sourceID | string | Yes | Target identifier: user ID for direct 1-on-1 chats, or group ID for group chats. |
sessionType | SessionType | Yes | Conversation 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.
Was this page helpful?