# Dynamic Variables Explaination

## I. Introduction

The objective of Dynamic variables within CX Genie would be to make their interaction with the chatbot more personalized and flexible, pulling variable data in dynamically upon conversations. It would therefore be able to change responses at will, depending on any specific information at that particular moment through user input, APIs, or other sources of information.

<figure><img src="/files/nxxnnkPydwuYgGzcAgtw" alt=""><figcaption></figcaption></figure>

In short, Dynamic Variables enable CX Genie's chatbot to:&#x20;

***Personalize responses**:* Calling out the user's name or referring to actual data about them, making the conversation appear more personalized.&#x20;

***Data Collection and Usage from Outside Sources***: It may fetch and use real-time data from APIs or databases, such as fetching stock availability or order status, or personalized recommendations.&#x20;

***Automate decision-making***: The chatbot can change responses dynamically, or execute different sequences of actions based on the variable values, making workflows smarter and context-aware.&#x20;

This ensures that customer interactions are more accurate, engaging, and relevant, improving overall service quality.

## II. How to use

### 1. Dynamic Variables' name

<figure><img src="/files/um7AGoq75W45U7i4tZIt" alt=""><figcaption></figcaption></figure>

This is the name of the dynamic variable you are creating. You should enter a clear and descriptive name that reflects the purpose of the variable, such as "CustomerName" or "OrderTotal." This name will be used to reference the variable in the workflow.

### 2. Code

<figure><img src="/files/4zdOiMqQa58EbctiHEz2" alt=""><figcaption></figcaption></figure>

This field is for the code representation of the dynamic variable. The code must be written in **snake\_case** (all lowercase with words separated by underscores). For example: "customer\_name" or "order\_total." This is how the system will identify the variable.

### 3. Determine Returned Result

<figure><img src="/files/JyDyvvZnMEKlxgxIgr8U" alt=""><figcaption></figcaption></figure>

* **Specified result**: Select this option if you want to specify a fixed result that the dynamic variable will return, meaning a specific result that you already know.
* **Random result**: Choose this option if you want the system to return a random result, useful for cases where the outcome is unpredictable or for testing scenarios.

### 4. Result Data

<figure><img src="/files/NbSAgPKPeZOPMVxNs7pk" alt=""><figcaption></figcaption></figure>

Here you provide the data or information that the system will use to return the variable’s value. For example, if you are pulling information from an API, the returned value might be in JSON format, and you would need to provide the paths to the specific data you want.

### 5. Type

<figure><img src="/files/iSdk3sikXmyVpJ5VnkVB" alt=""><figcaption></figcaption></figure>

* **API Information**: Choose this option if you want the dynamic variable to pull data from an external API. An API allows the system to connect to external services or databases to retrieve specific information.
* **CURL**: Choose this option if you want to use **CURL**, a command-line tool used for transferring data with URLs. CURL is often used for making more complex HTTP requests.

### 6. API URL or CURL

<figure><img src="/files/f0FvILL4oSaEo2Dfdj5Q" alt=""><figcaption></figcaption></figure>

If you selected **API Information** as the **Type**, this is where you enter the **URL** of the API you want to pull data from. The **URL** is the web address that the system will query to retrieve data.

<figure><img src="/files/nC0d4HYtX6U09JCKbwrh" alt=""><figcaption></figcaption></figure>

If you selected **CURL** as the **Type**, this is where you enter the **CURL** of the API you want to pull data from. The **CURL** is the web address that the system will query to retrieve data.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://documents.cxgenie.ai/bots/workflow/module-explaination/dynamic-variables-explaination.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
