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

Pin or unpin a conversation

Set or clear the pinned state of a conversation in the authenticated user’s conversation list.

Copy

Invoke setConversation() to pin or unpin a conversation in the authenticated user's local conversation list. The isPinned property affects list ordering only for the current account; it does not alter the view for other group members or the peer user in a single chat.

Parameters

ParameterTypeRequiredDescription
conversationIDstringYesIdentifier of the target conversation.
isPinnedbooleanYesSet to true to pin the conversation to the top, or false to unpin it.

Code example

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

await setConversation({
  conversationID,
  isPinned: true,
})

Return value

The Promise resolves with void upon successful completion.

State changes after the call

Promise resolution indicates that the SDK updated local storage and dispatched the request to the server. You can immediately update the pinned state of the target conversation in your local UI model. The SDK then emits onConversationChanged, where you can confirm the latest state using conversationID as the primary key. If state verification is required, re-query the conversation record as described in Retrieve conversation list.