All Products
Search
Document Center

Chat App Message Service:Modify a WhatsApp message template

Last Updated:Feb 26, 2025

Usage notes

QPS limit

You can call this operation up to 50 times per second per account. Requests that exceed this limit are dropped and you will experience service interruptions. We recommend that you take note of this limit when you call this operation.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Authorization information

The following table shows the authorization information corresponding to the API operation. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation.

  • Operation: the value that you can use in the Action element to specify the operation on a resource.

  • Access level: the access level of each operation. The levels are read, write, and list.

  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation.

    • The required resource types are highlighted.

    • If the permissions cannot be granted at the resource level, "All resources" is used in the Resource type column of the operation.

  • Condition key: the condition keys that are defined by the Alibaba Cloud service.

  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.

Operation

Access level

Resource type

Condition key

Associated operation

cams:ModifyChatappTemplate

Write

  • All Resources*

None

None

Request parameters

Parameter

Type

Required

Description

Example

Components

Object[]

Yes

The components in the message template.

Note

If Category is set to AUTHENTICATION, the Type sub-parameter of the Components parameter cannot be set to HEADER. If the Type sub-parameter is set to BODY or FOOTER, you do not need to set the Text sub-parameter of the Components parameter because the value is automatically generated.

-

Type

String

Yes

The component type. Valid values:

  • BODY

  • HEADER

  • FOOTER

  • BUTTONS

  • CAROUSEL

  • LIMITED_TIME_OFFER

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 chatapp

Format

String

No

The type of the media resource. Valid values:

  • TEXT

  • IMAGE

  • DOCUMENT

  • VIDEO

TEXT

Url

String

No

The URL of the media resource.

Note

The size of the media resource must meet the requirements. For more information about parameters, see the "Supported media types and size limits" section of the Parameters of a message template topic.

https://img.tukuppt.com/png_preview/00/10/24/1GygxVK3F4.jpg

Caption

String

No

The description.

Note

If the Type sub-parameter of the Components parameter is set to HEADER and the Format sub-parameter is set to IMAGE, DOCUMENT, or VIDEO, you can specify this parameter.

This is a video.

FileName

String

No

The name of the document.

Note

If the Type sub-parameter of the Components parameter is set to HEADER and the Format sub-parameter is set to DOCUMENT, you can specify this parameter.

Video

Buttons

Object[]

No

The buttons. You can specify this parameter only if you set the Type sub-parameter of the Components parameter to BUTTONS.

Note

Limits on the number of buttons in a WhatsApp message template

  • A marketing or utility WhatsApp message template can contain up to 10 buttons.

  • A WhatsApp message template can contain only one Call button.

  • A WhatsApp message template can contain up to two URL buttons.

  • In a WhatsApp message template, an Auto-reply button cannot be used together with a Call button or a URL button.

-

Type

String

Yes

The button type. Valid values:

  • PHONE_NUMBER: Call button

  • URL: URL button

  • QUICK_REPLY: Auto-reply button

  • COPY_CODE: Copy button

  • ONE_TAP: Auto-fill button

  • CATALOG: Catalog button

  • MPM: MPM button

  • Flow: WhatsApp Flow button

  • ZERO_TAP: Zero-tap button

Note

If Category is set to AUTHENTICATION for a WhatsApp message template, you can add only one button to the WhatsApp message template and you must set the Type sub-parameter of the Buttons parameter to COPY_CODE or ONE_TAP. If Type is set to COPY_CODE, the Text sub-parameter of the Buttons parameter is required. If Type is set to ONE_TAP, the Text, SignatureHash, PackageName, and AutofillText sub-parameters of the Buttons parameter are required. 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 button text.

phone-button-text

PhoneNumber

String

No

The phone number.

+86138****7889

Url

String

No

The URL to be accessed when the URL button is tapped.

https://www.******.com/

UrlType

String

No

The URL type. Valid values:

  • static: static content

  • dynamic: dynamic content

dynamic

SignatureHash

String

No

The app signing key hash that WhatsApp uses to load your app. This parameter is required if Category is set to AUTHENTICATION and the Type sub-parameter of the Buttons parameter is set to ONE_TAP for a WhatsApp message template.

29dkeke

PackageName

String

No

The app package name that WhatsApp uses to load your app. This parameter is required if Category is set to AUTHENTICATION and the Type sub-parameter of the Buttons parameter is set to ONE_TAP for a WhatsApp message template.

com.demo

AutofillText

String

No

The text of the Auto-fill button. This parameter is required if Category is set to AUTHENTICATION and the Type sub-parameter of the Buttons parameter is set to ONE_TAP for a WhatsApp message template.

Autofill

IsOptOut

Boolean

No

The Unsubscribe button. This parameter is valid if Category is set to MARKETING and the Type sub-parameter of the Buttons parameter is set to QUICK_REPLY for a WhatsApp message template. Marketing messages will not be sent to customers if you configure message sending in the Chat App Message Service console and the customers tap this button.

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.

6645*******0605

FlowAction

String

No

The Flow action.

Valid values:

  • DATA_EXCHANGE

  • NAVIGATE

NAVIGATE

NavigateScreen

String

No

This parameter is returned if FlowAction is set to NAVIGATE.

DETAILS

CodeExpirationMinutes

Integer

No

The validity period of the verification code in the WhatsApp authentication template. Unit: minutes. This parameter is valid only when Category is set to AUTHENTICATION and the Type sub-parameter of the Components parameter is set to FOOTER. The validity period of the verification code is displayed in the footer.

5

AddSecretRecommendation

Boolean

No

The note indicating that customers cannot share verification codes with others. The note is displayed in the message body. This parameter is valid if Category is set to AUTHENTICATION and the Type sub-parameter of the Components parameter is set to BODY for a WhatsApp message template.

false

HasExpiration

Boolean

No

Specifies whether the promo code has an expiration time. Specify this parameter if the Type sub-parameter of the Components parameter 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

  • HEADER

  • BUTTONS

BODY

Format

String

No

The type of the media resource. This parameter is valid if the Type sub-parameter of the CardComponents parameter is set to HEADER. Valid values:

  • IMAGE

  • VIDEO

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. Specify this parameter only if you set the Type sub-parameter of the Components parameter to BUTTONS. A carousel card can contain up to two buttons.

-

Text

String

No

The button text.

Call me

Type

String

Yes

The button type. Valid values:

  • PHONE_NUMBER: Call button

  • URL: URL button

  • QUICK_REPLY: Auto-reply button

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: static content

  • dynamic: dynamic content

static

PhoneNumber

String

No

The phone number.

+86138****3618

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"}

TemplateCode

String

Yes

The message template code.

8472******883

CustSpaceId

String

No

The space ID of the user within the independent software vendor (ISV) account.

28251486512358****

TemplateType

String

No

The template type. Valid value:

  • WHATSAPP

WHATSAPP

MessageSendTtlSeconds

Integer

No

The validity period of the WhatsApp message if Category is set to AUTHENTICATION.

Note

You must provide the WhatsApp Business account (WABA) in advance so that Alibaba Cloud operations staff can add it to the whitelist. Otherwise, the message template fails to be submitted for review.

120

Response parameters

Parameter

Type

Description

Example

Object

The returned result.

-

RequestId

String

The request ID.

90E63D28-E31D-1EB2-8939-A9486641****

Code

String

The response code.

  • The value OK indicates that the request was successful.

  • Other values indicate that the request failed. For more information, see Error codes.

OK

Message

String

The error message.

-

Data

Object

The returned result.

-

TemplateCode

String

The template code.

847*******883

TemplateName

String

The name of the WhatsApp message template.

hello_whatsapp

AccessDeniedDetail

String

The details about the access denial.

-

Examples

Sample success response

JSON format

{
  "RequestId": "90E63D28-E31D-1EB2-8939-A9486641****",
  "Code": "OK",
  "Message": "None",
  "Data": {
    "TemplateCode": "8472929283883",
    "TemplateName": "hello_world"
  },
  "AccessDeniedDetail": "None"
}

Error codes

HTTP status code

Error code

Error message

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.

For a list of error codes, see Service error codes.