WhatsApp - How to capture and use the first user's interaction (input)

Pau Sanchez Updated by Pau Sanchez

In some cases, we don't want to ask something when we start a bot.

We might need to start right away depending on what the user is texting.

In new WhatsApp bots, you will see the User Input block as the first block of the flow. It captures the first user's input and stores it in the variable.

For more information about the User Input block, please check here.

To do so, here are the steps:

  1. Delete the Welcome Message that is placed by default. You will see a space to click and add a new block after you do that:

  1. Place a Set Variable block as the first block:

  1. The first block where it starts the bot should be a Set Variable block, where we are going to create the variable @init with the value of ${body}, as is in the picture below:
    @init = ${body}

Doing this, you will store the first message sent by the user, which will be available in the variable @init in case you need to access or use it later.

  1. You can also use the variable @init directly in the next block.

For example, using a Keyword Jump block to redirect the user according to our needs, or using a webhook:

How did we do?

Types of Content and Media you can use in WhatsApp πŸ–Ό

WhatsApp - How to direct a user through a different bot flow on their second visit

Contact