Browse SDKs · WASM
SDKsWASM

Find messages by ID

Locate messages by conversationID and clientMsgID with the WASM SDK.

Copy

For a search result, referenced message, or notification deep link, store both the message's conversationID and clientMsgID, then call findMessageList() to retrieve messages that have already been synchronized locally.

Parameters

findMessageList() accepts an array of query criteria. Each item has the following structure:

ParameterTypeRequiredDescription
items[].conversationIDstringYesID of the conversation containing the target messages.
items[].clientMsgIDListstring[]YesIDs of the messages to find in that conversation.
const { data: result } = await openimsdk.findMessageList([
  {
    conversationID,
    clientMsgIDList: [clientMsgID],
  },
]);

const items = result.findResultItems ?? result.searchResultItems ?? [];
const targetMessage = items[0]?.messageList?.[0];

When the Promise resolves, data is a SearchMessageResult. This method primarily uses findResultItems; for the complete result fields, see Search messages.

One call can contain criteria for multiple conversations. Do not assume that response items correspond to input criteria by array position. Match them by the result's conversationID and each message's clientMsgID. A message may be absent if it has not been synchronized to the local cache, has been deleted, or the ID does not exist. The query does not trigger message events.