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

Get conversations by ID

Batch query conversation records using an array of conversation IDs.

Copy

When your application already holds a collection of conversationID values, invoke getMultipleConversation() to query their current conversation records in a single batch operation.

Parameters

ParameterTypeRequiredDescription
conversationIDsstring[]YesAn array of conversation identifiers to query.

Code example

import { getMultipleConversation } from '@/uni_modules/unix-openim-sdk'

const result = await getMultipleConversation(conversationIDs)
const conversations = result?.conversations ?? []

conversations.forEach((conversation) => {
  conversationByID.set(conversation.conversationID, conversation)
})

Return value

The Promise resolves with an OpenIMConversationListResult | null object. The returned records are available in the conversations array (OpenIMConversationItem[]). Map and merge records into your view models using conversationID as the key. If a requested conversation ID does not exist locally, it will be omitted from the results; do not assume the returned array matches the positional order or length of the input array. For field definitions, see Retrieve conversation list.

State changes after the call

This call is a read-only snapshot retrieval and does not trigger conversation update events. Continue monitoring conversation events as described in Retrieve conversation list.