WhatsApp Message Types
There are various types of message content that can be sent to your users:
Text
{
type: "TEXT",
text: "Hello World!",
}
Property | Description | Required |
---|---|---|
type | TEXT | Y |
text | String; Limited to 2000 characters | Y |
Image
{
type: "IMAGE",
text: "I am Sanuker!",
url: "http://image.png",
}
Property | Description | Required |
---|---|---|
type | IMAGE | Y |
text | String; caption for WhatsApp | N |
url | URL of the image file | Y |
Tips:
- Image must be a valid image file format, including
.jpeg
and.png
- Maximum file size is 16MB
Audio
{
type: "AUDIO",
url: "http://audio.aac",
}
Property | Description | Required |
---|---|---|
type | AUDIO | Y |
url | URL of the audio file | Y |
Tips:
- Audio must be a valid audio file format, including
.aac
Video
{
type: "VIDEO",
url: "http://video.mp4",
}
Property | Description | Required |
---|---|---|
type | VIDEO | Y |
url | URL of the video file | Y |
Tips:
- Video must be a valid video file format, including
.mp4
- Maximum file size is 16MB
File
{
"type": "FILE",
"filename": "Test",
"url": "http://file.pdf",
"text": "test122344"
}
Property | Description | Required |
---|---|---|
type | FILE | Y |
url | URL of the file attachment | Y |
Tips:
- File must be a valid file format, including
.pdf
- Maximum file size is 16MB
Location
{
"type": "LOCATION",
"text": "ABC Company",
"address": "Room C, 1/F, DFG Building, 101 Rainbow Road",
"lat": 22.31586918460027,
"long": 114.20883121469535
}
Property | Description | Required |
---|---|---|
type | LOCATION | Y |
text | String; Name of location | N |
address | String; Addresso of Location | N |
lat | Latitude | Y |
long | Longitude | Y |
Contact
{
"type": "CONTACTS",
"contacts": [
{
"id": "YXpJfusT",
"name": {
"formatted_name": "John Lee",
"first_name": "John",
"last_name": "Lee",
"prefix": "Mr"
},
"addresses": [
{
"type": "work",
"city": "Hong Kong",
"street": "Rainbow Road 131, ABC Building"
}
],
"emails": [
{
"type": "work",
"email": "workmail123@gmail.com"
}
],
"phones": [
{
"type": "cell",
"phone": "+852 1234 5678"
}
],
"urls": [
{
"type": "work",
"url": "www.sanuker.com"
}
],
"org": {
"company": " Sanuker"
}
}
]
}
Property | Description | Required |
---|---|---|
name | String; name of contact | Y |
address | String; contact address | N |
birthday | String; date | N |
emails | String; email address | N |
org | String; company name | N |
phones | String; phone number | N |
urls | String; url | N |
Each object in Contact
contains one or multiple optional parameters, you can refer to here for details.
Interactive Messages
Interactive Messages allow the users to response quickly by providing buttons to click on. Users cannot select more than one option at the same time from a list or button message, but they can go back and re-open a previous message.
List Messages
{
"type": "WHATSAPP_LIST",
"header": {
"type": "text",
"text": "Hello 👋🏻"
},
"body": {
"text": "Sanuker provides chatbot solutions."
},
"footer": {
"text": "Facebook and WhatsApp Official Business Partner"
},
"action": {
"button": "Menu",
"sections": [
{
"title": "section title",
"rows": [
{
"payload": "GREETINGS",
"title": "Main Menu",
"description": "Hello!"
},
{
"payload": "ABOUT_SANUKER",
"title": "About Sanuker",
"description": "Who are you?"
}
]
}
]
}
}
Property | Description | Required? |
---|---|---|
Header | The header of your list message; It can be a text or media: "Image", "Video", "Document" | N |
Body | The body content of the message (Maximum of 1024 characters) | Y |
Footer | The footer content (Maximum of 60 characters) | N |
Action | Inside action, you must nest: - a button field with your button’s content, and - at least one section object (maximum of 10) Inside section, you must add at least one rows object | Y |
action
Object
Property | Description | Required? |
---|---|---|
button | Button content. It cannot be an empty string and must be unique within the message (Maximum of 20 characters) | Y |
sections | Array of section objects. There is a minimum of 1 and maximum of 10 | Y |
section
Object
Property | Description | Required? |
---|---|---|
title | Title of the section | Y (if the message has more than one section.) |
rows | Contains a list of rows. Each row must have a title and an ID. You can add a description, but it is optional | Y |
Reply Buttons
{
"type": "WHATSAPP_REPLY_BUTTONS",
"header": {
"type": "image",
"image": {
"id": "2e5a7aad-e8c7-43ba-ad5e-b298bb32f8af"
}
},
"body": {
"text": "Sanuker provides chatbot solutions."
},
"footer": {
"text": "Facebook and WhatsApp Official Business Partner"
},
"action": {
"buttons": [
{
"type": "reply",
"reply": {
"payload": "GREETINGS",
"title": "Main Menu"
}
},
{
"type": "reply",
"reply": {
"payload": "ABOUT_SANUKER",
"title": "About Sanuker"
}
}
]
}
}
Property | Description | Required |
---|---|---|
Header | The header of your list message; It can be a text or media: "Image", "Video", "Document" | N |
Body | The body content of the message (Maximum of 1024 characters) | Y |
Footer | The footer content (Maximum of 60 characters) | N |
Action | You must add at least one button, and include type and title.You cannot add more than 3 buttons | Y |
action
Object
Property | Description | Required? |
---|---|---|
buttons | A button can contain the following parameters: type: only supported type is reply (for Reply Button Messages) title: Button title. It cannot be an empty string and must be unique within the message (Maximum of 20 characters) | Y |
Single Product Message
"type": "WHATSAPP_PRODUCT",
"body": {
"text": "Check out our Bag of the Day"
},
"action": {
"catalogId": "4928452840550143",
"productId": "03-Pack"
}
Property | Description | Required |
---|---|---|
body | The body content of the message (Maximum of 1024 characters) | N |
footer | The footer content (Maximum of 60 characters) | N |
action | Must contain - catalogId : an ID for the catalog you want to use for this message. Retrieve this ID via Commerce Manager. - productId : a product’s unique identifier (Content ID). | Y |
Multi Product Message
Multi-Product Message can only contain a selection of up to 30 products from the inventory.
{
"type": "WHATSAPP_PRODUCT_LIST",
"header": {
"type": "text",
"text": "Fall Collection"
},
"body": {
"text": "Click view items to see our Fall Collection"
},
"action": {
"catalogId": "4928452840550143",
"sections": [
{
"title": "Urban Essentials",
"productIds": [
"01-Pack",
"02-Bag"
]
},
{
"title": "Hiking Essentials",
"productIds": [
"03-Pack"
]
}
]
}
}
Property | Description | Required |
---|---|---|
header | type must be text . Contain a text object with the desired content | Y |
body | The footer content (Maximum of 1024 characters) | Y |
footer | The footer content (Maximum of 60 characters) | N |
action | Must contain - catalogId : an ID for the catalog you want to use for this message. Retrieve this ID via Commerce Manager - sections : Array of section objects. You must include at least one section | Y |
sections
field
Property | Description | Required |
---|---|---|
title | a title for each section | Y |
productIds | product’s unique identifier (Content ID) | Y |
WhatsApp Message Template
{
"type": "TEMPLATE",
"components": [
{
"parameters": [
{
"image": {
"id": "57ec1287-6915-4a44-8dc9-9caa620385e1"
},
"type": "image"
}
],
"type": "header"
},
{
"type": "button",
"sub_type": "quick_reply",
"index": "0",
"parameters": [
{
"type": "payload",
"payload": "Contact Sanuker"
}
]
},
{
"type": "button",
"sub_type": "quick_reply",
"index": "1",
"parameters": [
{
"type": "payload",
"payload": "GREETINGS"
}
]
},
{
"type": "button",
"sub_type": "quick_reply",
"index": "2",
"parameters": [
{
"type": "payload",
"payload": "ABOUT_SANUKER"
}
]
}
],
"languagePolicy": "deterministic",
"languageCode": "en",
"namespace": "bc3ac5dd_6dfd_2345_d5f7_123456789bf",
"elementName": "multiple_button_test_1",
"accountId": "1234567890"
}
Please note that the
components
field is required, otherwise, the response cannot be sent out while usingsendResponses
of Bot API
Template Details
Property | Description | Required? |
---|---|---|
Name | Can only contain lowercase alphanumeric characters and underscores ( _ ); No other characters or white space are allowed | Y |
Category | Select the correct category of your template; See list of supported categories | Y |
Language | Select the correct language of your template; The template name will be the same for all translations; You will specify the language field when sending out the template; See list of supported languages | Y |
Content | The content of your message template; Support parameter placeholders in the format of {{1}} | Y |
Header | The header of your message template; It can be a text or media: "Image", "Video", "Document" | N |
Body | The body of your message template (Character Limit: 1024) | Y |
Footer | The text footer of your message template | N |
Buttons | The button(s) of your message template; Call-to-action or Quick Reply; 3 buttons max. | N |
Maximum Character Limit
Property | Character Limit |
---|---|
Body (Without Header/Footer) | Up to 1024 characters |
Body (With Header/Footer) | Up to 1024 characters |
Header | 60 characters |
Footer | 60 characters |
Please note that, within a WhatsApp Message Template, the character limit does not apply to the varaiable.
Setup Procedure
- Open "Response Builder" and choose the response type "WhatsApp Message Template".
Choose any existing "Message Template". Please make sure your have completed the Message Template Submission process in order to view your existing message templates.
Set the Language Policy as Deterministic.
Choose the Language of your Message Template.
- Please see the optional settings below:
- Add payload if your Message Template has a Quick Reply button.
- Add Media ID or url if your Header has multimedia files like image or video.