- Android
- iOS
- JavaScript
- Flutter
- ReactNative
Pin a message at the top of a conversation or remove an existing pin. Use isTop to select the operation.
API Definition
/**
* set pin status
* @param messageId message ID
* @param conversation identifier of the conversation containing the message
* @param isTop whether the message is pinned
* @param callback result callback
*/
void setTop(String messageId, Conversation conversation, boolean isTop, ISimpleCallback callback);
Pin a message at the top of a conversation or remove an existing pin. Use isTop to select the operation.
API Definition
/// set pin status
/// - Parameters:
/// - isTop: YES pins the message; NO leaves it unpinned
/// - messageId: message ID
/// - conversation: conversation identifier
/// - successBlock: success callback
/// - errorBlock: failure callback
- (void)setTop:(BOOL)isTop
messageId:(NSString *)messageId
conversation:(JConversation *)conversation
success:(void (^)(void))successBlock
error:(void (^)(JErrorCode code))errorBlock;
Pin a message at the top of a conversation or remove an existing pin. Use isTop to select the operation.

Parameters
| Name | Type | Required | Default | Description | Version |
|---|---|---|---|---|---|
| message | Object | Yes | Message object | 1.0.0 | |
| message.conversationType | Number | Yes | Conversation type | 1.0.0 | |
| message.conversationId | String | Yes | Conversation ID. For PRIVATE conversations, it is the recipient user ID; for GROUP conversations, it is the group ID. | 1.0.0 | |
| message.messageId | String | Yes | ID of the message to pin | 1.0.0 | |
| message.isTop | Boolean | Yes | Whether the message is pinned | 1.0.0 |
Success Callback
This callback indicates success and returns no parameters.
Failure Callback
| Name | Type | Description | Version |
|---|---|---|---|
| error | Object | A status code is returned if the operation fails. Check error.msg or see status codes. | 1.0.0 |
Code Example
let { ConversationType } = JIM;
let msg = {
conversationType: ConversationType.GROUP,
conversationId: 'groupid1',
messageId: 'xxxdkadhdsa',
isTop: true
};
jim.setTopMessage(msg).then(() => {
console.log('set message top successfully.')
}, (error) => {
console.log(error)
});
Pin a message at the top of a conversation or remove an existing pin. Use isTop to select the operation.
Parameters
| Name | Type | Description | Version |
|---|---|---|---|
| messageId | String | Message ID | 1.0.0 |
| conversation | Conversation | Conversation identifier | 1.0.0 |
| isTop | boolean | Whether the message is pinned | 1.0.0 |
Code Example
import JuggleIM from 'juggleim-rnsdk';
const messageId = 'messageId1';
const conversation = {
type: 1,
id: 'userId1'
};
const isTop = true;
const success = await JuggleIM.setMessageTop(messageId, conversation, isTop);
console.log('setMessageTop success:', success);