Sending WhatsApp messages

In order to send a WhatsApp message, you must have an active WhatsApp channel and perform a HTTP request to the following endpoint with a valid access key

When sending outbound messages as well as setting the receiver information you must set message body field in all cases except for sending a message template when you must only set the template field

Body

{
 "receiver": {
   "contacts": [
     {
       "identifierKey": "phonenumber",
       "identifierValue": "+31612345678"
     }
   ]
 },
 "body": {...}
}

Template

{
 "receiver": {
   "contacts": [
     {
       "identifierKey": "phonenumber",
       "identifierValue": "+31612345678"
     }
   ]
 },
 "template": {...}
}

The Channels API supports many of the features of WhatsApp, however due to the omni channel nature of the API there may be some differences between the Channels API message and the native WhatsApp API. Here is an overview of the WhatsApp messages types and Channels API message types:

Outbound messages

Except for the template section all examples below must be set in the body field.

{
 "receiver": {
   "contacts": [
     {
       "identifierValue": "+31612345678"
     }
   ]
 },
 "body": {...}
}

Text

Text Message

Text message with reply buttons

Text message with postback actions

Text message with reply and postback actions

Image

Single image message

Single image message with text

Multiple image message

Single image message with postback actions

Single image message with label and reply actions

Single image message with label, postback and reply actions

Multiple images message with labels and postback actions

Multiple images message with reply actions

Multiple images message with labels, postback and reply actions

File

Single file message

Single file message with postback and reply actions

Multiple files message

Multiple files message with filename

Multiple files message with two postback actions and a reply action

Location

List

List message without sections

List message with sections

List message with sections and custom button label

ReplyTo

You can send any outbound message as a reply to a previous message by setting the replyTo object as shown below. The replyTo.id should be set to the id of a received message and the replyTo.type should be set to "message"

{
 "receiver": {
   "contacts": [
     {
       "identifierValue": "+31612345678"
     }
   ]
 },
 "body": {...},
 "replyTo": {
   "id": "<recievedmessageid>",
   "type": "message"
 }
}

ReplyTo with a text message

ReplyTo with an image message

ReplyTo with text message with postback actions

Template

{
 "receiver": {
   "contacts": [
     {
       "identifierValue": "+31612345678"
     }
   ]
 },
 "template": {...}
}

Text template with variable

Image template with button and variables

Image with a variable in a button

Last updated