> For the complete documentation index, see [llms.txt](https://docs.hablla.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.hablla.com/hablla-docs-en/automation-flows/all-components/others/set-global-variables.md).

# Set Global Variables

### Overview

The **Global Variables Definition Component** (internally identified in the system as `set_global_vars`) is a utility node focused on data persistence and state management (*state management*). Its main function is to create or reassign custom memory keys that become available for reading at any later stage of the automation flow, regardless of the channel or branching depth. It acts as the centralized repository of dynamic contact data during chatbot execution.

### Configuration Parameters

The node parameterization operates through a dynamic list of key-value entries under the section *Variables \**:

* **Key (Variable Name):** Text input field (left side) where the administrator defines the identifying name of the variable (e.g.: `id_person`, `name`, `phone`). Must not contain spaces or special characters.<br>
* **Value:** Text input field (right side) that defines the content stored in the respective key. Accepts the insertion of raw static texts (e.g.: `61999999999`) or interpolated dynamic references from previous payloads.<br>
* **+ Add item button:** Control that inserts a new blank pair of fields (Key and Value) to expand the mapping list.<br>
* **Trash Icon:** Quick delete button fixed on the right side of each row to remove obsolete node variables.<br>

### Visual Builder

The builder interface was designed to facilitate the vertical organization of records and data inheritance:

* **Inline Key Manager:** The linear layout visually groups each variable with its respective destination data, allowing multiple structured saves to be configured within a single action node.<br>
* **Mutability and Reassignment:** The editor allows the same key name to be used in different global variable nodes across the canvas. When the contact passes through a new node containing an already existing key, the system performs the **value reassignment**, overwriting the old data with the new content in real time.<br>

### Special Operators

The logical properties of this component manage the data reading syntax and runtime error prevention:

* **Global Reading Notation (`{{$data?.nome_variavel}}`):** After the contact passes through this component, any subsequent block in the flow tree can read and display the saved values using strictly the double-curly-brace syntax combined with the safe navigation operator, for example: `{{$data?.name}}` or `{{$data?.phone}}`.<br>
* **Safe Navigation Operator (`?.`):** The use of a question mark followed by a dot in read expressions ensures that the platform ignores and does not crash the flow execution if the queried variable is temporarily null or empty.<br>
* **Synchronous Expression Resolution:** As soon as the contact passes through the block, the engine processes and calculates the dynamic expressions (such as `{{$data?.manualStart_4iochbjyt...}}`), stores the final result in global memory, and instantly dispatches the user to the node's linear output.<br>

### Practical Examples

The table below shows classic scenarios for configuring and reading global variables to enrich automation logic:

| **Variable Name (Key)** | **Configured Value in the Node**   | **Reading Syntax in Subsequent Nodes** | **Practical Use Case**                                                                                                                                                                            |
| ----------------------- | ---------------------------------- | -------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `name`                  | `{{$data?.manualStart_4iochbjyt}}` | `{{$data?.name}}`                      | Capture the name entered in a manual input form and store it globally to greet the user in future messages.                                                                                       |
| `phone`                 | `61999999999`                      | `{{$data?.phone}}`                     | Set a static contingency phone number at the start of the flow to route notifications in case of failure.                                                                                         |
| `status_pagamento`      | `Approved` *(Reassignment)*        | `{{$data?.status_pagamento}}`          | A node at the beginning sets the variable to "Pending". After receiving the confirmation webhook, this component is triggered and reassigns the value to "Approved", changing the bot's behavior. |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.hablla.com/hablla-docs-en/automation-flows/all-components/others/set-global-variables.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
