Skip to main content

Pin Conversation

Set Conversation to Top

Call the setConversationToTop method to pin a conversation to the top.

Interface

RongIMLib.setConversationToTop(consersation, isTop, isUpdateTime)


#### Parameter Description

| Parameter | Type | Required | Description |
|:--- |:--- |:--- |:--- |
| conversation | [IConversationOption](https://doc.rongcloud.cn/apidoc/im-web/latest/zh_CN/interfaces/IConversationOption.html) | Yes | Target conversation |
| isTop | Boolean | No | Whether to pin to top |
| isUpdateTime | Boolean | No | Whether to update the conversation operation timestamp (default: true). Only supported on Electron platform. |
| isCreateConversation | Boolean | No | Whether to create a local conversation if it doesn't exist. Only supported on Electron platform. Added in v5.20.0. |


#### Example Code

```js
const conversation = {
conversationType: RongIMLib.ConversationType.PRIVATE,
targetId: 'receiverUserId',
}
const isTop = true

const res = await RongIMLib.setConversationToTop(conversation, isTop);
console.info('Conversation pin result:', res);