Creates a WhatsApp message template for marketing, utility, or authentication use cases.
Description
QPS limit
This operation supports up to 50 calls per second per account. Exceeding this limit causes dropped requests and service interruptions.
Debugging
OpenAPI Explorer automatically calculates signatures and generates SDK sample code for this operation.
Authorization
The following table lists authorization details for this API. Use these values in the Action policy element to grant RAM users or roles access to this operation.
-
Operation: the value used in the Action element to specify the operation on a resource.
-
Access level: read, write, or list.
-
Resource type: the resource on which you authorize RAM users or roles to perform the operation.
-
Required resource types are highlighted.
-
If resource-level permissions are unavailable, the Resource type column shows "All resources".
-
Condition key: condition keys defined by the cloud service.
-
Associated operation: additional operations the RAM user or role must have permission to perform.
|
Operation |
Access level |
Resource type |
Condition key |
Associated operation |
|
cams:CreateChatappTemplate |
Write |
|
None |
None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
|
Category |
String |
Yes |
The category of the message template. Valid values:
|
UTILITY |
|
Components |
Object |
Yes |
The components of the message template. Note
When Category is set to AUTHENTICATION, Components cannot be set to HEADER. When Type is set to BODY or FOOTER, the text content must be empty. |
- |
|
Type |
String |
Yes |
The component type. Valid values:
Note
In a WhatsApp message template, a BODY component cannot exceed 1,024 characters in length. A HEADER or FOOTER component cannot exceed 60 characters in length. |
BODY |
|
Text |
String |
No |
The text of the message that you want to send. Note
If Category is set to AUTHENTICATION, this parameter must be empty. |
hello |
|
Format |
String |
No |
The type of the media resource. Valid values:
|
TEXT |
|
Url |
String |
No |
The URL of the media resource. Note
Media resources must meet size requirements. Supported types and limits are documented in Parameters of a message template. |
https://image.developer.aliyundoc.com |
|
Caption |
String |
No |
The description of the document. |
This is a video. |
|
FileName |
String |
No |
The name of the document. |
Package video |
|
Buttons |
Object |
No |
The buttons. Valid only when Type is BUTTONS. Note
Limits on the number of buttons in a WhatsApp message template
|
|
|
Type |
String |
Yes |
The button type. Valid values:
Note
If you set Category to AUTHENTICATION for a WhatsApp message template, only one button is allowed and the type of the button must be COPY_CODE or ONE_TAP. If you set Category to COPY_CODE, Text is required. If you set Type to ONE_TAP, Text is required, as well as SignatureHash, PackageName, and AutofillText. The value of Text is displayed if the desired app is not installed on the device. The value of Text indicates that you must manually copy the verification code. |
PHONE_NUMBER |
|
Text |
String |
No |
The display name of the button. |
Call Me |
|
PhoneNumber |
String |
No |
The phone number. This parameter is valid only if the button type is PHONE_NUMBER. |
+861368897**** |
|
Url |
String |
No |
The URL to be accessed when the URL button is tapped. |
https://example.com |
|
UrlType |
String |
No |
The URL type. Valid values:
|
static |
|
SignatureHash |
String |
No |
The app signing key hash for loading your app. Required when Category is AUTHENTICATION and Type is ONE_TAP. |
wi299382 |
|
PackageName |
String |
No |
The app package name for loading your app. Required when Category is AUTHENTICATION and Type is ONE_TAP. |
com.demo |
|
AutofillText |
String |
No |
The Auto-fill button text. Required when Category is AUTHENTICATION and Type is ONE_TAP. |
Autofill |
|
IsOptOut |
Boolean |
No |
The Unsubscribe button. Valid when Category is MARKETING and button type is QUICK_REPLY. If message sending control is enabled in the console, customers who tap this button stop receiving marketing messages. |
false |
|
CouponCode |
String |
No |
The promo code. It can contain only letters and digits. You can set this parameter to a variable such as $(couponCode). Specify the value of couponCode when you send a message. |
120293 |
|
FlowId |
String |
No |
The Flow ID. |
479884093605183 |
|
FlowAction |
String |
No |
The Flow action. Valid values:
|
NAVIGATE |
|
NavigateScreen |
String |
No |
The destination screen. This parameter is required if FlowAction is set to NAVIGATE. |
DETAILS |
|
CodeExpirationMinutes |
Integer |
No |
The verification code validity period, in minutes. Valid when Category is AUTHENTICATION and Type is FOOTER. Displayed in the template footer. |
5 |
|
AddSecretRecommendation |
Boolean |
No |
Whether to display a note advising customers not to share verification codes. Valid when Category is AUTHENTICATION and Type is BODY. |
true |
|
HasExpiration |
Boolean |
No |
Specifies whether the promo code has an expiration time. Specify this parameter if Type is set to LIMITED_TIME_OFFER. |
true |
|
Cards |
Object |
No |
The carousel cards of the carousel template. |
|
|
CardComponents |
Object |
Yes |
The components of the carousel card. |
|
|
Type |
String |
Yes |
The component type. Valid values:
|
BODY |
|
Format |
String |
No |
The type of the media resource. This parameter is valid if Type is set to HEADER. Valid values:
|
IMAGE |
|
Text |
String |
No |
The body content of the carousel card. |
Who is the very powerful team |
|
Url |
String |
No |
The URL of the media resource. |
https://alibaba.com/img.png |
|
Buttons |
Object |
No |
The buttons. Valid only when Type is BUTTONS. Maximum: 2 buttons per card. |
|
|
Text |
String |
No |
The button text. |
Call me |
|
Type |
String |
Yes |
The button type. Valid values:
|
PHONE_NUMBER |
|
Url |
String |
No |
The URL to be accessed when the URL button is tapped. |
https://alibaba.com/xx |
|
UrlType |
String |
No |
The URL type. Valid values:
|
static |
|
PhoneNumber |
String |
No |
The phone number. |
+8613800 |
|
Name |
String |
Yes |
The name of the message template. |
hello_whatsapp |
|
Language |
String |
Yes |
The language that is used in the message template. For more information, see Language codes. |
en |
|
Example |
Object |
No |
The template example. |
|
|
String |
No |
The sample variables. This parameter is passed in by converting its original JSON structure into a String. |
{"textVariable":"text"} |
|
|
TemplateType |
String |
Yes |
The type of the message template. |
|
|
CustSpaceId |
String |
No |
The space ID of the user within the independent software vendor (ISV) account. |
293483938849493 |
|
AllowCategoryChange |
Boolean |
No |
Whether to allow Facebook to automatically change the template category. Setting this to true improves the review success rate. |
true |
|
MessageSendTtlSeconds |
Integer |
No |
The validity period of the message sent by an authentication template in WhatsApp. Note
You must provide the WhatsApp Business Account (WABA) in advance for Alibaba Cloud to add it to the allowlist. Otherwise, the template fails review submission. |
120 |
Response parameters
|
Parameter |
Type |
Description |
Example |
|
- |
Object |
The returned result. |
- |
|
RequestId |
String |
The request ID. |
90E63D28-E31D-1EB2-8939-A94866411B2D |
|
Code |
String |
The response code.
|
OK |
|
Message |
String |
The error message. |
User not authorized to operate on the specified resource. |
|
Data |
Object |
The returned result. |
- |
|
TemplateCode |
String |
The template code. |
SMS_232907**** |
|
TemplateName |
String |
The name of the message template. |
hello_world |
|
AccessDeniedDetail |
String |
The details about the access denial. |
- |
Examples
Sample success response
JSON format
{
"RequestId": "90E63D28-E31D-1EB2-8939-A94866******",
"Code": "OK",
"Message": "User not authorized to operate on the specified resource.",
"Data": {
"TemplateCode": "MSG_232907****",
"TemplateName": "hello_world"
},
"AccessDeniedDetail": "None"
}
Error codes
|
HTTP status code |
Error code |
Description |
|
400 |
Product.Unsubscript |
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. |
|
400 |
Unknown.ResourceOwnerId |
The resource does not belong to the current user. |