Get WhatsApp Message Templates

Retrieve the information and content of WhatsApp message templates that have been synchronized to the PBX for a specified WhatsApp channel.

Request URL

GET {base_url}/{api_path}/message_channel/whatsapp_template?access_token={access_token}

Request parameters

Table 1.
Parameter Required Type Description
omnichannel_id Yes Integer The ID of the desired WhatsApp message channel.
Note: You can query the ID using Search Specific Message Channels.
category No String Template category.

Valid value:

  • MARKETING
  • UTILITY
  • AUTHENTICATION
Note: Use a comma to separate multiple categories.
language No String Template language.
Note:
  • The available values for this parameter depend on the languages of existing templates under your WhatsApp account in the PBX. To obtain valid language codes, please query the template list first using this interface, then use the language values returned.
  • Use a comma to separate multiple languages.
search_value No String Search keyword.
page No Integer Define which page is displayed.
page_size No Integer Define how many records per page.

Response parameters

Table 2.
Parameter Type Description
errcode Integer Returned error code.
  • 0: Succeed.
  • Non-zero value: Failed.
Note: You can check the error code and error message in Error Code and Error Message.
errmsg String Returned message.
  • SUCCESS: Succeed.
  • FAILURE: Failed.
total_number Integer The total number of WhatsApp message templates.
data Array <MSGTemplate_Info> The detailed information of WhatsApp message templates.
MSGTemplate_Info
Parameter Type Description
id Integer The ID of the message template in the PBX system.
template_id String The original template ID from the WhatsApp platform.
name String Template name.
parameter_format String The format of the placeholders (variables) used in the template.
  • POSITIONAL: Placeholders are defined by their position. For example, {{1}}, {{2}}.
  • NAMED: Placeholders use custom field names. For example, {{name}}, {{code}}.
language String Template language.
category String Template category.
sub_category String Template sub-category.
components_data String The content of template components in JSON string format.
omnichannel_id Integer The ID of the message channel.

Example

Request example

GET /openapi/v1.0/message_channel/whatsapp_template?omnichannel_id=1&access_token=FOgrNFKY6xVQcUxw3pfMTFqCAG6lBulV&search_value=store HTTP/1.1
Host: 192.168.5.150:8088

Response example

HTTP/1.1 200 OK
{
    "errcode": 0,
    "errmsg": "SUCCESS",
    "total_number": 1,
    "data": [
        {
            "id": 1774,
            "template_id": "2011532696320970",
            "name": "store_offer_notification",
            "parameter_format": "NAMED",
            "language": "en",
            "category": "MARKETING",
            "sub_category": "CUSTOM",
            "components_data": "[{\"type\":\"HEADER\",\"format\":\"LOCATION\"},{\"type\":\"BODY\",\"text\":\"Special offer: {{Offer_Details}}\\n\\nPlease visit our store within {{Time_Limit}} to enjoy this offer.\\n\\nIf you have any questions, feel free to contact us.\"},{\"type\":\"FOOTER\",\"text\":\"We look forward to serving you!\"}]",
            "omnichannel_id": 1
        }
    ]
}