All Products
Search
Document Center

Chat App Message Service:GetChatappTemplateDetail

Last Updated:Nov 18, 2024

Queries the information of a message template.

Operation description

QPS limit

You can call this API operation up to five times per second per account. If the number of calls per second exceeds the limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limit when you call this operation.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. 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. Description:

  • 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. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • 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 key that is defined by the 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.
OperationAccess levelResource typeCondition keyAssociated operation
cams:GetChatappTemplateDetailget
*All Resources
*
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
TemplateCodestringNo

The code of the message template.

****4b5c79c9432497a075bdfca36bf5
LanguagestringYes

The language that is used in the message template. For more information, see Language codes.

en_US
CustWabaIddeprecatedstringNo

The WhatsApp Business account (WABA) ID of the user within the independent software vendor (ISV) account.

Note CustWabaId is an obsolete parameter. Use CustSpaceId instead.
65921621816****
IsvCodestringNo

The independent software vendor (ISV) verification code. This parameter is used to verify whether the user is authorized by the ISV account.

skdi3kksloslikdkkdk
CustSpaceIdstringNo

The space ID of the user within the ISV account.

28251486512358****
TemplateTypestringNo

The type of the message template. Valid values:

  • WHATSAPP
  • VIBER
  • LINE (developing)
WHATSAPP
TemplateNamestringNo

Name of a template.

test_name

Response parameters

ParameterTypeDescriptionExample
object

The response parameters.

RequestIdstring

The request ID.

744c4b5c79c9432497a075bdfca3****
Codestring

The HTTP status code.

  • Example: OK. This value indicates that the request is successful.
  • Other codes indicate that the request fails. For more information, see Error codes.
OK
Messagestring

The error message.

User not authorized to operate on the specified resource.
Dataobject

The returned data.

Categorystring

The category of the template when the returned value of TemplateType is WHATSAPP. Valid values:

  • UTILITY: a transactional template
  • MARKETING: a marketing template
  • AUTHENTICATION: an identity authentication template

The category of the template when the returned value of the TemplateType parameter is VIBER. Valid values:

  • text: a template that contains only text
  • image: a template that contains only images
  • text_image_button: a template that contains text, images, and buttons
  • text_button: a template that contains text and buttons
  • document: a template that contains only files
  • video: a template that contains only videos
  • text_video: a template that contains text and videos
  • text_video_button: a template that contains text, videos, and buttons
  • text_image: a template that contains text and images
Note If Category is set to text_video_button, users cannot open a web page by clicking the button. Users can open only the video in the message. In this case, you do not need to specify the Url parameter for the URL button in the template.
TRANSACTIONAL
TemplateCodestring

The code of the message template.

744c4b5c79c9432497a075bdfca3****
Namestring

The name of the message template.

hello_whatsapp
Languagestring

The language that is used in the message template. For more information, see Language codes.

en_US
Exampleobject

The examples of variables.

string

The values of the variables that are included in the message template. The values must be in the JSON format.

{\"textVariable\":\"text\",\"linkVariable\":\"https://image.developer.aliy\"}
AuditStatusstring

The review status of the message template. Valid values:

  • pass: The message template is approved.
  • fail: The message template is rejected.
  • auditing: The message template is being reviewed.
  • unaudit: The review is suspended.
pass
Componentsarray<object>

The components of the message template.

componentobject

The information about the array object.

Typestring

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.

  • FOOTER, CAROUSEL, and LIMITED_TIME_OFFER components are not supported in Viber message templates.

  • In Viber message templates, media resources such as images, videos, and documents are placed in the HEADER component. If a Viber message contains text and an image, the image is placed below the text in the message received on a device.

BODY
Urlstring

The URL of the media resource.

https://image.developer.aliyundoc.com
Textstring

The text of the message that you want to send.

Hello
Captionstring

The description of the document.

The new file has been uploaded.
FileNamestring

The name of the document.

Express file
Formatstring

The format.

TEXT
Buttonsarray<object>

The buttons. This parameter is returned only if the Type sub-parameter of the Components parameter is set to BUTTONS.

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

  • A WhatsApp message template can contain only one phone call button.

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

  • In a WhatsApp message template, a quick reply button cannot be used together with a phone call button or a URL button.

buttonobject

The information about the array object.

Typestring

The button type. Valid values:

  • PHONE_NUMBER: phone call button
  • URL: URL button
  • QUICK_REPLY: quick reply button
  • COPY_CODE: copy code button
  • ONE_TAP: one-tap autofill button if Category is set to AUTHENTICATION
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.

  • You can add only one button to a Viber message template, and you must set the Type sub-parameter of the Buttons parameter to URL.

PHONE_NUMBER
Textstring

The display name of the button.

Call
PhoneNumberstring

The phone number. This parameter is valid only if the Type sub-parameter of the Buttons parameter is set to PHONE_NUMBER.

861398745****
Urlstring

The URL to which you are redirected when you click the URL button.

https://example.com
UrlTypestring

The URL type. Valid values:

  • static
  • dynamic
static
SignatureHashstring

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 in a WhatsApp message template.

2993839
PackageNamestring

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 in a WhatsApp message template.

com.aliyun
AutofillTextstring

The text of the one-tap autofill 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 in a WhatsApp message template.

Autofill
IsOptOutboolean

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 click this button.

false
ExtendAttrsobject

The extended fields.

NextTemplateCodestring

The code of the next template.

20939920093993
NextTemplateNamestring

The name of the next template.

abc
NextLanguageCodestring

The language of the next template.

en
Actionstring

The event type.

nextCard
IntentCodestring

The intent code.

test
CouponCodestring

The coupon code.

202039ksjs
FlowIdstring

The Flow ID.

3838292983
FlowActionstring

The Flow action. Valid values: NAVIGATE and DATA_EXCHANGE.

NAVIGATE
NavigateScreenstring

The first screen in the Flow. This parameter is returned if FlowAction is set to NAVIGATE.

DETAILS
SupportedAppsarray<object>

The apps that support one-tap authentication and zero-tap authentication.

supportedAppsobject
SignatureHashstring

The app signing key hash.

29kdkeik939
PackageNamestring

The app package name.

com.test
ThumbUrlstring

The thumbnail URL of the video in the Viber message template.

https://img.png
Durationinteger

The length of the video in the Viber message template. Unit: seconds. Valid values: 0 to 600.

50
FileTypestring

The type of the document attached in the Viber message template.

docx
Latitudestring

The latitude of the location.

28.001
Longitudestring

The longitude of the location.

120.002
LocationNamestring

The name of the location.

Hangzhou
LocationAddressstring

The address of the location.

Hangzhou
AddSecretRecommendationboolean

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
CodeExpirationMinutesinteger

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 for a WhatsApp message template. The validity period of the verification code is displayed in the footer.

5
hasExpirationboolean

Indicates whether the coupon code has an expiration time in the limited-time offer template.

true
OfferExpirationTimeMsstring

The variable when the coupon code expires in the limited-time offer template.

$(offerExpirationTimeMs)
Cardsarray<object>

The carousel cards.

object
CardComponentsarray<object>

The components of the carousel card.

object
Typestring

The component type.

HEADER
Textstring

The text of the carousel card.

Body
Urlstring

The URL.

https://aliyun.com
Formatstring

The type of the header in the carousel template. The header can only be an image or a video. The headers of all carousel cards must be the same. The type of the media resources that are included in the message. Valid values: IMGAGE and VIDEO.

HEADER
Buttonsarray<object>

The buttons of the carousel card.

object
Typestring

The type of the button in the carousel template. Valid values: URL, PHONE_NUMBER, and QUICK_REQLY.

URL
Textstring

The button text.

Button text
Urlstring

The URL to which you are redirected when you click the URL button.

https://aliyun.com
UrlTypestring

The type of the URL. Valid values: static and dynamic.

static
PhoneNumberstring

The phone number.

+86138000
TemplateTypestring

The type of the message template. Valid values:

  • WHATSAPP
  • VIBER
  • LINE (developing)
WHATSAPP
QualityScorestring

The quality of the template.

GREEN
MessageSendTtlSecondsinteger

The validity period of the WhatsApp authentication message.

120
Reasonstring

The reason why the template was rejected.

None
AccessDeniedDetailstring

Access denied details.

None

Examples

Sample success responses

JSONformat

{
  "RequestId": "744c4b5c79c9432497a075bdfca3****",
  "Code": "OK",
  "Message": "User not authorized to operate on the specified resource.",
  "Data": {
    "Category": "TRANSACTIONAL",
    "TemplateCode": "744c4b5c79c9432497a075bdfca3****",
    "Name": "hello_whatsapp",
    "Language": "en_US",
    "Example": {
      "key": "{\\\"textVariable\\\":\\\"text\\\",\\\"linkVariable\\\":\\\"https://image.developer.aliy\\\"}"
    },
    "AuditStatus": "pass",
    "Components": [
      {
        "Type": "BODY",
        "Url": "https://image.developer.aliyundoc.com",
        "Text": "Hello\n",
        "Caption": "The new file has been uploaded.\n",
        "FileName": "Express file\n",
        "Format": "TEXT",
        "Buttons": [
          {
            "Type": "PHONE_NUMBER",
            "Text": "Call\n",
            "PhoneNumber": "861398745****",
            "Url": "https://example.com\n",
            "UrlType": "static",
            "SignatureHash": "2993839",
            "PackageName": "com.aliyun",
            "AutofillText": "Autofill",
            "IsOptOut": false,
            "ExtendAttrs": {
              "NextTemplateCode": "20939920093993",
              "NextTemplateName": "abc",
              "NextLanguageCode": "en",
              "Action": "nextCard",
              "IntentCode": "test"
            },
            "CouponCode": "202039ksjs",
            "FlowId": "3838292983",
            "FlowAction": "NAVIGATE",
            "NavigateScreen": "DETAILS",
            "SupportedApps": [
              {
                "SignatureHash": "29kdkeik939",
                "PackageName": "com.test"
              }
            ]
          }
        ],
        "ThumbUrl": "https://img.png",
        "Duration": 50,
        "FileType": "docx",
        "Latitude": "28.001",
        "Longitude": "120.002",
        "LocationName": "Hangzhou\n",
        "LocationAddress": "Hangzhou\n",
        "AddSecretRecommendation": false,
        "CodeExpirationMinutes": 5,
        "hasExpiration": true,
        "OfferExpirationTimeMs": "$(offerExpirationTimeMs)",
        "Cards": [
          {
            "CardComponents": [
              {
                "Type": "HEADER",
                "Text": "Body",
                "Url": "https://aliyun.com",
                "Format": "HEADER",
                "Buttons": [
                  {
                    "Type": "URL",
                    "Text": "Button text\n",
                    "Url": "https://aliyun.com",
                    "UrlType": "static",
                    "PhoneNumber": "+86138000"
                  }
                ]
              }
            ]
          }
        ]
      }
    ],
    "TemplateType": "WHATSAPP",
    "QualityScore": "GREEN",
    "MessageSendTtlSeconds": 120,
    "Reason": "None"
  },
  "AccessDeniedDetail": "None"
}

Error codes

HTTP status codeError codeError message
400Product.UnsubscriptYou have not subscribed to the specified product.
400Ram.PermissionDenyYou are not authorized to perform the operation.
400System.LimitControlThe system is under flow control.
400Unknown.ResourceOwnerIdThe resource does not belong to the current user.

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2024-06-21The Error code has changed. The response structure of the API has changedView Change Details
2024-04-10The Error code has changed. The request parameters of the API has changedView Change Details
2023-11-21The Error code has changed. The response structure of the API has changedView Change Details
2023-10-19The Error code has changed. The response structure of the API has changedView Change Details
2023-09-14The Error code has changed. The response structure of the API has changedView Change Details
2023-08-17The Error code has changed. The response structure of the API has changedView Change Details
2023-07-04The Error code has changed. The response structure of the API has changedView Change Details
2023-05-25The Error code has changed. The response structure of the API has changedView Change Details
2023-05-08The Error code has changed. The response structure of the API has changedView Change Details
2023-04-13The Error code has changed. The response structure of the API has changedView Change Details