Template management

更新时间:
复制 MD 格式

Use the following API operations to create, modify, delete, and query message templates.

Create a template - CreateChatappTemplate

Creates a Chat App template.

After creation, the template is automatically submitted to Facebook for review. Once approved, you can use it to send messages.

To check the review status of a template, see Query the details of a ChatApp template.

Note

Message templates are used to start conversations with customers. If a template consistently receives negative feedback, it may be disabled. After a template is disabled, you can no longer use it to send messages. Ensure that your templates do not contain prohibited content.

API document

Create a ChatApp template

Example

Sample response:

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

Modify a template - ModifyChatappTemplate

Modifies a Chat App template.

Note

Only templates that are pending review or rejected can be modified.

API document

Modify a ChatApp template

Example

Sample response:

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

Delete a template - DeleteChatappTemplate

Deletes a Chat App template.

API document

Delete a ChatApp template

Example

Sample response:

{
  "RequestId": "90E63D28-E31D-1EB2-8939-A9486641****",
  "Code": "OK",
  "Message": "User not authorized to operate on the specified resource."
}

Query template details - GetChatappTemplateDetail

Queries the details of a Chat App template.

Details include the template name, review status, template code, template type, and language.

API document

Query the details of a ChatApp template

Example

Sample response:

{
  "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",
        "Caption": "A new file has been uploaded",
        "FileName": "Express File",
        "Format": "TEXT",
        "Buttons": [
          {
            "Type": "PHONE_NUMBER",
            "Text": "Call",
            "PhoneNumber": "861398745****",
            "Url": "https://example.com\n",
            "UrlType": "static"
          }
        ],
        "ThumbUrl": "https://img.png",
        "Duration": 50,
        "FileType": "docx"
      }
    ],
    "TemplateType": "WHATSAPP"
  }
}

Query template list - ListChatappTemplate

Queries a list of Chat App templates.

Retrieves the category, review status, name, and code of message templates in a batch. A maximum of 10 templates can be queried per request.

API document

Query a list of ChatApp templates

Example

Sample response:

{
  "RequestId": "90E63D28-E31D-1EB2-8939-A9486641****",
  "Code": "OK",
  "Message": "User not authorized to operate on the specified resource.",
  "ListTemplate": [
    {
      "TemplateName": "hello_whatsapp",
      "TemplateCode": "744c4b5c79c9432497a075bdfca3****",
      "AuditStatus": "pass",
      "Language": "en",
      "Category": "TRANSACTIONAL",
      "TemplateType": "WHATSAPP"
    }
  ]
}