HSM (template) messages

Getting a hsm-template

GET https://eu.hightouch.ai/api/bot/waba_templates/template_id/

This request helps to get one hsm-template.

Path Parameters

NameTypeDescription

template_id

integer

Template ID

{
        "status": "ok",
    "result": {
        "id": 123,
        "shop_id": 1,
        "bot": {
            "name": "WABA Test",
            "bot_type": 6,
            "id": 1234
        },
        "name": "template_name",
        "namespace": "WhatsApp Business namespace",
        "language": "es",
        "text": null,
        "category": "AUTO_REPLY",
        "components": [
            {
                "text": "text",
                "type": "BODY"
            },
            {
                "type": "BUTTONS",
                "buttons": [
                    {
                        "text": "text",
                        "type": "QUICK_REPLY"
                    }
                ]
            }
        ],
        "status": "approved",
        "rejected_reason": "NONE",
        "parameters": [],
        "created_at": "14.07.2021 - 11:58"
}

Getting a list of hsm-templates

GET https://eu.hightouch.ai/api/bot/waba_templates/

This request helps to get a list of fetched hsm-templates.

Query Parameters

NameTypeDescription

shop_id

integer

Account ID

{
    "status": "ok",
    "result": {
        "count": 100,
        "next": "http://app.hightouch.ai/api/bot/waba_templates/?limit=20&offset=20&shop_id=2",
        "previous": null,
        "results": [
            {
                "id": 123,
                "shop_id": 1,
                "bot": {
                    "name": "WABA Test",
                    "bot_type": 6,
                    "id": 123
                },
                "name": "template_name",
                "namespace": "WhatsApp Business namespace",
                "language": "es",
                "text": null,
                "category": "ACCOUNT_UPDATE",
                "components": [
                    {
                        "text": "text",
                        "type": "BODY"
                    },
                    {
                        "type": "BUTTONS",
                        "buttons": [
                            {
                                "text": "text",
                                "type": "QUICK_REPLY"
                            },               
 {
                    "type": "URL",
                    "text": "text",
                    "url": "https://example.com"
                },
                {
                    "type": "PHONE_NUMBER",
                    "text": "text",
                    "phone_number": "+123456789"
                }
                        ]
                    }
                ],
                "status": "approved",
                "rejected_reason": "NONE",
                "parameters": [],
                "created_at": "27.02.2022 - 09:15"
            },
            ...
        ]
    }
}

Send HSM template message

POST https://eu.hightouch.ai/api/v2/bot/messages/send_waba_template_message/

Отправка HSM сообщения.

Request Body

NameTypeDescription

shop_id

integer

ID магазина.

bot_id

integer

ID бота, от которого будет отправка.

template_id

integer

ID шаблона.

chat_id_in_messenger

string

ID чата в WhatsApp. Должен присутствовать, если phone не указан.

template_data

array

Данные для отправки. Пример ниже.

phone

string

Номер телефона получателя. Должен присутствовать, если chat_id_in_messenger не указан.

lang_code

string

Код языка, например - en или ru.

# в случае успеха
{
    "status": "ok",
    "result": {
        "message_id": 123456
    }
}

# в случае ошибки
{
    "status": "error",
    "errors": {
        ...
        # error details
    }
}
[
    {
        "type" : "header",
        "parameters":
            [
                {
                    "type": "text",
                    "text": "replacement_text"
                }
            ]
    },
    {
        "type" : "body",
        "parameters":
            [
                {
                    "type": "text",
                    "text": "replacement_text"
                },
                {
                    "type": "text",
                    "text": "another_text"
                },
                {
                ...
                # Any additional template parameters
                }
            ]
    },
    {
        "type": "button",
        "sub_type" : "url",
        "index": "0", 
        "parameters":
            [
                {
                    "type": "text",
                    "text": "9rwnB8RbYmPF5t2Mn09x4h"
                }
            ]
    },
    {
        "type": "button",
        "sub_type" : "url",
        "index": "1", 
        "parameters":
            [
                {
                    "type": "text",
                    "text": "login"
                }
            ]
    },
]

The index field in the button block is the index number of the button. There can be 3 buttons in the HSM message.

The text field in the button parameters, is the text that can be added to the url of the button.

Last updated