sendMessage
API when you need to send a text message.chat.createTextMessage(options);
options
parameter is of the Object
type. It contains the following attribute values:Name | Type | Default | Description |
to | String | - | userID or groupID of the message receiver |
conversationType | String | - | Conversation type. Valid values: TencentCloudChat.TYPES.CONV_C2C (one-to-one conversation)TencentCloudChat.TYPES.CONV_GROUP (group conversation) |
priority | String | TencentCloudChat.TYPES.MSG_PRIORITY_NORMAL | Message priority. If messages in a group exceed the frequency limit, the backend will deliver high-priority messages first. Supported enumerated values: TencentCloudChat.TYPES.MSG_PRIORITY_HIGH TencentCloudChat.TYPES.MSG_PRIORITY_NORMAL (default) TencentCloudChat.TYPES.MSG_PRIORITY_LOW TencentCloudChat.TYPES.MSG_PRIORITY_LOWEST |
payload | Object | - | Message content container |
cloudCustomData | String | '' | Custom message data, which is saved in the cloud, will be sent to the receiver, and can still be pulled after the application is uninstalled and reinstalled. This attribute is supported by v2.10.2 or later |
receiverList | Array | undefined | | The list of group members who can receive targeted messages (not applicable to Community group and Audio-video group) |
isSupportExtension | Boolean | false | Whether message extensions are supported: true (supported) or false (not supported) (requires you to purchase the flagship package) |
payload
is as described below:Name | Type | Description |
text | String | Message text content |
Message
// 1. Create a message instance. The returned instance can be displayed on the screen.let message = chat.createTextMessage({to: 'user1',conversationType: TencentCloudChat.TYPES.CONV_C2C,// priority: TencentCloudChat.TYPES.MSG_PRIORITY_NORMAL,payload: {text: 'Hello world!'},// To use the read receipt feature, you need to purchase the Premium edition// and set `needReadReceipt` to `true` when creating a message.needReadReceipt: true// cloudCustomData: 'your cloud custom data'});// 2. Send the message.let promise = chat.sendMessage(message);promise.then(function(imResponse) {// The message sent successfullyconsole.log(imResponse);}).catch(function(imError) {// Failed to send the messageconsole.warn('sendMessage error:', imError);});
sendMessage
API when you need to send a text message.chat.createTextAtMessage(options);
options
parameter is of the Object
type. It contains the following attribute values:Name | Type | Default | Description |
to | String | - | userID or groupID of the message receiver |
conversationType | String | - | Conversation type. Valid values: TencentCloudChat.TYPES.CONV_GROUP (group conversation) |
priority | String | TencentCloudChat.TYPES.MSG_PRIORITY_NORMAL | Message priority. If messages in a group exceed the frequency limit, the backend will deliver high-priority messages first. Supported enumerated values: TencentCloudChat.TYPES.MSG_PRIORITY_HIGH TencentCloudChat.TYPES.MSG_PRIORITY_NORMAL (default) TencentCloudChat.TYPES.MSG_PRIORITY_LOW TencentCloudChat.TYPES.MSG_PRIORITY_LOWEST |
payload | Object | - | Message content container |
cloudCustomData | String | '' | Custom message data, which is saved in the cloud, will be sent to the receiver, and can still be pulled after the application is uninstalled and reinstalled. |
payload
is as described below:Name | Type | Description |
text | String | Text content |
atUserList | Array | List of users that need to be mentioned (@). To mention (@) all, pass in TencentCloudChat.TYPES.MSG_AT_ALL . For example, to mention (@) denny and lucy as well as all members, pass in ['denny', 'lucy', TencentCloudChat.TYPES.MSG_AT_ALL ] for atUserList . |
// 1. Create a message instance. The returned instance can be displayed on the screen.let message = chat.createTextAtMessage({to: 'group1',conversationType: TencentCloudChat.TYPES.CONV_GROUP,// priority: TencentCloudChat.TYPES.MSG_PRIORITY_NORMAL,payload: {text: '@denny @lucy @all Dinner tonight. Reply 1 if you receive this message',// 'denny' and 'lucy' are `userID` values, not nicknamesatUserList: ['denny', 'lucy', TencentCloudChat.TYPES.MSG_AT_ALL]},// cloudCustomData: 'your cloud custom data'});// 2. Send the message.let promise = chat.sendMessage(message);promise.then(function(imResponse) {// The message sent successfullyconsole.log(imResponse);}).catch(function(imError) {// Failed to send the messageconsole.warn('sendMessage error:', imError);});
sendMessage
API when you need to send an image message.chat.createImageMessage(options);
options
parameter is of the Object
type. It contains the following attribute values:Name | Type | Default | Description |
to | String | - | Message receiver |
conversationType | String | - | Conversation type. Valid values: TencentCloudChat.TYPES.CONV_C2C , TencentCloudChat.TYPES.CONV_GROUP . |
priority | String | TencentCloudChat.TYPES.MSG_PRIORITY_NORMAL | Message priority. If messages in a group exceed the frequency limit, the backend will deliver high-priority messages first. Supported enumerated values: TencentCloudChat.TYPES.MSG_PRIORITY_HIGH TencentCloudChat.TYPES.MSG_PRIORITY_NORMAL (default) TencentCloudChat.TYPES.MSG_PRIORITY_LOW TencentCloudChat.TYPES.MSG_PRIORITY_LOWEST |
payload | Object | - | Message content container |
onProgress | function | - | Callback function for getting the upload progress |
cloudCustomData | String | '' | Custom message data, which is saved in the cloud, will be sent to the receiver, and can still be pulled after the application is uninstalled and reinstalled. |
payload
is as described below:Name | Type | Description |
file | HTMLInputElement | Object | It is used to select a DOM node (web) or File object (web) of the image. The SDK reads the data contained in this parameter and uploads the image. |
Message
// Sample 1: Sending an image message on web - passing in a DOM node// 1. Create a message instance. The returned instance can be displayed on the screen.let message = chat.createImageMessage({to: 'user1',conversationType: TencentCloudChat.TYPES.CONV_C2C,// priority: TencentCloudChat.TYPES.MSG_PRIORITY_NORMAL,payload: {file: document.getElementById('imagePicker'),},// cloudCustomData: 'your cloud custom data'onProgress: function(event) { console.log('file uploading:', event) }});// 2. Send the message.let promise = chat.sendMessage(message);promise.then(function(imResponse) {// The message sent successfullyconsole.log(imResponse);}).catch(function(imError) {// Failed to send the messageconsole.warn('sendMessage error:', imError);});
// Sample 2: Sending an image message on web - passing in a File object// Add a message input box with the ID set to `testPasteInput`document.getElementById('testPasteInput').addEventListener('paste', function(e) {let clipboardData = e.clipboardData;let file;let fileCopy;if (clipboardData && clipboardData.files && clipboardData.files.length > 0) {file = clipboardData.files[0];// After the image message is sent successfully// the content pointed to by `file` may be cleared by the browser.// If you have extra rendering needs, you can copy the data in advance.fileCopy = file.slice();}if (typeof file === 'undefined') {console.warn('The `file` is `undefined`. Check for the compatibility of the code or browser.');return;}// 1. Create a message instance. The returned instance can be displayed on the screen.let message = chat.createImageMessage({to: 'user1',conversationType: TencentCloudChat.TYPES.CONV_C2C,payload: {file: file},onProgress: function(event) { console.log('file uploading:', event) }});// 2. Send the message.let promise = chat.sendMessage(message);promise.then(function(imResponse) {// The message sent successfullyconsole.log(imResponse);}).catch(function(imError) {// Failed to send the messageconsole.warn('sendMessage error:', imError);});});
sendMessage
API when you need to send an audio message.chat.createAudioMessage(options);
options
parameter is of the Object
type. It contains the following attribute values:Name | Type | Default | Description |
to | String | - | Message receiver |
conversationType | String | - | Conversation type. Valid values: TencentCloudChat.TYPES.CONV_C2C TencentCloudChat.TYPES.CONV_GROUP |
priority | String | TencentCloudChat.TYPES.MSG_PRIORITY_NORMAL | Message priority. If messages in a group exceed the frequency limit, the backend will deliver high-priority messages first. Supported enumerated values: TencentCloudChat.TYPES.MSG_PRIORITY_HIGH TencentCloudChat.TYPES.MSG_PRIORITY_NORMAL (default) TencentCloudChat.TYPES.MSG_PRIORITY_LOW TencentCloudChat.TYPES.MSG_PRIORITY_LOWEST |
payload | Object | - | Message content container |
cloudCustomData | String | '' | Custom message data, which is saved in the cloud, will be sent to the receiver, and can still be pulled after the application is uninstalled and reinstalled. |
payload
is as described below:Name | Type | Description |
file | Object | File information obtained after recording |
Message
sendMessage
API when you need to send a video message.chat.createVideoMessage(options);
options
parameter is of the Object
type. It contains the following attribute values:Name | Type | Default | Description |
to | String | - | Message receiver |
conversationType | String | - | Conversation type. Valid values: TencentCloudChat.TYPES.CONV_C2C TencentCloudChat.TYPES.CONV_GROUP |
priority | String | TencentCloudChat.TYPES.MSG_PRIORITY_NORMAL | Message priority. If messages in a group exceed the frequency limit, the backend will deliver high-priority messages first. Supported enumerated values: TencentCloudChat.TYPES.MSG_PRIORITY_HIGH TencentCloudChat.TYPES.MSG_PRIORITY_NORMAL (default) TencentCloudChat.TYPES.MSG_PRIORITY_LOW TencentCloudChat.TYPES.MSG_PRIORITY_LOWEST |
payload | Object | - | Message content container |
cloudCustomData | String | '' | Custom message data, which is saved in the cloud, will be sent to the receiver, and can still be pulled after the application is uninstalled and reinstalled. |
payload
is as described below:Name | Type | Description |
file | HTMLInputElement | File | Object | Data field of the custom message |
Message
// Sample: Sending a video message on web// 1. Get the video file by passing in the DOM node.// 2. Create a message instance.const message = chat.createVideoMessage({to: 'user1',conversationType: TencentCloudChat.TYPES.CONV_C2C,payload: {file: document.getElementById('videoPicker') // Alternatively, use `event.target`},onProgress: function(event) { console.log('file uploading:', event) }});// 3. Send the message.let promise = chat.sendMessage(message);promise.then(function(imResponse) {// The message sent successfullyconsole.log(imResponse);}).catch(function(imError) {// Failed to send the messageconsole.warn('sendMessage error:', imError);});
sendMessage
API when you need to send a custom message. When the current SDK capabilities cannot meet your needs, you can customize messages.chat.createCustomMessage(options);
options
parameter is of the Object
type. It contains the following attribute values:Name | Type | Default | Description |
to | String | - | userID or groupID of the message receiver |
conversationType | String | - | Conversation type. Valid values: TencentCloudChat.TYPES.CONV_C2C (one-to-one conversation)TencentCloudChat.TYPES.CONV_GROUP (group conversation) |
priority | String | TencentCloudChat.TYPES.MSG_PRIORITY_NORMAL | Message priority. If messages in a group exceed the frequency limit, the backend will deliver high-priority messages first. Supported enumerated values: TencentCloudChat.TYPES.MSG_PRIORITY_HIGH TencentCloudChat.TYPES.MSG_PRIORITY_NORMAL (default) TencentCloudChat.TYPES.MSG_PRIORITY_LOW TencentCloudChat.TYPES.MSG_PRIORITY_LOWEST |
payload | Object | - | Message content container |
cloudCustomData | String | '' | Custom message data, which is saved in the cloud, will be sent to the receiver, and can still be pulled after the application is uninstalled and reinstalled. |
payload
is as described below:Name | Type | Description |
data | String | Data of the custom message |
description | String | Description of the custom message |
extension | String | Extension of the custom message |
Message
// Sample: Using a custom message to implement dice rolling// 1. Define the random function.function random(min, max) {return Math.floor(Math.random() * (max - min + 1) + min);}// 2. Create a message instance. The returned instance can be displayed on the screen.let message = chat.createCustomMessage({to: 'user1',conversationType: TencentCloudChat.TYPES.CONV_C2C,payload: {data: 'dice', // Used to identify the message as a dice messagedescription: String(random(1,6)), // Get the outcomeextension: ''}});// 3. Send the message.let promise = chat.sendMessage(message);promise.then(function(imResponse) {// The message sent successfullyconsole.log(imResponse);}).catch(function(imError) {// Failed to send the messageconsole.warn('sendMessage error:', imError);});
sendMessage
API when you need to send an emoji message.chat.createFaceMessage(options);
options
parameter is of the Object
type. It contains the following attribute values:Name | Type | Default | Description |
to | String | - | userID or groupID of the message receiver |
conversationType | String | - | Conversation type. Valid values: TencentCloudChat.TYPES.CONV_C2C (one-to-one conversation)TencentCloudChat.TYPES.CONV_GROUP (group conversation) |
priority | String | TencentCloudChat.TYPES.MSG_PRIORITY_NORMAL | Message priority. If messages in a group exceed the frequency limit, the backend will deliver high-priority messages first. Supported enumerated values: TencentCloudChat.TYPES.MSG_PRIORITY_HIGH TencentCloudChat.TYPES.MSG_PRIORITY_NORMAL (default) TencentCloudChat.TYPES.MSG_PRIORITY_LOW TencentCloudChat.TYPES.MSG_PRIORITY_LOWEST |
payload | Object | - | Message content container |
cloudCustomData | String | '' | Custom message data, which is saved in the cloud, will be sent to the receiver, and can still be pulled after the application is uninstalled and reinstalled. |
payload
is as described below:Name | Type | Description |
index | Number | Emoji index, which is customized by the user |
data | String | Extra data |
Message
// Send an emoji message on web// 1. Create a message instance. The returned instance can be displayed on the screen.let message = chat.createFaceMessage({to: 'user1',conversationType: TencentCloudChat.TYPES.CONV_C2C,payload: {index: 1, // Number. Emoji index, which is customized by the userdata: 'tt00' // String. Extra data},// cloudCustomData: 'your cloud custom data'});// 2. Send the message.let promise = chat.sendMessage(message);promise.then(function(imResponse) {// The message sent successfullyconsole.log(imResponse);}).catch(function(imError) {// Failed to send the messageconsole.warn('sendMessage error:', imError);});
sendMessage
API when you need to send a file message.chat.createFileMessage(options);
options
parameter is of the Object
type. It contains the following attribute values:Name | Type | Default | Description |
to | String | - | userID or groupID of the message receiver |
conversationType | String | - | Conversation type. Valid values: TencentCloudChat.TYPES.CONV_C2C (client to client conversation)TencentCloudChat.TYPES.CONV_GROUP (group conversation) |
priority | String | TencentCloudChat.TYPES.MSG_PRIORITY_NORMAL | Message priority. If messages in a group exceed the frequency limit, the backend will deliver high-priority messages first. Supported enumerated values: TencentCloudChat.TYPES.MSG_PRIORITY_HIGH TencentCloudChat.TYPES.MSG_PRIORITY_NORMAL (default) TencentCloudChat.TYPES.MSG_PRIORITY_LOW TencentCloudChat.TYPES.MSG_PRIORITY_LOWEST |
payload | Object | - | Message content container |
onProgress | function | - | Callback function for getting the upload progress |
cloudCustomData | String | '' | Custom message data, which is saved in the cloud, will be sent to the receiver, and can still be pulled after the application is uninstalled and reinstalled. |
payload
is as described below:Name | Type | Description |
file | HTMLInputElement | File | Object | It is used to select a DOM node or File object of the file on web, or the success callback parameter of the uni.chooseFile API. The SDK reads the data contained in this parameter and uploads the file. |
// Sample 1: Sending a file message on web - passing in a DOM node// 1. Create a file message instance. The returned instance can be displayed on the screen.let message = chat.createFileMessage({to: 'user1',conversationType: TencentCloudChat.TYPES.CONV_C2C,payload: {file: document.getElementById('filePicker'),},// cloudCustomData: 'your cloud custom data'onProgress: function(event) { console.log('file uploading:', event) }});// 2. Send the message.let promise = chat.sendMessage(message);promise.then(function(imResponse) {// The message sent successfullyconsole.log(imResponse);}).catch(function(imError) {// Failed to send the messageconsole.warn('sendMessage error:', imError);});
// Sample 2: Sending a file message on web - passing in a File object// Add a message input box with the ID set to `testPasteInput`,let clipboardData = e.clipboardData;let file;let fileCopy;if (clipboardData && clipboardData.files && clipboardData.files.length > 0) {file = clipboardData.files[0];// After the image message is sent successfully// the content pointed to by `file` may be cleared by the browser.// If you have extra rendering needs, you can copy the data in advance.fileCopy = file.slice();}if (typeof file === 'undefined') {console.warn('The `file` is `undefined`. Check for the compatibility of the code or browser.');return;}// 1. Create a message instance. The returned instance can be displayed on the screen.let message = chat.createFileMessage({to: 'user1',conversationType: TencentCloudChat.TYPES.CONV_C2C,payload: {file: file},onProgress: function(event) { console.log('file uploading:', event) }});// 2. Send the message.let promise = chat.sendMessage(message);promise.then(function(imResponse) {// The message sent successfullyconsole.log(imResponse);}).catch(function(imError) {// Failed to send the messageconsole.warn('sendMessage error:', imError);});});
sendMessage
API when you need to send a geographical location message.chat.createLocationMessage(options);
options
parameter is of the Object
type. It contains the following attribute values:Name | Type | Default | Description |
to | String | - | userID or groupID of the message receiver |
conversationType | String | - | Conversation type. Valid values: TencentCloudChat.TYPES.CONV_C2C (one-to-one conversation)TencentCloudChat.TYPES.CONV_GROUP (group conversation) |
priority | String | TencentCloudChat.TYPES.MSG_PRIORITY_NORMAL | Message priority. If messages in a group exceed the frequency limit, the backend will deliver high-priority messages first. Supported enumerated values: TencentCloudChat.TYPES.MSG_PRIORITY_HIGH TencentCloudChat.TYPES.MSG_PRIORITY_NORMAL (default) TencentCloudChat.TYPES.MSG_PRIORITY_LOW TencentCloudChat.TYPES.MSG_PRIORITY_LOWEST |
payload | Object | - | Message content container |
cloudCustomData | String | '' | Custom message data, which is saved in the cloud, will be sent to the receiver, and can still be pulled after the application is uninstalled and reinstalled. |
payload
is as described below:Name | Type | Description |
description | String | Description of the geographical location |
longitude | Number | Longitude |
latitude | Number | Latitude |
Message
// Send a geographical location message on web// 1. Create a message instance. The returned instance can be displayed on the screen.let message = chat.createLocationMessage({to: 'user1',conversationType: TencentCloudChat.TYPES.CONV_C2C,payload: {description: 'Tencent Building, No. 10000, Shennan Boulevard, Shenzhen',longitude: 113.941079, // Longitudelatitude: 22.546103 // Latitude}});// 2. Send the message.let promise = chat.sendMessage(message);promise.then(function(imResponse) {// The message sent successfullyconsole.log(imResponse);}).catch(function(imError) {// Failed to send the messageconsole.warn('sendMessage error:', imError);});
sendMessage
API when you need to send a merged message.chat.createMergerMessage(options);
options
parameter is of the Object
type. It contains the following attribute values:Name | Type | Default | Description |
to | String | - | userID or groupID of the message receiver |
conversationType | String | - | Conversation type. Valid values: TencentCloudChat.TYPES.CONV_C2C (one-to-one conversation)TencentCloudChat.TYPES.CONV_GROUP (group conversation) |
priority | String | TencentCloudChat.TYPES.MSG_PRIORITY_NORMAL | Message priority. If messages in a group exceed the frequency limit, the backend will deliver high-priority messages first. Supported enumerated values: TencentCloudChat.TYPES.MSG_PRIORITY_HIGH TencentCloudChat.TYPES.MSG_PRIORITY_NORMAL (default) TencentCloudChat.TYPES.MSG_PRIORITY_LOW TencentCloudChat.TYPES.MSG_PRIORITY_LOWEST |
payload | Object | - | Message content container |
cloudCustomData | String | '' | Custom message data, which is saved in the cloud, will be sent to the receiver, and can still be pulled after the application is uninstalled and reinstalled. |
payload
is as described below:Name | Type | Description |
messageList | Array | Merged message list |
title | String | Title of merged messages, for example, "Chat History of the Talent Center in the Greater Bay Area" |
abstractList | String | Abstract list. You can set abstract information in different formats for different message types, for example, in the sender:text format for a text message, in the sender:[image] format for an image message, or in the sender:[file] format for a file message. |
compatibleText | String | Compatibility text. If the SDK on an early version does not support the merged message, the user will receive a text message with the content ${compatibleText} by default. This field is required. |
Message
// 1. Forward group messages to a one-to-one conversation.// `message1`, `message2`, and `message3` are group messages.let mergerMessage = chat.createMergerMessage({to: 'user1',conversationType: TencentCloudChat.TYPES.CONV_C2C,payload: {messageList: [message1, message2, message3],title: 'Chat History of the Talent Center in the Greater Bay Area',abstractList: ['allen: 666', 'iris: [Image]', 'linda: [File]'],compatibleText: 'Upgrade your Chat SDK to v2.10.1 or later to view this message.'},// cloudCustomData: 'your cloud custom data'});// 2. Send the message.let promise = chat.sendMessage(mergerMessage);promise.then(function(imResponse) {// The message sent successfullyconsole.log(imResponse);}).catch(function(imError) {// Failed to send the messageconsole.warn('sendMessage error:', imError);});
chat.downloadMergerMessage(message);
Name | Type | Description |
message | Message | Message instance |
Promise
// If `downloadKey` exists, the received merged message is stored in the cloud// and needs to be downloaded first.if (message.type === TencentCloudChat.TYPES.MSG_MERGER && message.payload.downloadKey !== '') {let promise = chat.downloadMergerMessage(message);promise.then(function(imResponse) {// After the download is successful// the SDK will update information such as `message.payload.messageList`.console.log(imResponse.data);}).catch(function(imError) {// Download failedconsole.warn('downloadMergerMessage error:', imError);});}
createForwardMessage
API first, and then call the sendMessage
API to send the message.chat.createForwardMessage(message);
Name | Type | Description |
message | Message | Message instance |
let forwardMessage = chat.createForwardMessage({to: 'user1',conversationType: TencentCloudChat.TYPES.CONV_C2C,payload: message, // The received or sent message instance});// 2. Send the message.let promise = chat.sendMessage(forwardMessage);promise.then(function(imResponse) {// The message sent successfullyconsole.log(imResponse);}).catch(function(imError) {// Failed to send the messageconsole.warn('sendMessage error:', imError);});
createTextMessage
createTextAtMessage
createImageMessage
createAudioMessage
createVideoMessage
createCustomMessage
createFaceMessage
createFileMessage
createLocationMessage
createMergerMessage
createForwardMessage
ready
status; otherwise, the message instance cannot be sent. The SDK status can be obtained by listening for the TencentCloudChat.EVENT.SDK_READY
event, which will be triggered when the SDK is in the ready
status.TencentCloudChat.EVENT.MESSAGE_RECEIVED
event must be listened for in order to receive newly pushed one-to-one messages, group messages, group tips, or group system notifications.TencentCloudChat.EVENT.MESSAGE_RECEIVED
event. Messages sent by the same account from another client (or through the RESTful API) will trigger the TencentCloudChat.EVENT.MESSAGE_RECEIVED
event.onlineUserOnly
and messageControlInfo
cannot be used together.chat.sendMessage(message, options);
Name | Type | Description |
message | Message | Message instance |
options | Object | Message sending option (message content container), which is optional |
options
is as described below:Name | Type | Description |
onlineUserOnly | Boolean | It specifies whether the message is sent only to online users and defaults to false . If it is set to true , the message will not be stored on the roaming server, nor counted as an unread message, nor pushed to the receiver offline. It is suitable for sending unimportant tips such as broadcast notifications. This parameter is not supported when a message is sent in an audio-video group (AVChatRoom). |
offlinePushInfo | Object | |
messageControlInfo | Object | It is a message control configuration item. |
offlinePushInfo
is as described below:Name | Type | Description |
disablePush | Boolean | true : offline push is disabled; false (default): offline push is enabled. |
title | String | Offline push title. This parameter is used by both iOS and Android. |
description | String | Offline push content. This parameter will overwrite the offline push display text of the message instance. If the sent message is a custom message, this parameter will overwrite message.payload.description . If both description and message.payload.description are left empty, the receiver cannot receive the offline push notification of the custom message. |
extension | String | Content passed through by offline push |
ignoreIOSBadge | Boolean | Specifies whether the badge count is ignored (applicable to iOS only). If this parameter is set to true , the unread message count on the application badge will not increase when the message is received by the iOS device. |
androidOPPOChannelID | String | Offline push channel ID for OPPO phones that run Android v8.0 or later |
messageControlInfo
is as described below:Name | Type | Description |
excludedFromUnreadCount | Boolean | true : unreadCount of the conversation is not updated (the message is stored on the roaming server); false (default) |
excludedFromLastMessage | Boolean | true : lastMessage of the conversation is not updated (the message is stored on the roaming server); false (default) |
excludedFromContentModeration | Boolean | true : the message is excluded from content moderation. You need to purchase the Premium edition. |
Promise
// If the receiver is offline, the message will be stored on the roaming server// and pushed offline on the precondition that the receiver's application switches to the background// or the process is killed.// The default title and content of offline push are kept.chat.sendMessage(message);
chat.sendMessage(message, {// If the receiver is offline, the message will be neither stored on the roaming server// nor pushed offline.onlineUserOnly: true});
chat.sendMessage(message, {offlinePushInfo: {// If the receiver is offline, the message will be stored on the roaming server// but will not be pushed offline.disablePush: true}});
chat.sendMessage(message, {// If the receiver is offline, the message will be stored on the roaming server// and pushed offline on the precondition that the receiver's application switches to the background// or the process is killed.// The title and content of offline push can be customized at the access side.offlinePushInfo: {title: '', // Offline push titledescription: '', // Offline push content// Offline push channel ID for OPPO phones that run Android v8.0 or later for offline pushandroidOPPOChannelID: ''}});
chat.sendMessage(message, {messageControlInfo: {// `unreadCount` of the conversation is not updated (the message is stored on the roaming server).excludedFromUnreadCount: true,// `lastMessage` of the conversation is not updated (the message is stored on the roaming server).excludedFromLastMessage: true}});
chat.sendMessage(message, {messageControlInfo: {excludedFromContentModeration: true,}});
Feature | Limit Item | Description |
One-to-one/group message | Content length | A one-to-one or group message must be no longer than 12 KB. |
| Sending frequency | One-to-one message: No limit for sending one-to-one messages on the client; sending through the RESTful API is subject to the frequency limit. See the corresponding API documentation.
Group message: Up to 40 messages can be sent per second per group (regardless of the group type and platform interface, and this limit applies to each group separately). |
| Receiving frequency | No limit for one-to-one messages or group messages. |
| Size of a single file | SDKs support a maximum file size of 100 MB for any single file to be sent. |
Was this page helpful?