Browse SDKs · React Native
SDKsReact Native

Open a conversation

Query a conversation by its chat target and session type.

Copy

Call getOneConversation() to query a conversation by its chat target and session type.

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

Parameters

ParameterTypeRequiredDescription
sourceIDstringYesPass the other user's ID for a one-to-one conversation or the group ID for a group conversation.
sessionTypeSessionTypeYesConversation type. Use SessionType.Single for one-to-one conversations and SessionType.Group for group conversations.

Return result

The call returns a ConversationItem. See Retrieve the conversation list for conversation fields.