Variables
Store information for the duration of a conversation.
Variables let your agent remember and reuse information during a conversation. You can store details like a user’s name and account details, then reference them later to personalize responses or make decisions in your flow. Variables act as your agent’s short-term memory, helping it keep track of what matters from one step to the next.
Variables are set on a per-user basis, based on the user_id variable. This means that even if your agent is having a conversation with ten different users at the same time, the values of their variables are not shared.
Creating variables
Variables can be created and managed from inside Voiceflow's CMS. To access the variables page, click the CMS button at the bottom of your project's sidebar then select Variables. You can create a new variable using the button in the top right, or modify an existing variable by clicking on it.
When creating a new variable, you can optionally set a default value. We recommend doing so, as this provides a fallback for your agent to use.
You can also create a new variable when you try to use a variable in an input by clicking the add button at the bottom of the dropdown that appears.
Using variables during conversations
Variables can be used inside most inputs on Voiceflow, allowing your agent to access the value of the variable. For example, you can use variables in the Agent step's instructions box or as the value of a parameter in a Tool step's API call. To use a variable, simply type { followed by the name of the variable. Then, click the name of the variable in the dropdown list that appears.
If you'd like to add complex logic to your agents, you can use variables inside the Condition step to do so.
Setting a variable's value during a conversation
There are various ways to set a variable during a conversation:
- The Set step or the JavaScript step allow you to set a variable to any text value.
- The response from integration tools can be captured and stored in a variable using the capture response feature.
- Variables can be set agentically using exit conditions on an Agent step.
Built-in variables
Each project created on Voiceflow automatically has access to some built-in variables. These are automatically set when the user begins a conversation with your agent or when certain actions take place.
Variable name | Description | Example Data |
|---|---|---|
| The confidence interval (measured as a value from 0 to 100) for the most recently matched intent. Note: intents are a legacy feature that we do not recommend using in new agent builds. | 67 |
| Information about the last event that the user triggered. Defaults to |
|
| The agent's last response that it sent to the user. | Hello, I'm an agent! How can I help today? |
| The previous message that was sent by the user. | My name is Braden and I like cookies. |
| The locale of the user, as detected from their browser. | en-CA |
| The platform your agent is running on. | voiceflow |
| The number of times a particular user has opened the agent. | 8 |
| The UNIX timestamp of when the conversation began. | 873700668 |
| The user's unique ID, as set through the web chat widget or the API. If using Voiceflow's phone integration, this is automatically set to the phone number that the agent is calling. | Web chat or API: example_user |
| The last ten user inputs and agent responses in a string. This also includes tool calls. | agent: Hey what's up? user: I want to order maple syrup. |
| The current date and time formatted in a human-readable way. You can modify the timezone in project settings. | Jan 1, 2025, 16:37 |
| The current date formatted in a human-readable way. | Jan 1, 2025 |
| The current time formatted in a human-readable way. | 16:37 |
| The current month. | January |
| The current day of the month. | 1 |
| The current year. | 2025 |
| The user's timezone in the format. If unavailable, defaults to the project's timezone. | America/Toronto |
Updated about 10 hours ago