Steps
Set variables
Compute values once, such as a clean name, a total or a date, and reuse them in later steps.
What it does#
Set variables works out one or more values with expressions and saves each under a name. Nothing is sent to the customer, and the chat moves on at once.
Use it to tidy up an answer (trim and capitalize a name), add numbers (price x quantity), pick an item from data your system sent, or prepare a date (three days from today). Later steps then use the result like any other variable.
Add variables#
- 1
Drag Set variables onto the canvas
It's under Tools in the step list. Connect the step before it and the step after it.
- 2
Name the variable
Under Variables, type a name in the
@field, for examplefirst_name. Start with a letter and use only letters, digits and_. Spaces become_. - 3
Write the expression
Below the name, write how to compute the value, for example
trim(@full_name). The editor shows Looks good when it can read it, or what to fix. - 4
Test it
Click Test expression, add sample values (one per line, like
@full_name = Noa Levi), and click Run to see the Result. - 5
Add more rows
Click Add variable. Rows run top to bottom, so a row can use the rows above it. Use the arrows to change the order. Up to 30 rows.
Use the values#
| Where | Write |
|---|---|
| In a message | {{@first_name}} |
| In a condition or another expression | @first_name |
| In an HTTP step | Sent with the other answers |
The value is also available as #first_name, so data-style references work too.
Example#
A tour company gets the customer's name and group size, plus a price list from an HTTP step, and prepares the quote:
first_name = split(trim(@full_name), " ")[0]
price = find(#tours, "id", @tour_id).price
total = round(number(@group_size) * @price, 2)
visit_date = formatDate(addDays(today(), 3), "DD/MM/YYYY")Thanks {{@first_name}}! {{@group_size}} people come to {{@total}} ILS. The earliest date is {{@visit_date}}.For Noa Levi, a group of 4 and a tour priced 120, the customer reads: Thanks Noa! 4 people come to 480 ILS. The earliest date is 18/10/2026.
When a value can't be computed#
If an expression fails when the chat runs (for example number(@group_size) when the customer typed four), that variable is left empty, you get an alert, and the chat continues. Use default() to give a safe value instead, for example default(@city, "Tel Aviv").
Common mistakes#
- "This is a system variable".
cphone,channelandnoware reserved. Choose another name. - "This name is set above too". Two rows with the same name: the lower row wins. Rename one if that's not what you want.
- Using a row before it's set. Rows run top to bottom. Move the row you depend on above.
- Forgetting quotes around text. Write
"Tel Aviv", notTel Aviv. Without quotes it's read as a name. - Expecting the customer to see something. This step sends nothing. Add a Send Message step after it.