Sends a ChatApp message.
Operation description
-
Call this operation to send messages. You can also send messages manually in the console at Channel Management > Manage > Message Sending.
-
Before calling this operation, you must create a channel and have an approved template.
-
For a WhatsApp channel, you must register and bind a WABA and add a phone number.
-
For a Messenger channel, you must connect to a Facebook Page.
-
For an Instagram channel, you must connect to an Instagram professional account.
QPS limit
The QPS limit for this operation is 250 per user. API calls that exceed this limit are throttled. To prevent service disruptions, ensure your calls stay within this limit.
Status changes
You can receive notifications about message status changes by using MNS or HTTP callbacks. For more information, see message receipts.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
cams:SendChatappMessage |
create |
*All Resource
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| ChannelType |
string |
Yes |
The channel type. Valid values:
|
|
| Type |
string |
Yes |
The message type. Valid values:
Important If you set Type to template, you must set the TemplateCode parameter. If you set Type to message, you must set the MessageType parameter. |
message |
| MessageType |
string |
No |
The message type to use when |
text |
| TemplateCode |
string |
No |
The message template code. You can find the code on the Channel Management > Manage > Template Design page. |
1119*************** |
| Language |
string |
No |
The language of the message template. For a list of supported languages and their corresponding codes, see language code. |
en |
| From |
string |
Yes |
The sender's number or ID.
|
861387777**** |
| To |
string |
Yes |
The recipient's number or ID.
|
861388988**** |
| TemplateParams |
object |
No |
The parameters for the message template. |
|
|
string |
No |
A key-value pair for a template parameter. The key is the parameter's name and the value is its corresponding value. |
{ "param1": "value1", "param2": "value2" } |
|
| Content |
string |
No |
The message content, in a JSON-formatted string. Notes for WhatsApp messages:
Notes for Messenger messages:
Notes for Instagram messages:
|
{ "text": "hello,whatsapp", "link": "https://*******", "caption": "****", "fileName": "****" } |
| Payload |
array |
No |
An array of custom data strings that are sent to your webhook when a user clicks a corresponding button. |
payloadtext1,payloadtext2,payloadtext3 |
|
string |
No |
The payload for a button in the message template. |
payloadtext |
|
CustWabaId
deprecated
|
string |
No |
Deprecated. Use |
cams-8c8********* |
| FallBackId |
string |
No |
The ID of the fallback strategy. This parameter is available only on the International Site and can be ignored if you are using the China site. |
S0**** |
| FallBackContent |
string |
No |
The custom content of the fallback message. This parameter is available only on the International Site and can be ignored if you are using the China site. |
Fallback SMS |
IsvCode
deprecated
|
string |
No |
Deprecated. A verification code used to authorize an ISV's sub-account. You can ignore this parameter. |
123123****** |
| CustSpaceId |
string |
No |
The Space ID of the ISV's sub-account. For a direct customer, this is the Instance ID. You can find the ID on the Channel Management page. |
cams-8c8********* |
| ContextMessageId |
string |
No |
The ID of the message to which you are replying. |
61851ccb2f1365b16aee**** |
| TrackingData |
string |
No |
Custom tracking data for a Viber message. This parameter is available only on the International Site and can be ignored if you are using the China site. |
Tracking Data |
| Label |
string |
No |
The Viber message type. This parameter is available only on the International Site and can be ignored if you are using the China site. |
promotion |
| Ttl |
integer |
No |
The time-to-live (TTL) for a Viber message. This parameter is available only on the International Site and can be ignored if you are using the China site. |
50 |
| Tag |
string |
No |
A custom tag for the Viber message. |
tag |
| TaskId |
string |
No |
A custom task ID. |
10000**** |
| FallBackDuration |
integer |
No |
The duration after which a fallback is triggered. This parameter is available only on the International Site and can be ignored if you are using the China site. |
120 |
| ProductAction |
object |
No |
Product information that you have uploaded to Meta. This parameter applies to WhatsApp channels only. |
|
| ThumbnailProductRetailerId |
string |
No |
The product catalog ID. You can get this ID by calling the ListProductCatalog operation. |
skkks99**** |
| Sections |
array<object> |
No |
A list of product categories. You can specify up to 10 categories and a total of 30 products. |
|
|
array<object> |
No |
A product category. |
||
| Title |
string |
No |
The category name. You can find the name on the Channel Management > Manage > Catalog Management > Product Management page, or obtain it by calling the ListProduct operation. |
abcd |
| ProductItems |
array<object> |
No |
A list of product information. |
|
|
object |
No |
The product information. |
||
| ProductRetailerId |
string |
No |
The product ID. You can find the ID on the Channel Management > Manage > Catalog Management > Product Management page, or obtain it by calling the ListProduct operation. |
ksi3**** |
| FallBackRule |
string |
No |
The fallback rule. This parameter is available only on the International Site and can be ignored if you are using the China site. |
undelivered |
| FlowAction |
object |
No |
The Flow message object. |
|
| FlowActionData |
object |
No |
A collection of default flow parameters. |
|
|
any |
No |
A default flow parameter in key-value format. The key is the parameter name, and the value is the parameter value. |
{ "name": "name" } |
|
| FlowToken |
string |
No |
The custom flow token. |
kde**** |
| TemplateName |
string |
No |
The template name. You can find the template name on the Channel Management > Manage > Template Design page. |
test_name |
| RecipientType |
string |
No |
The recipient type. Valid values:
|
individual |
| MessageCampaignId |
string |
No |
The ID of the message campaign. Note
This parameter is for internal testing, is not generally available, and can be ignored. |
123123******** |
| AdAccountId |
string |
No |
The Meta ad account ID. Note
This parameter is for internal testing, is not generally available, and can be ignored. |
123123******** |
| TokenType |
string |
No |
The token type. Note
This parameter is for internal testing, is not generally available, and can be ignored. |
bearer |
| Category |
string |
No |
The message category for direct WhatsApp sending. Warning Specify this parameter only if you are a Meta-invited customer. Otherwise, the message may fail to send. |
UTILITY |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
The response data. |
||
| AccessDeniedDetail |
string |
Details about the access denial. |
None |
| RequestId |
string |
The ID of the request. |
90E63D28-E31D-1EB2-8939-A94866****** |
| Message |
string |
The error message. |
User not authorized to operate on the specified resource. |
| Code |
string |
The status code of the request.
|
OK |
| MessageId |
string |
The ID of the message. |
61851ccb2f1365b16aee**** |
Examples
Success response
JSON format
{
"AccessDeniedDetail": "None",
"RequestId": "90E63D28-E31D-1EB2-8939-A94866******",
"Message": "User not authorized to operate on the specified resource.",
"Code": "OK",
"MessageId": "61851ccb2f1365b16aee****"
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | Product.Unsubscript | You have not subscribed to the specified product. | You have not subscribed to the specified product. |
| 400 | Ram.PermissionDeny | You are not authorized to perform the operation. | |
| 400 | System.LimitControl | The system is under flow control. | The system is under flow control. |
| 400 | Unknown.ResourceOwnerId | The resource does not belong to the current user. | The resource does not belong to the current user. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.