Generate a URL that has variables from user answers

Pau Sanchez Updated by Pau Sanchez

It can happen that at the end of the flow you want redirect your clients to a specific website. It can be also the case that you want to generate a URL with the values provided by the users and that your website can adapt the content and design according to these values.

Let's say, for example, that you have a shop and want to redirect the users to your website; in the bot you have already asked for their favourite colour (blue) and gender (female). So the url that you want to generate will be something like this: www.myshop.com/models?color=blue&gender=female

Here is a step by step guide DEMO on how to build redirect urls with user variables.

The flow in the builder is shown below:

  1. First, we need to store any user value in a variable, in this case we will store it a variable called "@query"

  1. To build the url, we will use an Ask A Question block with 1 button.

We will set up the button as a Link:

  1. To build the URL, we will add the variable @query, as below:

https://www.google.com/search?q=@{query}

As you can see, to add the @query as a variable we did like this: @{query}. It's important to follow the order: @{THENAMEOFTHEVARIABLE}

These scripts and how to's are not native functionalities. Landbot won't be able to support, help or guarantee these scripts and how to's. These Workarounds and How to's are for developers, as a learning and example material on how to extend or modify some of the platform limitations.  Due to platform updates, some scripts might stop working in the future.Please, note that in case of Scripts and Workaround the Custom Success Team can deliver limited support.

How did we do?

Set the flow depending on the url path (for embedded landbots)

Resume flow based on external process with Landbot API (Request, Set, Go)

Contact