How to Create and Use Global Variables in wolkvox Studio
Table of Contents
Introduction
The **Global Variables** component allows you to create values that can be shared among different routing points (Voice, Interaction, Chat, or CRM + Webhook) and even across different operations within wolkvox Studio.
These "universal" variables work thanks to a token, which acts as an identifier to read or update the value as needed.
It is a very useful tool for maintaining data consistency in complex processes, integrating information between different flows, or sharing results among multiple automations.
Configuration
Create a Global Variable (Action: Update)
Follow these steps when you need to create a variable that will later be used in other routing points or operations.
- From the "Basics" group, add the "Global Variables" component to the routing where you want to create the variable.
-
Generate a token: Click the second button with the key icon (🔑) next to the "Token" field. This creates a unique token for this process.
- Recommendation: Use a different token for each process to avoid conflicts.
- If you need to copy the token, use the first button (copy icon).
- In the "Action" field, select "update" to create/update the global variable.
- In the "Global Var" field, write the name of the global variable, always starting with $. Example: $global_discount.
- In the "Value" field, define the value that the variable will have: it can be a number, text (in single quotes, e.g., 'text'), or the value of another variable. Use null if you want to leave it empty.
-
Important Note:
- If you write the variable name with $, you are indicating that the variable already exists and you want to update it.
- If you write it without $, you are creating a new variable.
-
Important Note:
- Click "Save" to apply the changes.

Read a Global Variable in Another Routing or Operation (Action: Read)
Use this process when you need to read the value of a previously created global variable and assign it to a local variable in the current routing.
- Add the "Global Variables" component to the routing where you will retrieve the variable.
- In the "Token" field, paste the same token used to create the global variable.
- In the "Action" field, select "read". When selecting the "read" action, the "Value" field will automatically change to "Assign to".
- In the "Global Var" field, write the name of the global variable you want to read. Example: $global_discount.
- In the "Assign to" field, define the name of the local variable where you want to save the read value. Example: $customer_discount.
- Click "Save" to apply the changes.

Important Considerations
- Global variables are automatically deactivated if they go unused for a full month.
- The component is available in all types of routing points and Agent Scripting.
- Global variables allow sharing data between:
- Routing points of the same type.
- Routing points of different types.
- Different operations within the same account.