To add data from URL parameters to a chatbot conversation, follow these steps:
Add URL parameters in Settings
Let's say your URL is
https://yourwebsite.com/?name=amy&location=newyork
Go to Settings of your chatbot, then click on Data Collection. Click on add custom field button to collect custom data.
In this example, you will be adding two keys as per custom field; name and location.
Once these keys are defined in the custom fields, the chatbot will be able to pick them up. You will be able to see these URL parameters in the Response section as well as in the email notifications and in the webhook.
Add URL parameters as variables
Once you add these URL parameters as custom fields, the chatbot will be able to use them as variables.
Go to Questions and use the @ symbol to add them at the respective places.
Once the parameters are added as variables, you will easily identify them highlighted in green.
And your chatbot will replace the variables with the data present in the URL.
Tip
In the case that a parameter is missing, the variable will become NULL and the chatbot will not display anything else in its place. Therefore we recommend to structure your sentence in a way that the variable appears at the end of a sentence.
Test the chatbot
Have a conversation with your chatbot on your website to see how variables align with the sentence structure. 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 a 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