{"id":4527,"date":"2023-06-06T16:06:48","date_gmt":"2023-06-06T14:06:48","guid":{"rendered":"https:\/\/botnation.ai\/initialize-your-chatbots-variables-with-data-from-your-website\/"},"modified":"2026-01-02T15:28:33","modified_gmt":"2026-01-02T14:28:33","slug":"initialize-your-chatbots-variables-with-data-from-your-website","status":"publish","type":"support","link":"https:\/\/botnation.ai\/en\/support\/initialize-your-chatbots-variables-with-data-from-your-website\/","title":{"rendered":"Initialize your Chatbot&#8217;s variables with data from your website"},"content":{"rendered":"<p>This article explains how to initialize your Chatbot\u2019s variables with data from your website.<\/p>\n\n\n\n<p>To begin with, I invite you to take a look at the following documentation to learn how to <a href=\"https:\/\/botnation.ai\/en\/how-to-install-my-chatbot-on-my-website-2\/\" target=\"_blank\" rel=\"noreferrer noopener\">install your Chatbot on your website<\/a>. If your Chatbot is already installed, this step is not necessary.<\/p>\n\n\n\n<p>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.<\/p>\n\n\n\n<p>To do this, add the <strong>externalDatas<\/strong> property as shown below:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">window.chatboxSettings = {<br>appKey: 'XXXXXXXX',<br>websiteId: 'XXXXXX',<br>language: 'fr',<br>externalDatas: {<br>  maVariable1: 'mavalue',<br>  myVariable2: 2<br>}<br>};<\/pre>\n\n\n\n<p>In this example, we have created 2 variables:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>myVariable1<\/strong> which takes the value \u2018myvalue\u2019.<\/li>\n\n\n\n<li><strong>myVariable2<\/strong> which takes the value 2<\/li>\n<\/ul>\n\n\n\n<p>Then you just have to declare them in your Chatbot under Settings &gt; Advanced Settings &gt; External Variables<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img fetchpriority=\"high\" decoding=\"async\" src=\"https:\/\/botnation.ai\/wp-content\/uploads\/2023\/06\/image-1-1024x296.png.webp\" alt=\"\" class=\"wp-image-4545\" width=\"642\" height=\"185\"><\/figure>\n<\/div>\n\n\n<p>You can then inject these variables into your texts \/ conditions.<\/p>\n\n\n\n<p><strong>Plus: <\/strong><br>\u2013 <a href=\"https:\/\/botnation.ai\/en\/how-to-install-my-chatbot-on-my-website\/\">How to install my chatbot on my website<\/a><br>\u2013 <a href=\"https:\/\/botnation.ai\/en\/find-out-more-about-the-chatbots-external-variables-externaldatas\/\">Find out more about the chatbot\u2019s external variables: externalDatas<\/a><br>\u2013 <a href=\"https:\/\/botnation.ai\/en\/all-about-variables\/\">Learn all about {{\u2026}} variables<\/a><\/p>\n\n\n","protected":false},"featured_media":0,"template":"","meta":{"_acf_changed":false},"categorie-support":[198,222,221],"class_list":["post-4527","support","type-support","status-publish","hentry","categorie-support-tutorials","categorie-support-variables-en","categorie-support-web-chatbot-en"],"acf":[],"_links":{"self":[{"href":"https:\/\/botnation.ai\/en\/wp-json\/wp\/v2\/support\/4527","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/botnation.ai\/en\/wp-json\/wp\/v2\/support"}],"about":[{"href":"https:\/\/botnation.ai\/en\/wp-json\/wp\/v2\/types\/support"}],"wp:attachment":[{"href":"https:\/\/botnation.ai\/en\/wp-json\/wp\/v2\/media?parent=4527"}],"wp:term":[{"taxonomy":"categorie-support","embeddable":true,"href":"https:\/\/botnation.ai\/en\/wp-json\/wp\/v2\/categorie-support?post=4527"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}