SDKsReact Native
Find messages by ID
Locate specific messages by conversation ID and client message IDs using the OpenIM React Native SDK.
Look up specific messages by conversation ID and client message ID list:
This query is ideal when jumping directly to a referenced message from search results, quoted replies, system notices, or offline push notifications.
const result = await OpenIMSDK.findMessageList([
{
conversationID,
clientMsgIDList: [clientMsgID],
},
]);
const targetMessage = result.findResultItems?.[0]?.messageList?.[0];Parameters
Supply an array of query condition objects. Each entry defines a conversation-level lookup scope:
| Parameter | Type | Required | Description |
|---|---|---|---|
conversationID | string | Yes | Target conversation ID containing the messages. |
clientMsgIDList | string[] | Yes | Array of client message IDs to locate. |
Return value
A resolved Promise returns a SearchMessageResult object, where matched messages reside in findResultItems:
- Each entry in
findResultItemscontains the targetconversationIDand matchingmessageList: MessageItem[]. - If an ID is not found locally or on the server, the corresponding item is omitted or returns an empty
messageList. - For complete result structures and multi-criteria queries, see Search messages.
Was this page helpful?