Add data from URL parameters inside a conversation

Add data from URL parameters inside a conversation

The data from URL parameters can be added to the chatbot conversation, by following the steps given

Add URL parameters in Settings

Let's say your URL is

https://yourwebsite.com/?name=amy&location=newyork

Go to your Settings > General of your Bot and provide these keys as custom fields. Here you will be adding two keys, name and location.

Once they are defined in the Settings, the chatbot will be able to pick it up. You will be able to see these URL parameters in the Response section as well as in the email notifications.

Add URL parameters as variables

Once you add them as custom fields, the chatbot will be able to use them as variables. Goto Build > Script and use the '@' symbol to add them at the respective places.

Once the parameters are added as variables, your script will look like:

And the chatbot will able to replace the variables with data present in the URL.

Tip

In case, the parameter is missing, the variable will become NULL and the chatbot will not display anything else in its place. So, we recommend to structure your sentence in a way that the variable appears at the end of a sentence.

Test the chatbot

Try having a conversation with your chatbot on your website. Make sure to pass the necessary parameters in the URL while doing so.

Note

This method will work when the chatbot is used in widget mode and when used as chatbot page. If you are embedding the chatbot as an iframe, the chatbot will not be able to read the URL parameters; therefore it will not work in embed mode.



Still need help?

Contact us

Customize