All Products
Search
Document Center

Chat App Message Service:CreateChatappTemplate

Last Updated:Aug 27, 2026

Creates a message template. After the template is approved, you can use it to send messages.

Operation description

QPS limit

The single-user QPS limit for this operation is 50 calls per second. If this limit is exceeded, the API calls are throttled, which may affect your business. Call this operation as needed.

Status changes

You can monitor template status and quality changes through MNS or HTTP. For more information, see Receipt messages.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

cams:CreateChatappTemplate

create

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

Category

string

Yes

WhatsApp template category. Valid values:

  • UTILITY: transaction-related.

  • MARKETING: marketing.

  • AUTHENTICATION: identity verification.

Viber template category. Valid values:

  • UTILITY: transaction-related.

  • MARKETING: marketing.

  • AUTHENTICATION: identity verification.

UTILITY

Components

array<object>

Yes

The list of message template components.

Note

When Category=AUTHENTICATION, Components cannot contain nodes with Type=HEADER. When Type=BODY or FOOTER, the Text content must be empty.

array<object>

No

The component list.

HasExpiration

boolean

No

Specifies whether the coupon code has an expiration time. This parameter is used when type = LIMITED_TIME_OFFER.

true

ThumbUrl

string

No

The thumbnail for Viber video messages.

https://cdn.multiplymall.mobiapp.cloud/yunmall/B-LM-LMALL202207130001/20220730/d712a057-a6af-4513-bbe6-7ee57ea60983.png?x-oss-process=image/resize,w_100

FileName

string

No

The name of the file.

Express delivery video

Text

string

No

The text of the message to be sent.

Note

For WHATSAPP type, this property value is empty when Category=AUTHENTICATION.

hello whatsapp

Duration

integer

No

The duration (in seconds) of Viber video messages. Valid values: 0 to 600.

120

Url

string

No

The media resource path.

Note

For Viber type, the recommended image size is 800 px × 800 px.

https://image.developer.aliyundoc.com

Caption

string

No

The description of the file.

This is a video

AddSecretRecommendation

boolean

No

Valid for WhatsApp templates when Category is AUTHENTICATION and Component Type is Body. Displays a prompt above the Body advising not to share the verification code with others.

true

Type

string

Yes

The component type. Valid values:

  • BODY

  • HEADER

  • FOOTER

  • BUTTONS

  • CAROUSEL

  • LIMITED_TIME_OFFER

Note
  • For WhatsApp templates, the BODY component cannot exceed 1024 characters. The HEADER and FOOTER components cannot exceed 60 characters.

  • For Viber templates, the FOOTER, CAROUSEL, and LIMITED_TIME_OFFER types are invalid.

  • For Viber templates, images, videos, and files are placed in the HEADER (the device displays images below the text). Text is placed in the BODY.

BODY

Format

string

No

The media resource type.

  • TEXT: text

  • IMAGE: image

  • DOCUMENT: document

  • VIDEO: video

TEXT

CodeExpirationMinutes

integer

No

The validity period (in minutes) of the verification code for WhatsApp AUTHENTICATION templates. Valid only for WhatsApp messages when Category is AUTHENTICATION and Component Type is Footer (displayed in the Footer position).

5

FileType

string

No

The file type for Viber file messages.

docx

Buttons

array<object>

No

The button list. Applicable only to BUTTONS components.

Note

WhatsApp button quantity rules:

  • For WhatsApp templates with Category MARKETING/UTILITY, a maximum of 10 buttons are allowed.

  • Only 1 PHONE_NUMBER button is allowed.

  • A maximum of 2 URL buttons are allowed.

  • QUICK_REPLY buttons cannot appear in mixed order with PHONE_NUMBER/URL buttons.

Note

Viber button quantity rules:

  • Only URL type is supported, and only one button is allowed.

  • When the HEADER contains a VIDEO, the button type is URL, but you cannot set a URL address.

array<object>

No

The button definition.

AutofillText

string

No

Required for WhatsApp templates when Category is AUTHENTICATION and Button Type is ONE_TAP/ZERO_TAP. The button text for the WhatsApp Autofill operation.

Autofill

PackageName deprecated

string

No

Use the properties under SupportedApps instead.

com.demo

Text

string

No

The display name of the button.

Call Me

Url

string

No

The URL to visit when the link button is clicked.

https://example.com

FlowId

string

No

Flow ID。

479884093605****

Type

string

Yes

The button type.

  • PHONE_NUMBER: dial phone button

  • URL: web button

  • QUICK_REPLY: quick reply button

  • COPY_CODE: copy verification code or coupon code

  • ONE_TAP: autofill button for AUTHENTICATION templates

  • ZERO_TAP: autofill button for AUTHENTICATION templates

  • MPM: multi-product catalog

  • CATALOG: catalog

  • FLOW: open WhatsApp flow

Note
  • For WhatsApp templates with Category AUTHENTICATION, only one button is allowed, and the type can only be COPY_CODE/ONE_TAP. When COPY_CODE is selected, Text is required. When ONE_TAP is selected, Text (displayed when the target application is not installed on the device, representing the copy verification code button name), SignatureHash, PackageName, and AutofillText are required.

  • Viber templates allow only one Button, and it must be URL type.

PHONE_NUMBER

CouponCode

string

No

The coupon code value. Only letters and numbers are supported. You can pass in a variable such as $(couponCode) and provide the actual coupon code when sending.

120293

IsOptOut

boolean

No

Valid for WhatsApp templates when Category is Marketing and Button type is QUICK_REPLY. Indicates the button is a marketing opt-out button. If the customer clicks this button and send control is configured on ChatApp, subsequent Marketing messages will not be sent to the customer.

false

FlowAction

string

No

The Flow data event type. Valid values:

  • DATA_EXCHANGE: data exchange.

  • NAVIGATE: navigation.

NAVIGATE

SignatureHash deprecated

string

No

Use the properties under SupportedApps instead.

wi299382

NavigateScreen

string

No

The navigate screen. Required when FlowAction=NAVIGATE.

DETAILS

PhoneNumber

string

No

The phone number. Valid only when the button type is PHONE_NUMBER.

+861368897****

SupportedApps

array<object>

No

The list of supported applications.

object

No

SignatureHash

string

No

Required for WhatsApp templates when Category is AUTHENTICATION and Button Type is ONE_TAP/ZERO_TAP. The signature hash value for the application invoked by WhatsApp.

ieid83kdiek

PackageName

string

No

Required for WhatsApp templates when Category is AUTHENTICATION and Button Type is ONE_TAP/ZERO_TAP. The package name of the application invoked by WhatsApp.

com.kuaidian.waimaistaff

UrlType

string

No

The URL type.

  • static: static

  • dynamic: dynamic

static

Cards

array<object>

No

The Carousel template card list.

array<object>

No

The Carousel template card object.

CardComponents

array<object>

No

The list of components in the Carousel card.

array<object>

No

The card object in the Carousel template.

Type

string

Yes

The component type. Valid values:

  • BODY

  • HEADER

  • BUTTONS

BODY

Format

string

No

The media resource type. Valid when Type = HEADER.

  • IMAGE: image

  • VIDEO: video

IMAGE

Text

string

No

The BODY content in the Carousel card.

Who is the very powerful team

Buttons

array<object>

No

The button list. Applicable only to BUTTONS components. Each Carousel card can have a maximum of two buttons.

object

No

The button object.

Type

string

Yes

The button type.

  • PHONE_NUMBER: dial phone button

  • URL: web button

  • QUICK_REPLY: quick reply button

PHONE_NUMBER

PhoneNumber

string

No

The phone number.

+86138007****

Text

string

No

The button text.

Call me

UrlType

string

No

The URL type.

  • static: Static.

  • dynamic: Dynamic.

static

Url

string

No

The URL that is accessed when the button is clicked.

https://alibaba.com/xx

Url

string

No

The material path.

https://alibaba.com/img.png

Name

string

Yes

The template name.

hello_whatsapp

Language

string

Yes

The template language. For detailed language codes, see Language codes.

en

Example

object

No

The example for creating the template.

hello_whatsapp

string

No

The example for creating the template.

StringConcat('a', 'b', 'c')

TemplateType

string

Yes

The templatetype. Valid values:

  • WHATSAPP

  • VIBER

WHATSAPP

CustWabaId deprecated

string

No

The ISV customer WabaId.

Note

Deprecated parameter. Use CustSpaceId instead.

65921621816****

IsvCode deprecated

string

No

The ISV verification code, used to verify whether the sub-account is authorized by the ISV.

skdi3kksloslikdkkdk

CustSpaceId

string

No

The SpaceId of the ISV sub-customer or the direct customer instance ID.

293483938849493

AllowCategoryChange deprecated

boolean

No

Specifies whether to allow Facebook to automatically change the template category (to improve the template approval rate). This property is valid only when TemplateType is set to WHATSAPP.

Important This property has been deprecated. WhatsApp no longer supports this property.

true

MessageSendTtlSeconds

integer

No

The time-to-live (TTL) for template messages in WhatsApp.

  • AUTHENTICATION: valid values range from 30 to 900.

  • UTILITY: valid values range from 30 to 43200.

120

CategoryChangePaused

boolean

No

Specifies whether to pause template sending when a Utility template is changed to Marketing type. This property is valid only for WhatsApp templates.

false

No

productSetId

9928**

Response elements

Element

Type

Description

Example

object

The response parameters.

RequestId

string

The request ID.

90E63D28-E31D-1EB2-8939-A94866411B2D

Code

string

The request status code.

  • OK indicates that the request was successful.

  • For other error codes, see Error codes.

OK

Message

string

The error message.

User not authorized to operate on the specified resource.

Data

object

The returned data.

{"templateCode": "****4b5c79c9432497a075bdfca36bf5","templateName": "hello_whatsapp"}

TemplateCode

string

The template code.

SMS_232907****

TemplateName

string

The template name.

hello_whatsapp

AccessDeniedDetail

string

The access denied details.

None

Success

boolean

true

Examples

Success response

JSON format

{
  "RequestId": "90E63D28-E31D-1EB2-8939-A94866411B2D",
  "Code": "OK",
  "Message": "User not authorized to operate on the specified resource.",
  "Data": {
    "TemplateCode": "SMS_232907****",
    "TemplateName": "hello_whatsapp"
  },
  "AccessDeniedDetail": "None",
  "Success": true
}

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.