Table of Contents

How to direct a user through a different bot flow on their second visit (for WhatsApp/Messenger)

Xandro Lopez Updated by Xandro Lopez

Second Visit in Whatsapp/Messenger bots

Our bots for Whatsapp/Messenger always continue the conversation until it reaches the end of the flow.

Once the last block is reached, if the user sends any message, the bot will be triggered, and will start again from its first block.

So if you do not define a second flow for the users that return to your bot (or restarts the bot), they would answer the same questions every time they interact with your bot.

If you want to prevent this behaviour, you can define a second flow for returning visitors, following some simple steps πŸ˜‰

Capture the user's first interaction

This step is very simple, you can read more about it in the How to capture and use the first user's interaction (input) in Whatsapp/Messenger article.

Create a "Set Variable" block and edit it so that it looks like it does below:

Set a Condition

The next thing we want to do is add a "Conditions block" where we will verify if this is the user's first time interacting with the bot.

We created the variable @qualification but feel free to use a variable you feel comfortable with and set it up as shown in the picture:

User's first visit

If this is the user's first time interacting with the bot, the variable will have no value yet, so we will connect the red output (false) to the qualifying questions flow.

At the end of the flow, add a "Set Variable block". We will use this block to give the @qualification variable a value.

In this case @qualification = yes

User's second or following visits

Since we gave the @qualification variable a value, the next time the user interacts with the bot it will recognize this and the flow will continue through the green exit every time.

Connect the green output (true) to the second visit flow.

How did we do?

How to capture and use the first user's interaction (input) in Whatsapp/Messenger

Unblock user of error message loop and redirect to restart bot (Whatsapp)

Contact