new Message()
Message object, used to describe the properties of a message, including the message type, content, and conversation ID
Properties:
Name | Type | Default | Description | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ID |
String |
Message ID |
|||||||||||||||||||||||||
type |
String |
Message type. Supported values are as follows:
|
|||||||||||||||||||||||||
payload |
Object |
Message content. Supported content types are as follows: |
|||||||||||||||||||||||||
conversationID |
String |
Conversation ID of the message |
|||||||||||||||||||||||||
conversationType |
String |
Conversation type of the message. Supported values are as follows:
|
|||||||||||||||||||||||||
to |
String |
Recipient's userID |
|||||||||||||||||||||||||
from |
String |
Sender's userID. In the case of message sending, this field is set to the current login user by default. |
|||||||||||||||||||||||||
flow |
String |
Message flow
|
|||||||||||||||||||||||||
time |
Number |
Message timestamp, in seconds |
|||||||||||||||||||||||||
status |
String |
Message status
|
|||||||||||||||||||||||||
isRevoked |
Boolean |
false
|
Whether the message is a recalled message. true indicates that the message is a recalled message. (supported from v2.4.0) |
||||||||||||||||||||||||
priority |
String |
TIM.TYPES.MSG_PRIORITY_NORMAL
|
Message priority, used for group chat (supported from v2.4.2) |
||||||||||||||||||||||||
nick |
String |
Nickname of the message sender (supported in AVChatRoom from v2.6.0; needs to be set by calling updateMyProfile in advance) |
|||||||||||||||||||||||||
avatar |
String |
Profile photo of the message sender (supported in AVChatRoom from v2.6.0; needs to be set by calling updateMyProfile in advance) |
|||||||||||||||||||||||||
isPeerRead |
Boolean |
false
|
Whether a C2C message is read by the peer end. true indicates that the message is read by the peer end. (supported from v2.7.0) |
||||||||||||||||||||||||
nameCard |
String |
Group name card of the message sender (supported from v2.9.0; can also be considered the group nickname of the message sender; needs to be set by calling setGroupMemberNameCard in advance) |
|||||||||||||||||||||||||
atUserList |
Array |
userIDs of @ group members in a group chat (supported from v2.9.0) |
|||||||||||||||||||||||||
cloudCustomData |
String |
Message custom data (saved in the cloud, will be sent to the peer end, and can still be pulled after the app is uninstalled and reinstalled; supported from v2.10.2) |
|||||||||||||||||||||||||
isDeleted |
Boolean |
false
|
Whether the message is a deleted message. true indicates that the message is a deleted message (supported from v2.12.0) |
||||||||||||||||||||||||
isModified |
Boolean |
false
|
Whether the message is modified by a third party. true indicates that the message is modified by a third party. (supported from v2.12.1) |
Methods
getRelayFlag() → {Boolean}
Whether to combine forward messages
Returns:
true -> Combine forward messages
- Type
- Boolean
setNameCard(nameCard)
Supplement the name card of the group message
Parameters:
Name | Type | Description |
---|---|---|
nameCard |
String |
My group name card |
Type Definitions
TextPayload
Properties:
Name | Type | Description |
---|---|---|
text |
String |
Text message content |
Payload structure of a text message
ImagePayload
- Disused:
-
- sizeType is disused from v2.8.0. Please use type instead.
Properties:
Name | Type | Description | ||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
uuid |
String |
Unique identifier of an image |
||||||||||||||||||||||||||
imageFormat |
Number |
Image format type. JPG/JPEG = 1, GIF = 2, PNG = 3, BMP = 4, other = 255 |
||||||||||||||||||||||||||
imageInfoArray |
Array.<Object> |
Image information Properties
|
Payload structure of an image message
AudioPayload
Properties:
Name | Type | Description |
---|---|---|
uuid |
String |
Unique identifier |
url |
String |
Audio address, which can be used for playback |
size |
Number |
File size, in bytes |
second |
Number |
Audio duration, in seconds |
Payload structure of an audio message
VideoPayload
Properties:
Name | Type | Description |
---|---|---|
videoFormat |
String |
Video file format |
videoSecond |
Number |
Video file duration, in seconds and of integer type |
videoSize |
Number |
Video file size, in bytes |
videoUrl |
String |
Video file address, which can be used for playback |
videoUUID |
String |
Unique identifier of a video |
thumbUUID |
String |
Unique identifier of a thumbnail image |
thumbSize |
Number |
Thumbnail image size, in bytes |
thumbWidth |
Number |
Thumbnail image width |
thumbHeight |
Number |
Thumbnail image height |
thumbUrl |
String |
Thumbnail image address, which can be used for rendering |
Payload structure of a video message
FilePayload
Properties:
Name | Type | Description |
---|---|---|
uuid |
String |
Unique identifier |
fileName |
String |
File name |
fileUrl |
String |
File address |
fileSize |
Number |
File size, in bytes |
Payload structure of a file message
CustomPayload
Properties:
Name | Type | Description |
---|---|---|
data |
String |
"data" field of a custom message |
description |
String |
"description" field of a custom message |
extension |
String |
"extension" field of a custom message |
Payload structure of a custom message
MergerPayload
Properties:
Name | Type | Description |
---|---|---|
downloadKey |
String |
Key for downloading a combined message. If a combined message is large in size, the SDK will store it on the cloud, using this key as the unique identifier of the message. |
messageList |
Array.<SimplifiedMessage> |
List of messages combined |
title |
String |
Title of the combined message, for example, "Chat Records of the Talent Center in the Greater Bay Area" |
abstractList |
String |
Digest list. You can set digest information in different formats for different message types, for example: for a text message, the digest can be in the "sender:text" format. For an image message, the digest can be in the "sender:[image]" format. For a file message, the digest can be in the "sender:[file]" format. |
compatibleText |
String |
Compatible text. SDKs of early versions do not support combined messages, and they will send a text message with the content |
layersOverLimit |
Boolean |
Whether the number of combination nesting levels exceeds the limit. true: the limit is exceeded, and the message is truncated. Default value: false |
Payload structure of a combined message
GeoPayload
Properties:
Name | Type | Description |
---|---|---|
description |
String |
Related description |
latitude |
Number |
Latitude |
longitude |
Number |
Longitude |
Payload structure of a location message
GroupTipPayload
Properties:
Name | Type | Description | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
groupJoinType |
Number |
Group joining type. Supported values are as follows:
|
||||||||||||||||||||||||
operatorID |
String |
ID of the user who performs the operation |
||||||||||||||||||||||||
operationType |
Number |
Operation type. Supported values are as follows:
|
||||||||||||||||||||||||
userIDList |
Array.<String> |
List of relevant userIDs |
||||||||||||||||||||||||
newGroupProfile |
Object |
If a group profile is modified, this field stores the new group profile. Properties
|
||||||||||||||||||||||||
memberList |
Array.<Object> |
If a group member is muted, this field stores related information. Properties
|
Payload structure of a group notification. The system sends a group notification to all group members at an appropriate time. For example, when a user leaves or joins the group, the system sends the corresponding group notification to all group members.
GroupSystemNoticePayload
Properties:
Name | Type | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
operatorID |
String |
ID of the user who performs the operation |
|||||||||||||||||||||||||||||||||||||||||||||||||||
operationType |
Number |
Operation type. Supported values are as follows:
|
|||||||||||||||||||||||||||||||||||||||||||||||||||
groupProfile |
Object |
Profile of the relevant group |
|||||||||||||||||||||||||||||||||||||||||||||||||||
userDefinedField |
String |
User-defined field. When sending a custom notification via RESTful APIs, you can get the content of the custom notification in the value of this property. |
|||||||||||||||||||||||||||||||||||||||||||||||||||
handleMessage |
Object |
Remarks on the processing. For example, if user1 enters remarks on an application to join group1 that requires approval, the admin of group1 will see this field in the group system message. |
Payload structure of a group system message. The system sends a group system message to all group members at an appropriate time. For example, when user1 is deleted from a group, the system sends the corresponding group system message to user1.