Browse SDKs · uni-app / uni-app x
Platform
SDKsuni-app / uni-app xEnterprise

Get pinned messages

Retrieve the list of pinned messages for a specific conversation.

Copy

Retrieving pinned messages is a Commercial Edition capability. Query the pinned messages currently active in a conversation by supplying its conversationID.

Parameters

ParameterTypeRequiredDescription
conversationIDstringYesIdentifier of the target conversation.

Code example

import { getConversationPinnedMsg } from '@/uni_modules/unix-openim-sdk'

const result = await getConversationPinnedMsg({ conversationID })
const messages = result?.message ?? []

replacePinnedMessages(conversationID, messages)

Return value

The Promise resolves with an OpenIMGetConversationPinnedMsgResult | null object. Notice that the array of pinned message items is named message (OpenIMMessageItem[]). Deduplicate and merge items into your banner models using clientMsgID.

State changes after the call

This call returns a point-in-time snapshot and does not emit events. To track live pin and unpin actions, listen for pinned message change events as described in Pin or unpin a message.