The Message object is the common message object provided by the SDK. It acts like a base class; Message.content is a concrete subtype, such as a text message or image message.

- Android
- iOS
- JavaScript
- Flutter
- ReactNative
- HarmonyOS
| Property | Type | Description | Version |
|---|---|---|---|
| conversation | Conversation | Conversation that contains the message. | 1.0.0 |
| contentType | String | Message type, such as text or image. | 1.0.0 |
| content | MessageContent | Message content. It depends on contentType; for example, when contentType is jg:text, content is a text message. | 1.0.0 |
| messageId | String | Globally unique message identifier. | 1.0.0 |
| clientMsgNo | long | Local unique message number (the unique ID in the local database). | 1.0.0 |
| direction | MessageDirection | Message direction, indicating "received message or sent message" | 1.0.0 |
| state | MessageState | Message state, indicating "sending or sent successfully or failed to send" | 1.0.0 |
| hasRead | boolean | Whether the message has been read. | 1.0.0 |
| timestamp | long | Message send time, as a server timestamp in milliseconds. | 1.0.0 |
| senderUserId | String | Sender userId. | 1.0.0 |
| referredMessage | Message | Referenced message. | 1.0.0 |
| mentionInfo | MessageMentionInfo | Mention information. | 1.0.0 |
| localAttribute | String | Local message attributes. They apply only on this client and are not synchronized to the server. | 1.0.0 |
| groupMessageReadInfo | GroupMessageReadInfo | Group-message read information. Applies only to group messages. | 1.0.0 |
| isEdit | boolean | Whether the message was edited. | 1.0.0 |
| isDeleted | boolean | Whether the message was deleted. | 1.0.0 |
| destroyTime | long | Message destruction timestamp in server milliseconds. The default value 0 means no automatic destruction. | 1.0.0 |
| lifeTimeAfterRead | long | Message lifetime after reading, in milliseconds. The default value 0 means no automatic destruction after reading. | 1.0.0 |
| senderDisplayName | String | Sender display name, shown according to the default display rules | 1.8.39 |
| friendAlias | String | Sender friend alias. | 1.8.39 |
| groupMemberAlias | String | Sender group-member alias. | 1.8.39 |
| senderName | String | Sender actual name. | 1.8.39 |
| senderPortrait | String | Sender avatar URL. | 1.8.39 |
| Property | Type | Description | Version |
|---|---|---|---|
| conversation | JConversation | Conversation that contains the message. | 1.0.0 |
| contentType | NSString | Message type, such as text or image. | 1.0.0 |
| content | JMessageContent | Message content. It depends on contentType; for example, when contentType is jg:text, content is a text message. | 1.0.0 |
| messageId | NSString | Globally unique message identifier. | 1.0.0 |
| clientMsgNo | long long | Local unique message number (the unique ID in the local database). | 1.0.0 |
| direction | JMessageDirection | Message direction, indicating “received message or sent message” | 1.0.0 |
| messageState | JMessageState | Message state, indicating “sending or sent successfully or failed to send” | 1.0.0 |
| hasRead | BOOL | Whether the message has been read. | 1.0.0 |
| timestamp | long long | Message send time, as a server timestamp in milliseconds. | 1.0.0 |
| senderUserId | NSString | Sender userId. | 1.0.0 |
| referredMsg | Message | Referenced message. | 1.0.0 |
| mentionInfo | MessageMentionInfo | Mention information. | 1.0.0 |
| localAttribute | String | Local message attributes. They apply only on this client and are not synchronized to the server. | 1.0.0 |
| groupReadInfo | JGroupMessageReadInfo | Group-message read information. Applies only to group messages. | 1.0.0 |
| isEdit | BOOL | Whether the message was edited. | 1.0.0 |
| isDeleted | BOOL | Whether the message has been deleted | 1.0.0 |
| destroyTime | long long | Message destruction timestamp in server milliseconds. The default value 0 means no automatic destruction. | 1.0.0 |
| lifeTimeAfterRead | long long | Message lifetime after reading, in milliseconds. The default value 0 means no automatic destruction after reading. | 1.0.0 |
| senderDisplayName | NSString | Sender display name, shown according to the default display rules | 1.8.39 |
| friendAlias | NSString | Sender friend alias. | 1.8.39 |
| groupMemberAlias | NSString | Sender group-member alias. | 1.8.39 |
| senderName | NSString | Sender actual name. | 1.8.39 |
| senderPortrait | NSString | Sender avatar URL. | 1.8.39 |
| Property | Type | Description | Version |
|---|---|---|---|
| conversationId | String | conversation ID. For PRIVATE conversations, it is the recipient userId; for GROUP conversations, it is the group ID. | 1.0.0 |
| conversationType | Number | conversation type | 1.0.0 |
| conversationTitle | String | conversation title. To change it, update the corresponding user or group name. | 1.0.0 |
| conversationPortrait | String | conversation portrait. To change it, update the corresponding user or group portrait. | 1.0.0 |
| conversationExts | Object | conversation extensions. To change them, update the corresponding user or group extensions. | 1.0.0 |
| tid | String | Locally generated temporary message ID. Message sending is asynchronous; both a successful send and the onbefore event return tid, which can be used to update the message send state in the UI. | 1.0.0 |
| messageId | String | Server-generated message ID. It uniquely identifies each message globally. | 1.0.0 |
| name | String | Message name. Use it to render the message in the UI after it is sent or received. | 1.0.0 |
| content | Object | Message content. It depends on the name property; for example, when name is jg:text, content is a text message. | 1.0.0 |
| sentState | Number | Message send state | 1.0.0 |
| sentTime | Number | Message send time as a millisecond timestamp. It can be used to display the send time for each message in the UI. | 1.0.0 |
| sender | Object | User information for the message sender | 1.0.0 |
| sender.id | String | Message sender ID. Use the API to update it | 1.0.0 |
| sender.name | String | Message sender name. Use the API to update it | 1.0.0 |
| sender.portrait | String | Message sender portrait. Use the API to update it | 1.0.0 |
| sender.exts | Object | User extension fields. Use the API to update them | 1.0.0 |
| attribute | String | Applies in Electron. Local message extension attributes, such as a local file URL, can be changed through Update Local Message Extensions. | 1.0.0 |
| reactions | Object | Message reactions | 1.8.0 |
| mentionInfo | Object | Mention information. | 1.0.0 |
| mentionInfo.mentionType | Number | @all members or specified members. See MentionType for enum values. | 1.0.0 |
| mentionInfo.members | Array | List of mentioned members. It is populated when specific members are mentioned and contains id, name, and portrait. | 1.0.0 |
| referMsg | Object | Content of the referenced or reply message, including sender information. See the Message object for details. | 1.0.0 |
| isMass | Boolean | Whether the current message is a broadcast message | 1.0.0 |
| isUpdated | Boolean | Whether the message has been modified | 1.0.0 |
| isSender | Boolean | Whether the current user is the sender. For example, in the UI, sent messages appear on the right and received messages on the left. | 1.0.0 |
| isRead | Boolean | Applies to private conversations. Indicates whether the recipient has read this message. | 1.0.0 |
| readCount | Number | Applies to group conversations. Number of members who have read the message, based on the group size when the message was sent; it does not change as group membership changes. | 1.0.0 |
| unreadCount | Number | Applies to group conversations. Number of members who have not read the message, based on the group size when the message was sent; it does not change as group membership changes. | 1.0.0 |
| destroyTime | Number | Message destruction timestamp. A value greater than 0 indicates that the message should be destroyed, for example when a destruction time was set while sending it. | 1.9.0 |
| lifeTimeAfterRead | Number | Read-once message destruction timestamp. A value greater than 0 indicates a read-once message; for example, destroy it one minute after reading by setting 1 * 60 * 1000 ms. | 1.9.0 |
| friendAlias | String | Friend alias | 1.9.7 |
| push | Object | Push information displayed on mobile clients for messages sent from Web | 1.9.14 |
reactions:
let message = {
//... other properties
reactions: {
// :smile is the custom key used when adding the reaction
:simle: [{
key: 'key set when reacting to the message',
value: 'ID of the user who performed the reaction',
timestamp: 'reaction time in milliseconds',
// information about the user who performed the reaction
user: {
id: 'ID of the user who performed the reaction',
name: 'name of the user who performed the reaction',
portrait: 'avatar of the user who performed the reaction'
}
}],
},
push: {
title: '[All platforms] Push notification title',
text: '[All platforms] Push notification content',
jPushOptions: '[JPush] Optional push parameters as a JSON string'
}
};
| Property | Type | Description | Version |
|---|---|---|---|
| conversation | Conversation | Conversation that contains the message. | 0.0.63 |
| contentType | String | Message type, such as text or image. | 0.0.63 |
| content | MessageContent | Message content. It depends on contentType; for example, when contentType is jg:text, content is a text message. | 0.0.63 |
| messageId | String | Globally unique message identifier. | 0.0.63 |
| clientMsgNo | int | Local unique message number (the unique ID in the local database). | 0.0.63 |
| direction | int | Message direction, indicating “received message(2) or sent message(1)” | 0.0.63 |
| messageState | int | Message state, indicating “sending(1) or sent successfully(2) or failed to send(3)” | 0.0.63 |
| hasRead | bool | Whether the message has been read. | 0.0.63 |
| timestamp | int | Message send time, as a server timestamp in milliseconds. | 0.0.63 |
| senderUserId | String | Sender userId. | 0.0.63 |
| referredMsg | Message | Referenced message. | 0.0.63 |
| mentionInfo | MessageMentionInfo | Mention message content | 0.0.63 |
| localAttribute | String | Local message attributes. They apply only on this client and are not synchronized to the server. | 0.0.63 |
| groupReadInfo | GroupMessageReadInfo | Group-message read information. Applies only to group messages. | 0.0.63 |
| isEdit | bool | Whether the message was edited. | 0.0.63 |
| destroyTime | int | Message destruction timestamp in server milliseconds. The default value 0 means no automatic destruction. | 0.0.63 |
| lifeTimeAfterRead | int | Message lifetime after reading, in milliseconds. The default value 0 means no automatic destruction after reading. | 0.0.63 |
| senderDisplayName | String | Sender display name, shown according to the default display rules | 0.0.72 |
| friendAlias | String | Sender friend alias. | 0.0.72 |
| groupMemberAlias | String | Sender group-member alias. | 0.0.72 |
| sender | UserInfo? | Sender user information | 0.0.72 |
| Property | Type | Description | Version |
|---|---|---|---|
| conversation | Conversation | Conversation that contains the message. | 1.0.0 |
| contentType | string | Message type, such as text or image. | 1.0.0 |
| content | MessageContent | Message content. It depends on contentType; for example, when contentType is jg:text, content is a text message. | 1.0.0 |
| messageId | string | Globally unique message identifier. | 1.0.0 |
| clientMsgNo | number | Local unique message number (the unique ID in the local database). | 1.0.0 |
| direction | number | Message direction, indicating "received message(2) or sent message(1)" | 1.0.0 |
| messageState | number | Message state, indicating "sending(1) or sent successfully(2) or failed to send(3)" | 1.0.0 |
| hasRead | boolean | Whether the message has been read. | 1.0.0 |
| timestamp | number | Message send time, as a server timestamp in milliseconds. | 1.0.0 |
| senderUserId | string | Sender userId. | 1.0.0 |
| referredMessage | Message | Referenced message. | 1.0.0 |
| mentionInfo | MessageMentionInfo | Mention information. | 1.0.0 |
| localAttribute | string | Local message attributes. They apply only on this client and are not synchronized to the server. | 1.0.0 |
| groupMessageReadInfo | GroupMessageReadInfo | Group-message read information. Applies only to group messages. | 1.0.0 |
| isEdit | boolean | Whether the message was edited. | 1.0.0 |
| isDeleted | boolean | Whether the message was deleted. | 1.0.0 |
| destroyTime | number | Message destruction timestamp in server milliseconds. The default value 0 means no automatic destruction. | 1.0.0 |
| lifeTimeAfterRead | number | Message lifetime after reading, in milliseconds. The default value 0 means no automatic destruction after reading. | 1.0.0 |
| Property | Type | Description | Version |
|---|---|---|---|
| conversation | Conversation | Conversation that contains the message. | 1.0.0 |
| contentType | string | Message type, such as text or image. | 1.0.0 |
| content | MessageContent | Message content. It depends on the messageType property; for example, when name is jg:text, content is a text message. | 1.0.0 |
| messageId | string | Globally unique message identifier. | 1.0.0 |
| clientMsgNo | number | Local unique message number (the unique ID in the local database). | 1.0.0 |
| direction | MessageDirection | Message direction, indicating “received message or sent message” | 1.0.0 |
| messageState | MessageState | Message state, indicating “sending or sent successfully or failed to send” | 1.0.0 |
| hasRead | boolean | Whether the message has been read. | 1.0.0 |
| sentTime | number | Message send time, as a server timestamp in milliseconds. | 1.0.0 |
| senderUserId | string | Sender userId. | 1.0.0 |
| referredMessage | Message | Referenced message. | 1.0.0 |
| mentionInfo | MessageMentionInfo | Mention information. | 1.0.0 |
| localAttribute | string | Local message attributes. They apply only on this client and are not synchronized to the server. | 1.0.0 |