Initialize your Chatbot’s variables with data from your website

This article explains how to initialize your Chatbot’s variables with data from your website.

To begin with, I invite you to take a look at the following documentation to learn how to install your Chatbot on your website. If your Chatbot is already installed, this step is not necessary.

The Javascript code you insert on your website can be modified as you wish. This allows you to add variables that will be interpreted by your Chatbot.

To do this, add the externalDatas property as shown below:

window.chatboxSettings = {
appKey: 'XXXXXXXX',
websiteId: 'XXXXXX',
language: 'fr',
externalDatas: {
maVariable1: 'mavalue',
myVariable2: 2

In this example, we have created 2 variables:

  • myVariable1 which takes the value ‘myvalue’.
  • myVariable2 which takes the value 2

Then you just have to declare them in your Chatbot under Settings > Advanced Settings > External Variables

You can then inject these variables into your texts / conditions.

How to install my chatbot on my website
Find out more about the chatbot’s external variables: externalDatas
Learn all about {{…}} variables

➜ Discover Botnation and launch your chatbot easily!