{"id":13096,"date":"2026-01-06T17:02:02","date_gmt":"2026-01-06T16:02:02","guid":{"rendered":"https:\/\/botnation.ai\/support\/all-about-variables-2\/"},"modified":"2026-02-19T11:00:03","modified_gmt":"2026-02-19T10:00:03","slug":"all-about-variables","status":"publish","type":"support","link":"https:\/\/botnation.ai\/en\/support\/all-about-variables\/","title":{"rendered":"All about {{&#8230;}} variables"},"content":{"rendered":"<p>A variable is a powerful tool to dynamically customize your chatbot and collect data.<\/p>\n\n<h2 class=\"wp-block-heading\">1. What is a variable?<\/h2>\n\n<p>A variable is a text symbol, in the form {{Variable}}, which associates a value with this symbol. This value can be either a text or a number, such as an address, a vehicle model, a telephone number or a quantity. <\/p>\n\n<p>This value is dynamic and can change as many times as you want depending on the use of your chatbot.<\/p>\n\n<p>Moreover, each variable is unique to each user of your chatbot, so two users can use variables with the same symbol, {{le_choix}}, but whose content will be different because they have neither the same model of vehicle, nor the same phone number.<\/p>\n\n<p>Variables have no lifespan: they are stored in Botnation\u2019s databases for as long as your chatbot is active on the platform, with no limit on their number or use. A user who only consults your chatbot once a month will still find the variables that enable you to personalize its use. <\/p>\n\n<h2 class=\"wp-block-heading\">2. System variables<\/h2>\n\n<p>As soon as the user initiates a conversation with the chatbot, the latter will retrieve any information available from the user and store it in the value of system variables.<\/p>\n\n<p><strong>To personalize the user\u2019s Facebook Messenger conversation:<\/strong><\/p>\n\n<ul class=\"wp-block-list\">\n<li>First name: {{FIRSTNAME}} <\/li>\n\n\n\n<li>The name: {{LASTNAME}}<\/li>\n\n\n\n<li>Sex: {{GENDER}}<\/li>\n\n\n\n<li>Language: {{LANGUAGE}} <a href=\"https:\/\/botnation.ai\/en\/support\/the-list-of-values-returned-by-the-variable-language-3\/\">(list of returned codes)<\/a><\/li>\n\n\n\n<li>The unique user ID: {{USER_ID}}<\/li>\n\n\n\n<li>The avatar (profile picture), if available: {{PROFILEPIC}}<\/li>\n\n\n\n<li>Optin on Facebook notifications (0 = no, 1 = yes): {{BN_OPTIN}} <\/li>\n<\/ul>\n\n<p><strong>After optin-Facebook Messenger<\/strong>:<\/p>\n\n<ul class=\"wp-block-list\">\n<li>The user\u2019s email {{BN_EMAIL}}<\/li>\n\n\n\n<li>The user\u2019s phone number {{BN_PHONE_NUMBER}}<\/li>\n\n\n\n<li>GPS coordinates and addresses (see details on interface): {{GPS_LONG}} {{GPS_LAT}} {{GPS_CITY}} {{GPS_COUNTRY}}<\/li>\n<\/ul>\n\n<p><strong>For more advanced use :<\/strong><\/p>\n\n<ul class=\"wp-block-list\">\n<li>The URL of the last file sent: {{BN_URL_UPLOAD}}<\/li>\n\n\n\n<li>The length of the user\u2019s last text entry: {{BN_USER_INPUT_LENGTH}} <\/li>\n\n\n\n<li>The identifier of the Facebook Messenger page contacted by the user: {{BN_MESSENGER_PAGE}}<a href=\"https:\/\/botnation.ai\/en\/support\/managing-multiple-facebook-pages-on-a-single-messenger-chatbot-2\/\">(find out more<\/a>) <\/li>\n\n\n\n<li>{{NEW_LINE}}: generates a line break, useful for formatting an email using variables for example.<\/li>\n\n\n\n<li>{{NEW_SPLIT}} : Automatically divides a text into several different messages (bubbles). For long texts from an API webhook call, for example. <\/li>\n<\/ul>\n\n<p><strong>To \u201cdebug\u201d\u2026 or understand the chatbot\u2019s reasoning \ud83d\ude42 <\/strong><\/p>\n\n<ul class=\"wp-block-list\">\n<li>The user\u2019s last text entry: {{BN_USER_INPUT}}<\/li>\n\n\n\n<li>The keyword or expression that triggered a sequence: {{BN_ACTIVE_EXPRESSION}}<\/li>\n\n\n\n<li>Current context: {{BN_ACTIVE_CONTEXT}}<\/li>\n\n\n\n<li>The HTTP status returned by your Webhook (remote server contacted). Only in \u201cinterpret response\u201d mode: {{BN_WEBHOOK_STATUS}} <\/li>\n\n\n\n<li>The error message returned by your webhook or if the json transmitted in return is incorrect: {{BN_WEBHOOK_REASON}}<\/li>\n\n\n\n<li>{{BN_INFINITE_LOOP}} : Equals 1 if the user has already passed through <a href=\"https:\/\/botnation.ai\/en\/support\/why-does-an-infinity-symbol-%e2%88%9e-appear-2\/\">one of your chatbot\u2019s infinite loops<\/a>.<\/li>\n<\/ul>\n\n<p>Not all of this information is necessarily filled in, depending on the communication medium or the information entered by the user.<br>It\u2019s also important to note that these system variables cannot be modified by the chatbot; they can only be consulted.<\/p>\n\n<h2 class=\"wp-block-heading\">3. User variables<\/h2>\n\n<p>Unlike the previous variables, you have complete control over them. In addition to creating and viewing them, you can also modify them. <br><br>Elles sont personnelles \u00e0 chaque utilisateur de votre chatbot. <\/p>\n\n<p>You can create user variables from a \u201cUser input\u201d element.  <\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img fetchpriority=\"high\" decoding=\"async\" width=\"476\" height=\"508\" src=\"https:\/\/botnation.ai\/wp-content\/uploads\/2022\/09\/image-70.png.webp\" alt=\"\" class=\"wp-image-519\" srcset=\"https:\/\/botnation.ai\/wp-content\/uploads\/2022\/09\/image-70.png 476w, https:\/\/botnation.ai\/wp-content\/uploads\/2022\/09\/image-70-281x300.png 281w\" sizes=\"(max-width: 476px) 100vw, 476px\" \/><\/figure>\n<\/div>\n<p><strong>Let\u2019s take a simple example:<\/strong><br><br>Let\u2019s create a chatbot for a car mechanic who needs to ask the user the make and model of the prospect\u2019s vehicle.<\/p>\n\n<p>So we\u2019ll create a variable whose name is {{marque}} and whose value is the make of vehicle entered by the user. The same goes for the {{model}}. To retrieve the information, simply consult the value of the variable named {{marque}}.  <\/p>\n\n<p>This data can be used to display promotions dedicated solely to \u201cRenault\u201d brand vehicles, for example, using the conditions.<\/p>\n\n<p>By automatically incrementing a {{passage}} variable at each conversation launch, you can also display a message or promotion dedicated to your chatbot\u2019s most active users.<\/p>\n\n<h2 class=\"wp-block-heading\">4. Global variables<\/h2>\n\n<p>Global variables can be found in your chatbot\u2019s advanced settings.<\/p>\n\n<p>Global variables are common to all users of your chatbot. You can store the customer service phone number or the price of an item on sale. In short, this information is identical for all users.<br>They are loaded by default (no setup is required in the scenario) and can be modified via the interface if there are changes to be made.<br>So if a price changes, it is changed for all users, without any action being required for each user.  <\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" width=\"463\" height=\"369\" src=\"https:\/\/botnation.ai\/wp-content\/uploads\/2022\/09\/image-71.png.webp\" alt=\"\" class=\"wp-image-521\" srcset=\"https:\/\/botnation.ai\/wp-content\/uploads\/2022\/09\/image-71.png 463w, https:\/\/botnation.ai\/wp-content\/uploads\/2022\/09\/image-71-300x239.png 300w\" sizes=\"(max-width: 463px) 100vw, 463px\" \/><\/figure>\n<\/div><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" width=\"359\" height=\"178\" src=\"https:\/\/botnation.ai\/wp-content\/uploads\/2022\/09\/image-72.png.webp\" alt=\"\" class=\"wp-image-523\" srcset=\"https:\/\/botnation.ai\/wp-content\/uploads\/2022\/09\/image-72.png 359w, https:\/\/botnation.ai\/wp-content\/uploads\/2022\/09\/image-72-300x149.png 300w\" sizes=\"(max-width: 359px) 100vw, 359px\" \/><\/figure>\n<\/div>\n<p>They are displayed as {{%%My_Global_Variable%%}} and are automatically available in variable lists in the interface.<\/p>\n\n<h2 class=\"wp-block-heading\">5. Date and time variables<\/h2>\n\n<p><a href=\"https:\/\/botnation.ai\/en\/support\/capture-a-date-3\/\">The \u201cDate and time\u201d function<\/a> enables your users to easily enter a date and time via a visual calendar, so that they can inform your chatbot of an appointment, a birth date, a desired reservation period, etc\u2026<\/p>\n\n<p>In return, many variables of type {{CALENDAR_DAY}} are available, the complete list is <a href=\"https:\/\/botnation.ai\/en\/support\/capture-a-date-3\/\">available here<\/a>.  <\/p>\n\n<p>Botnation also features system variables and functions that let you easily display, manipulate or calculate date and time.<\/p>\n\n<p>The date variables <a href=\"https:\/\/botnation.ai\/fr\/support\/date-variables-et-fonctions\/\">are available here<\/a>.  <\/p>\n\n<h2 class=\"wp-block-heading\">6. GPS-related variables<\/h2>\n\n<p>Functions are also available to easily calculate the distance between GPS coordinates in your chatbot.  <a href=\"https:\/\/botnation.ai\/en\/support\/beta-gps-tools-3\/\">They are available here.<\/a><br><\/p>\n\n<h2 class=\"wp-block-heading\">7. Variable handling<\/h2>\n\n<p>The main elements that manipulate user and global variables are :<\/p>\n\n<ul class=\"wp-block-list\">\n<li>User input<\/li>\n\n\n\n<li><a href=\"https:\/\/botnation.ai\/en\/support\/the-if-condition-feature\/\">Condition<\/a><\/li>\n\n\n\n<li>Assign<\/li>\n\n\n\n<li>Increment<\/li>\n\n\n\n<li>Decrement<\/li>\n\n\n\n<li>Random<\/li>\n\n\n\n<li>Calculation<\/li>\n\n\n\n<li>Managing Breakage<\/li>\n\n\n\n<li>Concatenate<\/li>\n\n\n\n<li>Replace<\/li>\n<\/ul>\n\n<p>To delete or reset a variable, simply assign it to an empty (nothing) or 0 sequence in your bot. At launch, for example, if you need to run regular tests with empty variables. <br><br>Finally, it\u2019s possible to import or export the variables collected into an external CRM such as Salesforce, your own database, a simple <a href=\"https:\/\/botnation.ai\/en\/support\/importing-and-exporting-google-sheets-data-into-your-chatbot-2\/\">Google Sheet<\/a> or even via <a href=\"https:\/\/botnation.ai\/en\/support\/api-botnation-importing-and-exporting-data-via-webhook\/\">the \u201cWebhook\u201d element.<\/a><\/p>\n\n<p>In this way, an order placed on your chatbot can be automatically fed back into your management system in real time.<\/p>\n\n<h2 class=\"wp-block-heading\">8. Variables on video<\/h2>\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe title=\"chatbot : utiliser des variables avec BotNation.ai\" width=\"780\" height=\"439\" src=\"https:\/\/www.youtube.com\/embed\/2MKLoyJcRis?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n","protected":false},"featured_media":21259,"template":"","meta":{"_acf_changed":false},"categorie-support":[194,222,221],"class_list":["post-13096","support","type-support","status-publish","has-post-thumbnail","hentry","categorie-support-features","categorie-support-variables-en","categorie-support-web-chatbot-en"],"acf":[],"_links":{"self":[{"href":"https:\/\/botnation.ai\/en\/wp-json\/wp\/v2\/support\/13096","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:featuredmedia":[{"embeddable":true,"href":"https:\/\/botnation.ai\/en\/wp-json\/wp\/v2\/media\/21259"}],"wp:attachment":[{"href":"https:\/\/botnation.ai\/en\/wp-json\/wp\/v2\/media?parent=13096"}],"wp:term":[{"taxonomy":"categorie-support","embeddable":true,"href":"https:\/\/botnation.ai\/en\/wp-json\/wp\/v2\/categorie-support?post=13096"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}