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:


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

intent_confidence

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

last_event

Information about the last event that the user triggered. Defaults to {"type":"launch","payload":{"resetState":false}}. Note: this variable contains an object rather than a string.

{"type":"event","payload":{"event":{"name":"buySyrup"}}}

last_response

The agent's last response that it sent to the user.

Hello, I'm an agent! How can I help today?

last_utterance

The previous message that was sent by the user.

My name is Braden and I like cookies.

locale

The locale of the user, as detected from their browser.

en-CA

platform

The platform your agent is running on.

voiceflow

sessions

The number of times a particular user has opened the agent.

8

timestamp

The UNIX timestamp of when the conversation began.

873700668

user_id

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
Phone: +16471234567

vf_memory

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.

vf_now

The current date and time formatted in a human-readable way. You can modify the timezone in project settings.

Jan 1, 2025, 16:37

vf_date

The current date formatted in a human-readable way.

Jan 1, 2025

vf_time

The current time formatted in a human-readable way.

16:37

vf_month

The current month.

January

vf_day

The current day of the month.

1

vf_year

The current year.

2025

vf_user_timezone

The user's timezone in the format. If unavailable, defaults to the project's timezone.

America/Toronto