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.
- Send a request to the Voximplant Kit team to create you a WhatsApp channel.
- Go to Administration > Functions > Management.
- Click New function.

- Copy the following code and paste it into the function.
- Click Create.

- Go to Setup > Conversations > Channels and select the WhatsApp channel.
- Select Functions in the Redirect channel messages field.
- From the drop-down list, select the function you added earlier.

- Click Save changes.

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