Browse SDKs · React Native
Platform
SDKsReact Native

Get conversation by target

Retrieve a single conversation item by target ID and session type using the OpenIM React Native SDK.

Copy

Retrieve the conversation details for a specific chat recipient or group using getOneConversation():

const conversation = await OpenIMSDK.getOneConversation({
  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 the matching ConversationItem object.

This query retrieves a local snapshot and does not trigger conversation events. Subsequent state updates arrive asynchronously via event listeners as described in Conversation overview; for field details, see Retrieve conversation list.