HSMs (english)

This is a work in progress page, translated from the https://mobile-tonic.atlassian.net/wiki/spaces/CTP/pages/507707434 version

Access through the Chat-Tonic API

The API call has a very simple authentication system with an API key provided by Chat-Tonic, and that is sent in either the HTTP headers or querystring.

The API call receives the following parameters as a JSON in the body:

“id”: phone number, with or without a +, and complete with country code information, e.g.: +54912349876

“hsm”: it’s a JSON object where the HSM information is received. In particular there are 2 required parameters that determine the “template” to be used (namespace, and elementName), and also the “parameters” which are the values for the variables that auto-complete the template. E.g. the HSM might be something like “Welcome {variable} to our WhatsApp customer service support”. Where “{variable}” is replaced with the first value of the “parameters” array, and so on with the rest of the variables.

“flag”: it’s an optional string. The main purpose is to communicate information to the bot, for it to capture extra information that might be useful in the conversation, which otherwise would be lost in the HSM. E.g: it would be possible to receive the email of the user that is being contacted in the HSM for the bot to use that information for further purposes when the user replies to the HSM.

The following is an example of the API call in CURL:

  • appCodename is the application codename, specified by Chat-Tonic, and it’s different for every client

  • accountId is the WhatsApp account id, specified by Chat-Tonic, and it’s different for every client

  • platform the WhatsApp platform, specified by Chat-Tonic:

    • whatsapp-clickatell for Clickatell accounts

    • whatsapp-infobip for Infobip accounts

    • whatsapp-movile for Wavy/Movile accounts

  • appToken the API Key to authenticate the API Call, specified in the Authorization HTTP header, specified by Chat-Tonic, and it’s different for every client

1 2 3 4 5 6 curl -X POST \ https://chat-tonic.com/api/v1/:appCodename/:platform/:accountId/sendhsm \ -H 'Accept: application/json' \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer :appToken' \ -d '{ "id": "+54911", "hsm": { "namespace": "template_namespace", "elementName": "template_name", "parameters": [] }, "flag": "optional"}’