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
Copy {
"receiver": {
"contacts": [
{
"identifierKey": "phonenumber",
"identifierValue": "+31612345678"
}
]
},
"body": {...}
}
Template
Copy {
"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:
WhatsApp API type
Channels API
interactive - quick reply button
interactive - multi product message
Outbound messages
Except for the template section all examples below must be set in the body field.
Copy {
"receiver": {
"contacts": [
{
"identifierValue": "+31612345678"
}
]
},
"body": {...}
}
Text
Text Message
Copy {
"type": "text",
"text": {
"text": "Single text message"
}
}
Text message with reply buttons
Copy {
"type": "text",
"text": {
"text": "Single text message with reply actions",
"actions": [
{
"type": "reply",
"reply": {
"text": "Reply action 1"
}
},
{
"type": "reply",
"reply": {
"text": "Reply action 2"
}
}
]
}
}
Text message with postback actions
Copy {
"type": "text",
"text": {
"text": "Single text message with postback actions",
"actions": [
{
"type": "postback",
"postback": {
"text": "Postback action 1",
"payload": "postback-payload-1"
}
},
{
"type": "postback",
"postback": {
"text": "Postback action 2",
"payload": "postback-payload-2"
}
}
]
}
}
Text message with reply and postback actions
Copy {
"type": "text",
"text": {
"text": "Single text message with reply and postback actions",
"actions": [
{
"type": "postback",
"postback": {
"text": "Postback action 1",
"payload": "postback-payload-1"
}
},
{
"type": "reply",
"reply": {
"text": "Reply action 1"
}
}
]
}
}
Text message with location request
Copy {
"text": "Single text message with location request",
"actions": [
{
"type": "locationRequest"
}
]
}
Image
Single image message
Copy {
"type": "image",
"image": {
"images": [
{
"altText": "Label of first image",
"mediaUrl": "https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdnJZeZvhOMhDQA8SpjQM%2Fuploads%2FRPPgQAGyZE7rvIh3WM2Z%2Fimage2.avif?alt=media"
}
]
}
}
Single image message with text
Copy {
"type": "image",
"image": {
"images": [
{
"altText": "Label of first image",
"mediaUrl": "https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdnJZeZvhOMhDQA8SpjQM%2Fuploads%2FRPPgQAGyZE7rvIh3WM2Z%2Fimage2.avif?alt=media"
}
],
"text": "Single image message"
}
}
Multiple image message
Copy {
"type": "image",
"image": {
"images": [
{
"altText": "Label of first image",
"mediaUrl": "https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdnJZeZvhOMhDQA8SpjQM%2Fuploads%2FrEM9zztd8SEiJS6RQuR3%2Fimage.png?alt=media"
},
{
"altText": "Label of second image",
"mediaUrl": "https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdnJZeZvhOMhDQA8SpjQM%2Fuploads%2FRPPgQAGyZE7rvIh3WM2Z%2Fimage2.avif?alt=media"
}
],
"text": "Multiple images message"
}
}
Single image message with postback actions
Copy {"type": "image",
"image": {
"images": [
{
"altText": "Image label",
"mediaUrl": "https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdnJZeZvhOMhDQA8SpjQM%2Fuploads%2FrEM9zztd8SEiJS6RQuR3%2Fimage.png?alt=media"
}
],
"text": "Single image message with postback actions",
"actions": [
{
"type": "postback",
"postback": {
"payload": "postback-payload-1",
"text": "Postback option 1"
}
},
{
"postback": {
"payload": "postback-payload-2",
"text": "Postback option 2"
},
"type": "postback"
}
]
}
}
Single image message with label and reply actions
Copy {
"type": "image",
"image": {
"text": "Single image message with reply actions",
"images": [
{
"mediaUrl": "https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdnJZeZvhOMhDQA8SpjQM%2Fuploads%2FrEM9zztd8SEiJS6RQuR3%2Fimage.png?alt=media",
"altText": "Image label"
}
],
"actions": [
{
"type": "reply",
"reply": {
"text": "Reply action 1"
}
},
{
"type": "reply",
"reply": {
"text": "Reply action 2"
}
}
]
}
}
Single image message with label, postback and reply actions
Copy {
"type": "image",
"image": {
"text": "Single image message with postback and reply actions",
"images": [
{
"mediaUrl": "https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdnJZeZvhOMhDQA8SpjQM%2Fuploads%2FrEM9zztd8SEiJS6RQuR3%2Fimage.png?alt=media",
"altText": "Image label"
}
],
"actions": [
{
"type": "postback",
"postback": {
"text": "Postback action",
"payload": "postback-payload"
}
},
{
"type": "reply",
"reply": {
"text": "Reply action"
}
}
]
}
}
Multiple images message with labels and postback actions
Copy {
"type": "image",
"image": {
"images": [
{
"altText": "First image label",
"mediaUrl": "https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdnJZeZvhOMhDQA8SpjQM%2Fuploads%2FrEM9zztd8SEiJS6RQuR3%2Fimage.png?alt=media"
},
{
"altText": "Second image label",
"mediaUrl": "https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdnJZeZvhOMhDQA8SpjQM%2Fuploads%2FRPPgQAGyZE7rvIh3WM2Z%2Fimage2.avif?alt=media"
}
],
"text": "Multiple images message with postback actions",
"actions": [
{
"type": "postback",
"postback": {
"payload": "postback-payload-1",
"text": "Postback action 1"
}
},
{
"postback": {
"payload": "postback-payload-2",
"text": "Postback action 2"
},
"type": "postback"
}
]
}
}
Multiple images message with reply actions
Copy {
"type": "image",
"image": {
"images": [
{
"altText": "First image label",
"mediaUrl": "https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdnJZeZvhOMhDQA8SpjQM%2Fuploads%2FrEM9zztd8SEiJS6RQuR3%2Fimage.png?alt=media"
},
{
"altText": "Second image label",
"mediaUrl": "https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdnJZeZvhOMhDQA8SpjQM%2Fuploads%2FRPPgQAGyZE7rvIh3WM2Z%2Fimage2.avif?alt=media"
}
],
"text": "Multiple images message with reply actions",
"actions": [
{
"type": "reply",
"reply": {
"text": "Reply action 1"
}
},
{
"reply": {
"text": "Reply action 2"
},
"type": "reply"
}
]
}
}
Multiple images message with labels, postback and reply actions
Copy {
"type": "image",
"image": {
"images": [
{
"altText": "First image label",
"mediaUrl": "https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdnJZeZvhOMhDQA8SpjQM%2Fuploads%2FrEM9zztd8SEiJS6RQuR3%2Fimage.png?alt=media"
},
{
"altText": "Second image label",
"mediaUrl": "https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdnJZeZvhOMhDQA8SpjQM%2Fuploads%2FRPPgQAGyZE7rvIh3WM2Z%2Fimage2.avif?alt=media"
}
],
"text": "Multiple images message with postback and reply actions",
"actions": [
{
"type": "postback",
"postback": {
"payload": "postback-payload",
"text": "Postback action"
}
},
{
"reply": {
"text": "Reply action"
},
"type": "reply"
}
]
}
}
File
Single file message
Copy {
"type": "file",
"file": {
"text": "Single file message",
"files": [
{
"contentType": "video/mp4",
"mediaUrl": "https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdnJZeZvhOMhDQA8SpjQM%2Fuploads%2FtXMQ4lIinia9ehf4EpC4%2Fvideo.mp4?alt=media"
}
]
}
}
Single file message with postback and reply actions
Copy {
"type": "file",
"file": {
"text": "Single file message",
"files": [
{
"contentType": "video/mp4",
"mediaUrl": "https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdnJZeZvhOMhDQA8SpjQM%2Fuploads%2FtXMQ4lIinia9ehf4EpC4%2Fvideo.mp4?alt=media"
}
],
"actions": [
{
"type": "postback",
"postback": {
"text": "Postback action"
}
},
{
"type": "reply",
"reply": {
"text": "Reply action"
}
}
]
}
}
Multiple files message
Copy {
"type": "file",
"file": {
"text": "Multiple files message",
"files": [
{
"contentType": "video/mp4",
"mediaUrl": "https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdnJZeZvhOMhDQA8SpjQM%2Fuploads%2FtXMQ4lIinia9ehf4EpC4%2Fvideo.mp4?alt=media"
},
{
"contentType": "application/pdf",
"mediaUrl": "https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdnJZeZvhOMhDQA8SpjQM%2Fuploads%2FPnRToYX2feW96HAOrh4x%2Fdocument.pdf?alt=media"
}
]
}
}
Multiple files message with filename
Copy {
"type": "file",
"file": {
"text": "Multiple files message",
"files": [
{
"contentType": "video/mp4",
"mediaUrl": "https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdnJZeZvhOMhDQA8SpjQM%2Fuploads%2FtXMQ4lIinia9ehf4EpC4%2Fvideo.mp4?alt=media"
},
{
"contentType": "application/pdf",
"mediaUrl": "https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdnJZeZvhOMhDQA8SpjQM%2Fuploads%2FPnRToYX2feW96HAOrh4x%2Fdocument.pdf?alt=media",
"filename": "passport.pdf"
}
]
}
}
Multiple files message with two postback actions and a reply action
Copy {
"type": "file",
"file": {
"text": "Multiple files message",
"files": [
{
"contentType": "video/mp4",
"mediaUrl": "https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdnJZeZvhOMhDQA8SpjQM%2Fuploads%2FtXMQ4lIinia9ehf4EpC4%2Fvideo.mp4?alt=media"
},
{
"contentType": "application/pdf",
"mediaUrl": "https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdnJZeZvhOMhDQA8SpjQM%2Fuploads%2FPnRToYX2feW96HAOrh4x%2Fdocument.pdf?alt=media",
"filename": "passport.pdf"
}
],
"actions": [
{
"type": "postback",
"postback": {
"text": "Postback action 1",
"payload": "postback-payload-1"
}
},
{
"type": "postback",
"postback": {
"text": "Postback action 2",
"payload": "postback-payload-2"
}
},
{
"type": "reply",
"reply": {
"text": "Reply action"
}
}
]
}
}
Location
Copy {
"type": "location",
"location": {
"coordinates": {
"latitude": 52.3435942,
"longitude": 4.9091077
},
"location": {
"address": "Trompenburgstraat 2C, 1079 TX Amsterdam",
"label": "MessageBird Amsterdam office"
}
}
}
List
List message without sections
Copy {
"type": "list",
"list": {
"items": [
{
"actions": [
{
"type": "postback",
"postback": {
"payload": "postback-action-payload-1",
"text": "Postback action 1"
}
},
{
"type": "postback",
"postback": {
"payload": "postback-action-payload-2",
"text": "Postback action 2"
}
}
]
}
],
"title": "List title",
"altText": "List alt text",
"text": "List text"
}
}
List message with sections
Copy {
"type": "list",
"list": {
"items": [
{
"title": "Section 1",
"actions": [
{
"type": "postback",
"postback": {
"payload": "postback-action-payload-1",
"text": "Postback action 1"
}
},
{
"type": "postback",
"postback": {
"payload": "postback-action-payload-2",
"text": "Postback action 2"
}
}
]
},
{
"title": "Section 2",
"actions": [
{
"type": "postback",
"postback": {
"payload": "postback-action-payload-3",
"text": "Postback action 3"
}
},
{
"type": "postback",
"postback": {
"payload": "postback-action-payload-4",
"text": "Postback action 4"
}
}
]
}
],
"title": "List title",
"altText": "List alt text",
"text": "List text"
}
}
List message with sections and custom button label
Copy {
"type": "list",
"list": {
"items": [
{
"title": "Section 1",
"actions": [
{
"type": "postback",
"postback": {
"payload": "postback-action-payload-1",
"text": "Postback action 1",
"metadata": {
"description": {
"label": "Postback action description 1"
}
}
}
},
{
"type": "postback",
"postback": {
"payload": "postback-action-payload-2",
"text": "Postback action 2",
"metadata": {
"description": {
"label": "Postback action description 2"
}
}
}
}
]
},
{
"title": "Section 2",
"actions": [
{
"type": "postback",
"postback": {
"payload": "postback-action-payload-3",
"text": "Postback action 3",
"metadata": {
"description": {
"label": "Postback action description 3"
}
}
}
},
{
"type": "postback",
"postback": {
"payload": "postback-action-payload-4",
"text": "Postback action 4",
"metadata": {
"description": {
"label": "Postback action description 4"
}
}
}
}
]
}
],
"title": "List title",
"altText": "List alt text",
"text": "List text",
"metadata": {
"button": {
"label": "Show options"
}
}
}
}
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"
Copy {
"receiver": {
"contacts": [
{
"identifierValue": "+31612345678"
}
]
},
"body": {...},
"replyTo": {
"id": "<recievedmessageid>",
"type": "message"
}
}
ReplyTo with a text message
Copy {
"type": "text",
"text": {
"text": "Single text message"
},
"replyTo": {
"id": "1e7b70ab-3dcc-48f4-a6f6-63a493f6134c",
"type": "message"
}
}
ReplyTo with an image message
Copy {
"type": "image",
"image": {
"images": [
{
"altText": "Label of first image",
"mediaUrl": "https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdnJZeZvhOMhDQA8SpjQM%2Fuploads%2FRPPgQAGyZE7rvIh3WM2Z%2Fimage2.avif?alt=media"
}
]
},
"replyTo": {
"id": "1e7b70ab-3dcc-48f4-a6f6-63a493f6134c",
"type": "message"
}
}
ReplyTo with text message with postback actions
Copy {
"type": "text",
"text": {
"text": "Single text message with postback actions",
"actions": [
{
"type": "postback",
"postback": {
"text": "Postback action 1",
"payload": "postback-payload-1"
}
},
{
"type": "postback",
"postback": {
"text": "Postback action 2",
"payload": "postback-payload-2"
}
}
]
},
"replyTo": {
"id": "1e7b70ab-3dcc-48f4-a6f6-63a493f6134c",
"type": "message"
}
}
Template
Copy {
"receiver": {
"contacts": [
{
"identifierValue": "+31612345678"
}
]
},
"template": {...}
}
Text template with variable
Copy { "projectId":"ce6a2fd6-b2fa-4f5a-a2cd-f3bd15883318",
"version":"latest",
"locale":"en",
"parameters":[
{
"type":"string",
"key":"name",
"value":"Robert"
}
]
}
Image template with button and variables
Copy { "projectId":"7b492653-450b-4e97-b5e4-3827868e7438",
"version":"latest",
"locale":"en",
"parameters":[
{
"type":"string",
"key":"imageURL",
"value":"https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdnJZeZvhOMhDQA8SpjQM%2Fuploads%2FRPPgQAGyZE7rvIh3WM2Z%2Fimage2.avif?alt=media"
}
]
}
Image with a variable in a button
Copy { "projectId":"6449eb42-dffb-41c2-81a1-7fd956d2e7a6",
"version":"e0e9190c-c3e7-4026-8fc3-d28a77aa1a52",
"locale":"en",
"parameters":[
{
"type":"string",
"key":"name",
"value":"Robert"
},
{
"type":"string",
"key":"url",
"value":"?campaignid=123456"
}
]
}