Table of Contents

How to ask a question based on a variable not being set (empty URL params)

Pau Sanchez Updated by Pau Sanchez

For Landbot (Web)

Sometimes, we send users to our bots and using the Hidden Fields functionality, which reads variables in the URL, we can populate with values many variables in our bot, without needing to ask the user any more about those questions.

However, for some reason it could be that one parameter in the url is empty, it could be that is missing in our CRM, so we don't have valuable information and we need to ask it again, just if we don't have such value.( i.e if no phone number, ask to enter phone number) and maybe send it to our CRM.

Here will show how to make the bot spot when the value is missing and how to redirect the user to a flow, where we ask for this information.

For this example we are going to set up the following flow:

Here, what we are doing, after a welcome message is to check, whether we collected the @phone value in the url or not.

The condition to check and redirect the flow is a Conditional block, that checks if the @phone is set (green output) or not (red output)

Also, we previously set up the Hidden Fields settings to catch the value of @phone from the URL

So, if we have a URL like this: https://landbot.io/u/H-128508-D3ZDNDFXH0OU4G08/index.html or like this https://landbot.io/u/H-128508-D3ZDNDFXH0OU4G08/index.html?phone=&name=landbot , where the parameter phone is not set, the bot will ask for the phone.

If the link is like this: https://landbot.io/u/H-128508-D3ZDNDFXH0OU4G08/index.html?phone=897398172389712 the bot will capture "897398172389712" as the @phone variable and won't ask the user to add it again.

Bear in mind, that during testings if you don't change the browser or clear the storage, once the phone variable is set, it will show up, even if it's not in the URL

For WhatsApp

This block is not compatible with WhatsApp botsΒ 

For Facebook Messenger

This block is not compatible with Messenger botsΒ 

How did we do?

Conditions block II (with Dates, Usage and Agents variables)

Contact