header
login

Variables and User Data

Variables let you work with dynamic data in workflows: store user input, pass data between functions, and insert values into messages.

Syntax

Variables use the following format:

{=variable_name=}

Use them in message text, conditions, HTTP requests, and other functions.

System Variables

These variables are automatically available when a message is received:

Variable Description
{=message=} User's message text
{=tgData.from.id=} User's Telegram ID
{=tgData.from.first_name=} User's first name
{=tgData.from.last_name=} User's last name
{=tgData.from.username=} Telegram username
{=tgData.chat.id=} Chat ID

Creating Variables

Use the add_var function to create and modify variables:

  • Set the variable name
  • Specify the value (text, number, or expression with other variables)

Once created, the variable is available in all subsequent functions in the workflow.

Using in Messages

Hello, {=tgData.from.first_name=}!
You wrote: {=message=}
Your order #{=order_id=} has been accepted.

Using in Conditions

"{=message=}" == "/start"
{=count=} > 5
"{=user_role=}" == "admin"

Variables from HTTP Requests

The result of an HTTP request can be saved to a variable. If the response is JSON, access nested fields with dot notation:

{=api_response.data.name=}
{=api_response.status=}

Variables from Integrations

Results from MySQL, MongoDB, and AI queries are also saved to variables and available in subsequent functions.