Browse SDKs · HarmonyOS
Platform
SDKsHarmonyOSEnterprise

Get pinned messages in conversation

Query all currently pinned messages within a conversation.

Copy

Retrieves all pinned messages for a specific conversation by conversationID.

Code example

import sdk, { GetConversationPinnedMsgReq, GetConversationPinnedMsgResp } from '@openimsdk/imsdk';

const request: GetConversationPinnedMsgReq = { conversationID: conversationID };
const response: GetConversationPinnedMsgResp = await sdk.getConversationPinnedMsg(request);
replacePinnedMessages(conversationID, response.message);

Parameters

ParameterTypeRequiredDescription
conversationIDstringYesTarget conversation identifier.

Return value

Returns a Promise resolving to GetConversationPinnedMsgResp:

PropertyTypeDescription
messageIMMessage[]Array of currently pinned messages within the conversation.

State changes after the call

In the response payload, message is an array of IMMessage objects. When rendering pinned messages, deduplicate by clientMsgID and reconcile against recent deletion, revocation, or edit events. This query does not fire pin change events; for real-time synchronization, see Pin or unpin a message.