Constructs a message.
Optionalattributes?: anyOptionalchatOptionalconversationOptionaldeliverOptionaldirection?: stringOptionalfrom?: stringOptionalgroupOptionalhasOptionalhasOptionalhasOptionalisOptionalisOptionalisOptionalisOptionallocalOptionallocalOptionalmsgOptionalneedOptionalreceiverOptionalserverOptionalstatus?: numberOptionalto?: stringThe extension attribute of the message.
Value can be an object, string, string json, numerical value, undefined, null, etc.
Note Symbol and function types are not supported.
The message body. See ChatMessageBody.
The conversation type. See ChatType.
The conversation ID.
Whether the message is delivered only when the recipient(s) is/are online:
true:The message is delivered only when the recipient(s) is/are online. If the recipient is offline, the message is discarded.false:The message is delivered when the recipient(s) is/are online. If the recipient(s) is/are offline, the message will not be delivered to them until they get online.The message direction. See ChatMessageDirection.
The user ID of the message sender.
The number of group members that have read a message. Upon reading a message, members in the group call ChatManager.sendGroupMessageReadAck or ChatManager.sendConversationReadAck to send a read receipt for a message or a conversation. To enable the read receipt function for group messages, you need to set ChatOptions.requireAck to true during SDK initialization and set isNeedGroupAck to true when sending a message.
Whether messages have arrived at the recipient during a one-to-one chat. If delivery receipts are required, recipient need to set ChatOptions.requireDeliveryAck to true during the SDK initialization. Delivery receipts are unavailable for group messages.
true: Yes.false: No.Whether the the message is read by the recipient during a one-to-one chat or group chat. This parameter setting has connection with the number of unread messages in a conversation. Upon reading the message, the recipient calls ChatManager.markMessageAsRead to mark a message read or ChatManager.markAllMessagesAsRead to mark all unread messages in the conversation read.
true: Yes.false: No.Whether the the read receipt from the recipient is received by the sender during a one-to-one chat. Upon reading the message, the recipient calls the ChatManager.sendMessageReadAck or {@link ChatManager.sendConversationReadAck} method to send a read receipt to the sender. If read receipts are required, you need to set ChatOptions.requireAck to true during the SDK initialization.
true: Yes.false: No.Whether it is a global broadcast message.
Whether it is a message in a message thread.
true: Yes. In this case, you need to set the user ID of the message recipient to the message thread ID. See to.false: No.Note
This parameter is valid only for group chat.
Whether the message content is replaced.
It is valid after ChatOptions.useReplacedMessageContents is enabled.
Whether it is a online message.
true: Yes. In this case, if the application is running in the background, a notification window may pop up.false: No.The local message ID.
The Unix timestamp when the message is created locally. The unit is millisecond.
The message ID generated on the server.
Whether read receipts are required for a group message.
true: Yes.false: No.OptionalreceiverThe recipient list of a targeted message.
The default value is undefined, indicating that the message is sent to all members in the group or chat room.
This property is used only for messages in groups and chat rooms.
The Unix timestamp when the server receives the message. The unit is millisecond.
The message sending status. See ChatMessageStatus.
The user ID of the message recipient:
StaticTAGGet the list of pinned messages in the conversation.
Gets the count of read receipts of a group message.
Set the chat room message priority.
Gets the list of Reactions.
Gets details of a message thread.
StaticcreateCreates a command message for sending.
The user ID of the message recipient.
The command action.
The conversation type. See ChatType.
Optionalopt: { OptionaldeliverOptionalisOptionalisOptionalreceiverThe message instance.
opt The extension parameters of the message.
true: Yes.false: No.true: Yes.false: No. The command message is delivered to users, regardless of their online or offline status.StaticcreateCreates a combined message for sending.
The message recipient. The field setting is determined by the conversation type:
A collection of message IDs. The list cannot be empty. It can contain a maximum of 300 message IDs.
The conversation type. See ChatType.
Optionalopt: { OptionalcompatibleOptionaldeliverOptionalisOptionalisOptionalreceiverOptionalsummary?: stringOptionaltitle?: stringThe message instance.
opt The extension parameters of the message.
true: Yes.false:No.true: Yes.false:No.true: - true:The message is delivered only when the recipient(s) is/are online. If the recipient is offline, the message is discarded.false:The message is delivered when the recipient(s) is/are online. If the recipient(s) is/are offline, the message will not be delivered to them until they get online.StaticcreateCreates a custom message for sending.
The user ID of the message recipient.
The custom event.
The conversation type. See ChatType.
Optionalopt: { OptionaldeliverOptionalisOptionalisOptionalreceiverThe message instance.
StaticcreateCreates a message with a file attachment for sending.
The user ID of the message recipient.
The file path.
The conversation type. See ChatType.
Optionalopt: { OptionaldeliverOptionalfileOptionalisOptionalisOptionalreceiverThe message instance.
opt The extension parameters of the message.
true: Yes.false: No.StaticcreateCreates an image message for sending.
The user ID of the message recipient.
The image path.
The conversation type. See ChatType.
Optionalopt: { OptionaldeliverOptionalfileOptionalisOptionalisOptionalreceiverOptionalsendOptionalthumbnailThe message instance.
opt The extension parameters of the message.
true: Yes.false: If the image is equal to or greater than 100 KB, the SDK will compress it before sending the compressed image.true: Yes.false: No.StaticcreateCreates a location message for sending.
The user ID of the message recipient.
The latitude.
The longitude.
The conversation type. See ChatType.
Optionalopt: { OptionaldeliverOptionalisOptionalisOptionalreceiverThe message instance.
StaticcreateCreates a received message instance.
The received message.
The message object.
StaticcreateOptionaldeliverOptionalisOptionalisOptionalreceiverStaticcreateCreates a text message for sending.
The user ID of the message recipient.
The text content.
The conversation type. See ChatType.
Optionalopt: { OptionaldeliverOptionalisOptionalisOptionalreceiverOptionaltargetThe message instance.
opt The extension parameters of the message.
true: Yes.false: No.StaticcreateCreates a video message for sending.
The user ID of the message recipient.
The path of the video file.
The conversation type. See ChatType.
Optionalopt: { OptionaldeliverOptionalfileOptionalisOptionalisOptionalreceiverThe message instance.
opt The extension parameters of the message.
true: Yes.false: No.StaticcreateCreates a voice message for sending.
The user ID of the message recipient.
The path of the voice file.
The conversation type. See ChatType.
Optionalopt: { OptionaldeliverOptionaldisplayOptionalfileOptionalisOptionalisOptionalreceiverThe message instance.
opt The extension parameters of the message.
true: Yes.false: No.
The message class that defines a message that is to be sent or received.
For example, construct a text message to send: