SDKsHarmonyOSEnterprise
Retrieve conversations by ID
Batch query conversation records for an array of conversation IDs.
Query a batch of conversation records by supplying a list of conversation IDs:
Code example
import sdk, { GetMultipleConversationReq, GetMultipleConversationResp } from '@openimsdk/imsdk';
const request: GetMultipleConversationReq = {
conversationIDList: conversationIDs,
};
const response: GetMultipleConversationResp = await sdk.getMultipleConversation(request);
mergeConversations(response.conversationList);Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
conversationIDList | string[] | Yes | List of target conversation IDs to retrieve. |
Return value
Returns a Promise that resolves to a GetMultipleConversationResp object:
| Property | Type | Description |
|---|---|---|
conversationList | IMConversation[] | Array of found conversation records. Unmatched IDs are omitted. |
State changes after the call
If a requested ID does not correspond to an existing conversation record, it is silently omitted from the returned array. The order of returned conversations is not guaranteed to match the order of input IDs; correlate and merge records into local stores using conversationID. To listen for subsequent changes, see Retrieve conversation list.
Was this page helpful?