SDKsHarmonyOSEnterprise
Find messages by ID
Look up locally synchronized messages by conversation ID and client message IDs.
When navigating from search results, quoted replies, or push notifications, retain both the conversation ID and client message ID.
Code example
import sdk, { FindMessageListReq, FindMessageListResp } from '@openimsdk/imsdk';
const request: FindMessageListReq = {
conversationsArgs: [
{
conversationID: conversationID,
clientMsgIDList: [clientMsgID],
},
],
};
const response: FindMessageListResp = await sdk.findMessageList(request);
const results = response.findResultItems;Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
conversationsArgs | ConversationArgs[] | Yes | List of query criteria grouped by conversation, each containing conversationID and clientMsgIDList. |
Return value
Returns a Promise resolving to FindMessageListResp:
| Property | Type | Description |
|---|---|---|
totalCount | number | Total number of messages retrieved across all queried conversations. |
findResultItems | FindResultItem[] | List of result sets grouped by conversation. |
State changes after the call
A single invocation can query across multiple conversations. Do not assume returned items match the order of input arrays; match records using conversationID on result items and clientMsgID on messages. When messages have not yet synced, have been deleted, or IDs do not exist, the response returns empty results. To locate context around a message and expand surrounding history, see Load message context.
Was this page helpful?