Rate this page:

Function for adding buttons to a WhatsApp chat

In this example, you will create a function for adding buttons to a WhatsApp chat and route customer messages to this function. It saves time when you need to get a quick answer from a customer, for example, Yes or No.

The supported WhatsApp button type is QUICK_REPLY.

In the example below, you will add two quick reply buttons to a WhatsApp chat.

Let us assume that a customer writes to a tour operator’s chat to find a suitable vacation option. After a welcome message, the bot prompts the customer to select a tour or contact an agent.

  1. Send a request to the Voximplant Kit team to create you a WhatsApp channel.
  2. Go to Administration > Functions > Management.
  3. Click New function.
New function
  1. Copy the following code and paste it into the function.
Function for adding buttons to WhatsApp

Function for adding buttons to WhatsApp

  1. Click Create.
Add function
  1. Go to Setup > Conversations > Channels and select the WhatsApp channel.
  2. Select Functions in the Redirect channel messages field.
  3. From the drop-down list, select the function you added earlier.
Route messages to the function
  1. Click Save changes.
Buttons

The button options offered to the customer or the selected option then display in the History > Messaging history and Reporting > Live monitoring > Conversations sections.