Skip to content
Docs

Workflows

Set variable

Create a variable, or change one, for use later in the chat.

Set variable saves a value in a variable – such as a flag that the person has been verified, a count of attempts or a total worked out from other values.

Settings

The Set variable panel, with Variable name and Chat script

SettingWhat it does
Variable nameThe variable to set, such as is_verified. If it doesn’t exist yet, it’s created. Use letters, numbers and underscores, and start with a letter.
Chat scriptThe new value, as an expression.

Write a value

The Chat script is worked out, not copied – so text needs quotes.

To setChat script
Some text"gold"
A number3
Yes or noTrue or False
NothingNone
Another variable’s valueemail_address
A sumprice * quantity
One more than beforeattempts + 1
Text built from variablesfirst_name + " " + last_name
Part of an API responseorder.status
A list["Billing", "Sales"]

What happens

The variable is set, and the workflow carries on. The person doesn’t see anything.

Good to know

  • A word without quotes is read as a variable name. gold on its own means the variable called gold – usually empty.
  • To count something, start it at 0 in an earlier Set variable. A variable that doesn’t exist is None, and None + 1 stops the workflow.
  • If Variable name or Chat script is empty, the action does nothing.

Stuck? Ask Advisor in the Proto dashboard, or contact us.

© Proto