Skip to main content

Overview

Variables let you capture, store, and reuse data during a conversation. Use them to personalize messages, make decisions based on user input, and pass data between nodes.

Types of Variables

System Variables

Pre-loaded automatically in every session. You don’t need to declare them.
VariableDescription
system.last_message.textText content of the user’s last message.
system.last_message.captionCaption of a media message from the user.
system.last_message.urlMedia URL from the user’s message.
system.request.statusHTTP status code from the last API Request node.
system.request.bodyFull response body from the last API Request node.
system.numberOfAttemptsNumber of retries on the current wait node.
system.dateHourCurrent system date/time.

User Variables

Variables you create in the flow editor to store custom data. Each variable has a name (used in templates) and a unique ID (used internally).

Template Syntax {{variableName}}

Use double curly braces to reference variables in text fields — message bodies, API URLs, headers, conditions, etc.

Primitive Values

Variables that hold strings, numbers, or booleans are replaced directly:
TemplateVariable ValueResult
Hello {{name}}name = "Claudio"Hello Claudio
Total: {{amount}}amount = 42.5Total: 42.5
Active: {{active}}active = trueActive: true
Balance: {{balance}}balance = 0Balance: 0

Object Values

When a variable holds an object, the result is its JSON representation:
TemplateVariable ValueResult
Info: {{data}}data = { name: "Ana", age: 30 }Info: {"name":"Ana","age":30}

Accessing Object Properties

Use dot notation to access nested properties:
TemplateVariable ValueResult
Hello {{user.name}}user = { name: "Claudio" }Hello Claudio
Total: {{order.total}}order = { total: 150.99 }Total: 150.99
City: {{data.address.city}}data = { address: { city: "SP" } }City: SP
Deep nesting works at any level:
TemplateVariable ValueResult
Name: {{a.b.c.name}}a = { b: { c: { name: "Carlos" } } }Name: Carlos

Array Access

When a variable is an array, it returns the JSON array:
TemplateVariable ValueResult
Items: {{list}}list = [1, 2, 3]Items: [1,2,3]
Tags: {{tags}}tags = ["node", "nest", "ts"]Tags: ["node","nest","ts"]
When accessing a property on an array, it maps and extracts that property from each item:
TemplateVariable ValueResult
{{products.price}}products = [{ name: "Shirt", price: 50 }, { name: "Pants", price: 120 }][{"price":50},{"price":120}]
{{orders.customer.name}}orders = [{ customer: { name: "Ana" } }, { customer: { name: "Bob" } }]["Ana","Bob"]

System Variables in Templates

System variables use the system. prefix:
TemplateResult
Last message: {{system.last_message.text}}Last message: Hello world
Status: {{system.request.status}}Status: 200
Body: {{system.request.body}}Body: {"ok":true}
Body ok: {{system.request.body.ok}}Body ok: true
Date: {{system.dateHour}}Date: 2025-01-15T10:30:00

Multiple Variables

You can use multiple variables in the same string:
TemplateVariablesResult
Due date {{dueDate}} amount {{amount}}dueDate = "03/15", amount = "R$ 150,00"Due date 03/15 amount R$ 150,00
{{name}} bought {{qty}}x {{product}}name = "Ana", qty = 3, product = "Shirt"Ana bought 3x Shirt

Variable Not Found

When a variable doesn’t exist, is null, or is undefined, the original template is kept:
TemplateVariable ValueResult
Hello {{name}}(not defined)Hello {{name}}
Val: {{obj.missing}}obj = { a: 1 }Val: {{obj.missing}}
Hello {{name}}name = nullHello {{name}}

Chained Variables

If a variable’s value contains another variable reference, it is resolved recursively:
TemplateVariablesResult
{{a}}a = "{{b}}", b = "final"final
{{a}}a = "{{b}}", b = "{{c}}", c = "deep"deep
{{a}}a = "{{b}}", (b not defined){{b}}

Common Patterns

Capture User Input

After a wait node (Button, List, Message Menu), the user’s response is in system.last_message.text. Use a Set Variable node to persist it:
{{system.last_message.text}} → userName

Parse API Responses

After an API Request node, use an Object Parser node to extract fields from system.request.body:
data.order.id     → orderId
data.order.status → orderStatus
data.customer.name → customerName

Interpolate in Messages

Reference any variable in a Message node:
Hello, {{userName}}! Your order #{{orderId}} is {{orderStatus}}.

Naming Rules

  • Use camelCase: userName, orderTotal, cpfNumber
  • No spaces or special characters — only letters, numbers, and underscores
  • Names are case-sensitive: userNameusername
  • Never use the system. prefix for user variables

Comparison Operators

When using variables in Condition nodes:
OperatorDescriptionValue required?
equalsExact matchYes
notEqualsDoes not matchYes
containsIncludes substringYes
notContainsDoes not includeYes
greaterThanNumerically greaterYes
lessThanNumerically lessYes
greaterOrEqualGreater or equalYes
lessOrEqualLess or equalYes
isSetHas a non-empty valueNo
isEmptyEmpty or undefinedNo
startsWithBegins with stringYes
endsWithEnds with stringYes
matchesRegexMatches regex patternYes

Transform Functions

Optional transformations applied to variables before comparing in conditions:
FunctionEffect
lengthUses string length instead of the string itself
trimRemoves leading/trailing whitespace
lowercaseConverts to lowercase
uppercaseConverts to uppercase
toNumberConverts to number
normalizeRemoves accents and diacritics
removeSpacesRemoves all spaces