As a business, you might be looking to send WhatsApp messages to your customers automatically when some event pertaining to the customer has occurred.

One way of achieving this is by using Interakt’s Track APIs to send these events to Interakt & setting Ongoing Campaigns on Interakt. You should choose this method if:

 You want to keep your coding effort to the minimum.

 In this method, you simply need to make API calls when an event occurs in your system (website / app / CRM etc.)

 You don’t need to worry about changing the messages you want to send when that event occurs.

 If you have complex logics for when you want the message to go out, you won’t have to build those logics. For ex:

 Suppose you want the message to go out with some delay after an event , or, 

 you want the message to go out after the event only if the user has certain attributes, or,

 you want the message to go out after the event only if the user doesn’t do another event in a few hours etc.

 You want to easily see the results (delivery / read stats) of these campaigns without having to build a panel of your own for this.

 A summary of your campaigns is easily available to you on Interakt’s campaign dashboard.

 Your website is built using Shopify. We have a direct integration with Shopify! You don’t need to call any APIs to send out WhatsApp messages when your customer abandons cart / places order etc.

The second way of achieving this is by using Interakt’s Template Sending APIs (given below) to send the messages (templates/HSMs) to WhatsApp directly & then consuming the webhooks sent by Interakt which contain information on whether the messages got sent, delivered, read, failed. You should choose this method if:

 You have the coding bandwidth & resources to:

 build a process for enabling frequent changes of the messages which have to go out

 build complex logics for when to send the message.

 You already have a panel where you track your campaigns (from other channels) and hence want to track your WhatsApp campaigns in that same panel.

(or you might be using a marketing automation tool for both the above)

 You could use this second way also if you want to trigger SMS / Emails if the WhatsApp message fails to go to the customer.

Details of Template Sending APIs:

Call /v1/public/message/ to send the Template as required

1. If you want to store any message level attributes, then you can use the callback_data parameter to send additional data. This will be returned to you in the corresponding webhooks.

2. We will send an id in response to your API call. This id can be stored for future reference. This id will be referred to when webhooks are returned later.

URLhttps://api.interakt.ai/v1/public/message/

Method: POST

Headers: 

• Authentication:

• You can authenticate by sending the API Key along with the request data.

• Authentication mechanism uses HTTP Basic Auth which requires you to send the API Key with the ‘Basic’ string.

• The header key-pair will look like ‘Authorization: Basic <API Key>‘.

 The API Key will be available in your Interakt Dashboard in Developer Settings: https://app.interakt.ai/settings/developer-setting

• Content-Type:

• You must set the content-type header to ‘application/json’ to be able to send data to our HTTP API endpoint.

• Rate Limit: We have a rate limit of 40 requests per minute. For all requests after the 40th request (in that minute), the API will throw an error and thereby, ignore the request.

Request Body:

Example 1:

 If template header is of type text and contains a variable as well

 Body contains variables

 Template has 1 CTA button which contains a dynamic URL

{

“countryCode”: “+xx”, /* required */

“phoneNumber”: “xxxxxxxxxx”, /* required */

“type”: “Template”, /* required */

“callbackData”: “some_callback_data”, /* optional string with max length 512 */

“template”: {

“name”: “delivered_alert_101”, /* required */

“languageCode”: “en”, /* required */

“headerValues”: [

“Alert”, /* value for variable {{1}} in header text*/

],

“fileName”: “dummy.pdf”, /* optional, and only applicable with document header */

 

“bodyValues”: [

“There”, /* value for variable {{1}} in body text */

“1234” /* value for variable {{2}} in body text */

],

“buttonValues”: {

“0” /*button index */ :[

“12344” /* value for {{1}} for dynamic url in button at index

position 0*/

]

}

}

}

Example 2:

 If template header is of type media (image / video / document) – headerValues list will have only an element with the value of the mediaUrl

 Body contains variables

 Template has 2 CTA buttons – 1st one contains a phone number & 2nd one contains a dynamic URL.

{

“countryCode”: “+xx”, /* required */

“phoneNumber”: “xxxxxxxxxx”, /* required */

“type”: “Template”, /* required */

“callbackData”: “some_callback_data”, /* optional string with max length 512 */

“template”: {

“name”: “delivered_alert_101”, /* required */

“languageCode”: “en”, /* required */

“headerValues”: [

“https://interaktstorage.blob.core.windows.net/mediastoragecontainer/91e5634a-33b0-44b4-a075-884778f02feb/message_template_sample/tcITOHfOz6vy.png?se=2026-08-13T11%3A53%3A58Z&sp=rt&sv=2019-12-12&sr=b&sig=PDn3cPLmV%2BYu3D7Wd10JYmPLQeyGyytl013wAtmbL6g%3D” /* media url for the header’s media file */

],

“bodyValues”: [

“There”, /* value for variable {{1}} in body text */

“1234” /* value for variable {{2}} in body text */

],

“buttonValues”: {

“1” /*button index */ :[

“12344” /* value for {{1}} for dynamic url in button at index position 0*/

]

}

}

}

 

Response Body:

{

“result”: true,

“message”: “Message created successfully”,

“id”: “6c2d7175-fddd-4fbf-b0eb-084f170dbe08”

}

The id returned is the message id. It can be used to refer to the message-webhooks.

Field & Description

phoneNumber: User’s phone number, make sure it does not contain country code or “0” (zero) in beginning of the number

countryCode: Country code of the user’s phone

type: Type of message to be sent

Supported Values: Template

Template name

Make sure that the template was created in Interakt. The template name to be used is the code name of the template. How to get the code name?

 Go to https://app.interakt.ai/templates/list.

 Click on the template you want to use

 The page that opens will have the following URL: https://app.interakt.ai/template/codename/view

 Code name = the portion of the URL between ‘template/’ and ‘/view’

OR, if you want to use a template which was created by you in Facebook Business Manager, please click on Sync in https://app.interakt.ai/templates/list and after Sync is completed you will see the template appear in the list.

Language Code

Language code should match the language in which you had created the template. you can find all language codes here: https://developers.facebook.com/docs/whatsapp/api/messages/message-templates/

headerValues / bodyValues / buttonValues 

Values of variables contained in the template’s

 Header (if header type is text & there is a variable in it OR if header type is media)

 Body

 button (only in case there is a dynamic URL in the button)

Example 3: How to send payload within the template’s Quick Reply Buttons

(This is relevant only if you are using an Interakt account to send out WhatsApp campaigns and you also have a live Haptik bot. The button payloads will be returned by WhatsApp in their webhooks, whenever a customer clicks on the respective button.)

The example below shows the payload to be used for a template having:

 A document header

 1 Variable in Body

 3 Quick Reply Buttons (and payloads for each button)

{

“countryCode”: “+91”,

“phoneNumber”: “9999999999”,

“callbackData”: “some text here”,

“type”: “Template”,

“template”: {

“name”: “temp_with_quick_reply_buttons”,

“languageCode”: “en”,

“headerValues”: [

“https://interaktstorage.blob.core.windows.net/mediastoragecontainer/07ed4524-9549-481b-ad51-400200cabe0b/message_template_media/UkJYYpHdmCBc.pdf?se=2027-01-14T09%3A53%3A35Z&sp=rt&sv=2019-12-12&sr=b&sig=iJvIT6trhzcb81xg92HytxN2SH8p4YPX8xg5IItCUgQ%3D”

],

“fileName”: “Sample Document for testing.pdf”,

“bodyValues”: [

“some text here if any variable in message body”

],

“buttonPayload”: {

“0”: [“payload0”],

“1”: [“payload1”],

“2”: [“payload2”]

}

}

}

Parameter to be used

buttonPayload

Description

Data type supported – For the payload only string data type is allowed. Any character like @,%,* or space along with alphanumeric values are accepted but only within the string data type like

“12 345abc( ) ? ! . # % @ ^ = + – & * ` ~ ; : < > { }”

Payload character limit – The payload character limit is 128 characters.

Note: Numbering of the buttons starts with 0. There can be a max of 3 buttons.