Recognise the users input when sending a Message Template with buttons

Ana Updated by Ana

Hello! 👋

In this article, we are going to see how to capture from a WhatsApp bot the response that users give to a Message Template with buttons.

Now, let's imagine that you send a template through a Campaign with these buttons to remind your customers of the call they have scheduled.

So, how do we capture the user's response when they reply to our Message Template by clicking on one of the buttons?

Steps to follow

  1. You will need to create a specific WhatsApp bot for this, for example with flow like this:
  2. We first need to add the Collect intent block, with this block we will save the user's response inside the @user_input variable, which in this case should be either 'Rescheduled' or 'Perfect, see you there!', or if the user decides to ignore the buttons and just reply with random text, it will be stored inside this variable as well.
  1. Now, we will connect the Conditions block that will first check if the @user_input contains the word 'Scheduled', so If the user pressed the Reschedule button, the flow will continue through the green arrow of this Conditions block. Otherwise, the flow will continue through the red arrow.
  1. In the second Conditions block we will check if the user pressed the 'Perfect, see you there' button, and if they had, the green output will be connected to the message or action you want to trigger for this case, and if not, it will follow the red output.
  1. The red output that we connect to the second Conditions block will be the flow that we want to show to the user in case they didn't reply to our Message Template with one of the buttons and instead they wrote something else. On this example we have used the Jump to block that will send the user back to the main bot connected to our WhatsApp channel, but it's up to you to trigger the action you want!
Also, if you're not familiar with the use of the Collect intent block, please read the full article here. Same for Conditions block here and Jump to block here.

  1. Now you can go ahead and link this bot to your Campaign!

If you triggered the Campaign from the Campaign section on Landbot, just add the bot on the Campaigns > Automation section of your WhatsApp channel:

⚠️ Extra step when sending the Template via API

Campaigns cannot be triggered via API, but you can send Templates via API, please check this article that explains how to do it.

If you launched the Template via API, just right after it you will need to make an Assign Bot request to prevent the chat from being assigned to an agent, which would block the execution of the bot.

Please, check our API docs to know how to do it.

How did we do?

Creating a Loop in WhatsApp

Trigger Event if User Abandons Chat

Contact