SDKsHarmonyOSEnterprise
Pin conversation
Pin or unpin a conversation to the top of the current user’s conversation list.
Toggle the pinned status of a conversation at the top of the signed-in user's conversation list:
Code example
import sdk, { SetConversationReq } from '@openimsdk/imsdk';
const request: SetConversationReq = {
conversationID: conversationID,
isPinned: true,
};
await sdk.setConversation(request);Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
conversationID | string | Yes | Target conversation identifier. |
isPinned | boolean | Yes | Set to true to pin the conversation to the top; set to false to unpin. |
Return value
Returns a Promise that resolves to void when the pinned state is updated on the server.
State changes after the call
Pinned state only alters conversation sorting for the current user session; it does not affect peer users or group members. Resolving the Promise confirms the update. When EventOnConversationChanged arrives, locate the matching item by conversationID, update its isPinned property, and re-sort the conversation list. For complete event handling, see Retrieve conversation list.
Was this page helpful?