- Android
- iOS
- JavaScript
- Flutter
- ReactNative
Set message pinning. A message in a conversation can be placed at the top as a reminder. Use isTop to distinguish between set pin and remove pin.
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);
Set message pinning. A message in a conversation can be placed at the top as a reminder. Use isTop to distinguish between set pin and remove pin.
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;
Set message pinning. A message in a conversation can be placed at the top as a reminder. Use isTop to distinguish between set pin and remove pin.

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 userId; 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
No parameters are returned. The callback indicates success when invoked.
Failure Callback
| Name | Type | Description | Version |
|---|---|---|---|
| error | Object | A status code is provided when sending fails. Check error.msg directly 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)
});
Set message pinning. A message in a conversation can be placed at the top as a reminder. Use isTop to distinguish between set pin and remove pin.
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);