Sending WhatsApp Interactive Buttons

Currently this feature is available only through API.

Introduction

WhatsApp recently introduced interactive buttons for WhatsApp Templates (HSM) and this allows businesses to send up to 3 quick replies and 1 Website & 1 Phone number as Call to Action along with the Text, Image, Document & Video Templates

Below examples show the different type of interactive buttons available with WhatsApp Templates;

Quick Replies

Quick replies can have up to 3 buttons and can be used with text, image, document, video templates

Call 2 Action

With the help of Call to Action businesses can redirect the user to a URL or Dial a Phone Number and it has two types of buttons as shown below;

  1. URL

  2. Phone Number

URL

URL allows you to dynamically pass a variable at the end of the URL like https://pickyassist.com/app/buttons/{{1}} and this helps you to redirect the users to a website or order tracking page appending the order reference number or any other values.

Phone Number

This helps users to take action by clicking the button and it will dial the phone number.

Please note except the URL Dynamic variable you are not allowed to change the button text once the template is approved, i.e you need to provide all the button text and call to action URL & Contact number while requesting the templates.

Maximum 20 characters are allowed in the button name and no emoji support, you need to request the button name while requesting the template and itโ€™s not possible to change while sending the messages

Payload

This is a new variable โ€œpayloadโ€ available in the Push API & Webhook in order track the quick reply button clicks, i.e when you send a message with interactive buttons and when the user clicked the button you will get the payload passed by you in the webhook , you can pass separate payload for each button to make the user reply tracking easier.

โ€‹

Please note passing payload is only supported for sending WhatsApp templates with Quick Replies

Payload needs to be passed as per the position of the approved quick replies buttons.

API Variables

Below are the API Variables related only to the interactive templates, for a complete list of API Variables please refer here โ€‹

Variable Name

Type

Description

payload

array

You can pass a custom payload like a reference number for each button in the quick replies, this is an array and optional

โ€‹

This payload will return in the Webhook when the user click on the button

โ€‹

It's possible to pass dynamic payload for each number separately while sending messages, refer the example below

interactive_globalbuttons

array

This is applicable only for the Call to Action URL and used for sending dynamic variables that should be replaced in the dynamic URL button. Mandatory if button type is url and interactive_buttons is empty.

โ€‹

If the URL variable is dynamic in nature (personalise for each number) then you need to pass the dynamic value against each number through interactive_buttons

interactive_buttons

array

This is applicable only for the Call to Action URL and used for sending dynamic variables that should be replaced in the dynamic URL button. This is used to pass personalised variable for each number dynamically and this is optional if interactive_globalbuttons is not empty

โ€‹

Sample API Request for Sending Quick Reply along with a Text Template

You can use the quick reply along with Text, Image, Document & Video Templates, need to request the template accordingly

Please mind the payload value position in the array as it should be in the same order as how your buttons appears in the messages. You can pass payload dynamically for each number or can pass static payload for all messages in the push. To pass dynamically include the *payload* inside the data array, to globally use pass the payload outside the data array

Sample for Dynamic Payload Passing for Each Number

{
"token": "{{token}}",
"application": "8",
"template_id": "PQ112360",
"data": [
{
"number": "91940055074",
"payload":
[
"confirmbtn",
"cancelbtn",
"notsurebtn"
],
"template_message": [
"*James*",
"*Consulatation*",
"*Dr Daniel*",
"*Confirmed*",
"*27, Feb 2021 @ 2 PM*",
"Picky Assist"
],
"language": "en"
}
]
}
โ€‹

Passing Static Payload for all numbers in the Push

{
"token": "#TOKEN#",
"application": "8",
"template_id": "PQ112360",
"payload": [
"confirmbtn",
"cancelbtn",
"notsurebtn"
],
"data": [
{
"number": "91940055074",
"template_message": [
"11",
"22",
"33",
"44",
"55",
"66"
],
"language": "en"
}
]
}
โ€‹

Sample API Request for Sending Call to Action URL along with an Image Template

It's possible to pass dynamic variable for the Call to Action URL for each number. For Dynamic use "interactive_buttons" array inside the data and for global use "interactive_globalbuttons"

{
"token": "token",
"application": 8,
"template_id": "PB18600",
"template_globalmessage": [
"abc",
"111",
"222",
"333",
"444",
"Picky"
],
"language": "en",
"globalmedia": "https://pickyassist.com/img/social-messaging.png",
"interactive_globalbuttons": [
"123"
],
"data": [
{
"number": "91940055074",
"message": "",
"interactive_buttons": [
"123"
]
}
]
}
โ€‹

Sample API Request for Sending Call To Action URL & Website in a Text Template

It's possible to pass a dynamic variable for the Call to Action URL for each number or can pass a static value for all numbers in a push. For Dynamic use "interactive_buttons" array inside the data and for global use "interactive_globalbuttons"

Sending Dynamic Message with each Mobile Number for Call to Action URL

{
"token": "{{token}}",
"application": 8,
"template_id": "GQ113728",
"language": "en",
"data": [
{
"number": "91940055074",
"template_message":[
"*Daniel*",
"*Iphone 12 Pro Max*"
],
"interactive_buttons":
[
"123"
]
}
]
}
โ€‹

Sending Static Payload for all numbers in a push.

{
"token": "{{token}}",
"application": 8,
"template_id": "GQ113728",
"language": "en",
"interactive_globalbuttons":
[
"123"
],
"data": [
{
"number": "91940055074",
"template_message":[
"*Daniel*",
"*Iphone 12 Pro Max*"
]
}
]
}
โ€‹

Sample Response JSON

You can use the *msg_id* to get the message context in the webhook if the user replies to your messages using quoted reply;

{
"status": 100,
"push_id": "26296089",
"message": "Success",
"data": [
{
"msg_id": "30793156",
"number": "91940055074",
"credit": 0.0044688
}
]
}

Frequently Asked Questions

Is it possible to generate the quick replies button dynamically as per the situation?

No, you are allowed to use only approved templates on your WhatsApp Official Number, once the quick reply buttons are approved by WhatsApp it's not possible to change the button name or its position, however while sending the message you will have the option to pass your own custom payload for each button and the same will be pushed back to your server when the user clicks on the buttons. Read More โ€‹

Is it possible to change the Call to Action URL dynamically?

The base url can't be changed once its approved however you will have an option to dynamically pass the value through variable like https://pickyassist.com/t/{{1}} can be replaced with https://pickyassist.com/t/order-id12334565

Can I use the existing approved templates by adding only buttons?

No, you can't use the existing templates with buttons however you can request a new template with the same message body along with the quick replies or call to action button as per your business requirements.

Are WhatsApp Buttons supports in all template types?

Yes, Buttons can be used with all type of template types i.e Text, Image, Video & Document (PDF)

Is there any extra cost for sending WhatsApp Interactive Templates?

No, the cost is the same for the template messages as per the designation country.

How can I request the WhatsApp Interactive Templates?

You can request new templates using the WhatsApp Template Request API, currently it's not possible to request the template from our platform, you can also use our Postman Collection to ease this process.

Can I send the WhatsApp Interaction buttons through Session Messages?

Yes, if the 24 hours session window is active against the user then you will able to send the WhatsApp Interaction button and it won't be billed as per the destination country charges still counted as session messages and billed as per your plan.

How do know which user and which button is clicked?

While sending a message you will have the option to pass a custom payload for each button and when the user clicked on the button you will get the payload you passed along with the message context id. Read Moreโ€‹

Can I change the buttons order/position while sending messages?

No, button order can't be changed while sending messages, so please make sure that you have passed the correct position while requesting a template.

Is it possible to track the clicks on the Call to Action buttons?

No, when a user clicks on the call to action button it redirects the user either into a webpage or dials a number as per the button type they clicked, so it's not possible to get the click reports for Call to Action button type.

Is it possible to change the phone number in the Call to Action Phone Number?

No, once the button is approved it's not possible to change the value in the Call to Action Phone number button, so please request a new template with a new number.

Is it possible to send Quick Replies & Call to Action Button together in a message?

No, only one button type can be passed through a single message.

How many buttons are available in Quick replies?

You can request upto 3 buttons and each button name can have upto 20 characters with no emoji support.

How many buttons are available in Call to Action?

In the Call to Action you can pass upto 2 buttons i.e URL & Phone number.

Is it possible to request a template with 2 URL buttons?

No, only one URL button is allowed in a template however if you use you can add a phone number button as well.

What happens when the user clicks on the Phone Number Button?

The number which you set for the button will be dialed from the user phone.

I have a template approved with 3 quick replies, can I dynamically hide 1 button based on my situation?

No, it's not possible to dynamically hide buttons.

Are all languages supported as button text?

Yes, you can pass button name in any language WhatsApp supports in templates, make sure your select the correct language while requesting the templates.

If a user clicks twice on a button what will happen?

When a user is interacting with a quick reply once the user clicked the clicked button becomes inactive which preventing users from clicking it again however for Call to Actions URL & Phone Number buttons can be clicked anytime and buttons won't get disabled.

Will the user able to forward the interaction button messages?

Yes, they can forward but the buttons will not be sent when forwarding i.e only body text will be sent.

Are the buttons displays on WhatsApp Web / Desktop App as well?

Yes, buttons will display in WhatsApp Web / Desktop App as well.

Still, Questions feel free to send an email to [email protected]

Contents
Introduction
Quick Replies
Call 2 Action
Payload
API Variables
Sample API Request for Sending Quick Reply along with a Text Template
Sample for Dynamic Payload Passing for Each Number
Passing Static Payload for all numbers in the Push
Sample API Request for Sending Call to Action URL along with an Image Template
Sample API Request for Sending Call To Action URL & Website in a Text Template
Sending Dynamic Message with each Mobile Number for Call to Action URL
Sending Static Payload for all numbers in a push.
Sample Response JSON
Frequently Asked Questions
Is it possible to generate the quick replies button dynamically as per the situation?
Is it possible to change the Call to Action URL dynamically?
Can I use the existing approved templates by adding only buttons?
Are WhatsApp Buttons supports in all template types?
Is there any extra cost for sending WhatsApp Interactive Templates?
How can I request the WhatsApp Interactive Templates?
Can I send the WhatsApp Interaction buttons through Session Messages?
How do know which user and which button is clicked?
Can I change the buttons order/position while sending messages?
Is it possible to track the clicks on the Call to Action buttons?
Is it possible to change the phone number in the Call to Action Phone Number?
Is it possible to send Quick Replies & Call to Action Button together in a message?
How many buttons are available in Quick replies?
How many buttons are available in Call to Action?
Is it possible to request a template with 2 URL buttons?
What happens when the user clicks on the Phone Number Button?
I have a template approved with 3 quick replies, can I dynamically hide 1 button based on my situation?
Are all languages supported as button text?
If a user clicks twice on a button what will happen?
Will the user able to forward the interaction button messages?
Are the buttons displays on WhatsApp Web / Desktop App as well?