Send WhatsApp Notifications

In this section, you'll learn how to send a new WhatsApp based notification using our programmable APIs.

Sample Code

curl --location --request POST 'https://gateway.konverse.ai/ironman/api/v1/whatsApp/whatsappHSM' \
--header 'x-app-id: your app id' \
--header 'x-api-key: your app key' \
--header 'Content-Type: application/json' \
--data-raw '{
   "message": {
     "to": "919XXXXXXXXX",
     "templateName" : "message1",
     "language" : "<language-code>",
     "parameters": [
         "parameter1",
         "parameter2"
      ],
      "buttons" : []
   }
}'

Step 1 - Authentication

Authentication of our WhatsApp API is done using the two request headers, <x-app-id> & <x-api-key>. Connect to our development team for your ID & Key.

Step 2 - Using the API

Once your template is approved by WhatsApp & you've app ID & key, copy and paste the above cURL request with your credential and start testing.

WhatsApp Notification Sending API

POST https://gateway.konverse.ai/ironman/api/v1/whatsappHSM

Headers

NameTypeDescription

x-app-id

string

to be shared on request

x-api-key

string

to be shared on request

Content-Type

string

application/json

Request Body

NameTypeDescription

to

string

Mobile number to which WhatsApp notification has to be sent, prefixed with country code without + sign for e.g. "919876543210".

templateName

string

Name of the template pre-approved by WhatsApp.

parameter

string

An array of parameters that will replace the placeholder’s in the approved template. The number of parameters in a message template and the length of the array must be equal. Send an empty array if the template doesn't have any parameters e.g. []

file

string

This is an object type. Use only if the template has an attachment.

file.type

string

document / video / image

file.url

string

Public URL of the attachment

file.name

string

Optional caption for the attachment

buttons

string

Applicable only if the template has buttons. Send an empty array for Call to Action buttons, e.g. [].

buttons.type

string

Only if the button in the template is of type URL then type = “url”

buttons.url

string

URL suffix to the pre-approved URL with the template. WhatsApp does not allow completely dynamic URL. A part of URL is pre-approved with the template, and only URL suffix is sent in the API.

language

String

Language Code (optional). Refer WhatsApp documentation for supported language - Supported Language

{
    "status": "success",
    "message": "message sent successfully",
    "messageId": "gBEGkXdgloBAAgluX2iGtsi"
}

Template with dynamic CTA URL buttons & File

curl --location --request POST 'https://gateway.konverse.ai/ironman/api/v1/whatsApp/whatsappHSM' \
--header 'x-app-id: your app id' \
--header 'x-api-key: your app key' \
--header 'Content-Type: application/json' \
--data-raw '{
    "message": {
        "to": "1XXXXXXXX",
        "templateName": "<templatename>",
        "parameters": [
            <parameters>
        ],
        "file": {
            "type": "<document|image|video|audio>",
            "url": "<url - must end with .pdf/.doc/.png/.jpg>"
        },
        "buttons": [
            {
                "type": "url",
                "text": "<url parameter>"
            }
        ]
    }
}'

Last updated