Browse SDKs · uni-app / uni-app x
SDKsuni-app

Resolve a conversation ID

OpenIM uni-app / uni-app x SDK guide for Resolve a conversation ID.

Copy

getConversationIDBySessionType() returns the canonical conversationID used by Core. It is useful for building a route key before a conversation item exists.

import {
  OpenIMSessionTypeGroup,
  getConversationIDBySessionType,
} from '@/uni_modules/unix-openim-sdk'

const conversationID = await getConversationIDBySessionType({
  sourceID: 'group_123',
  sessionType: OpenIMSessionTypeGroup,
})

Do not concatenate a one-to-one or group conversation ID yourself; each session type has its own canonical rules. The returned string does not prove that a conversation exists and does not create server data. Query the conversation by target or the conversation list when complete conversation data is needed.