header
login

MySQL

The mysql_query function lets you execute SQL queries against a MySQL database directly from your bot workflow. Read customer data, save orders, and work with any tables.

Parameters

Parameter Description
host MySQL server address
user Database username
password Password
database Database name
port Port (default: 3306)
query SQL query
save_as Variable name for the result

Examples

Reading Data

SELECT * FROM users WHERE telegram_id = '{=tgData.from.id=}'

Writing Data

INSERT INTO orders (user_id, product, created_at)
VALUES ('{=tgData.from.id=}', '{=message=}', NOW())

Updating Data

UPDATE users SET last_active = NOW()
WHERE telegram_id = '{=tgData.from.id=}'

Working with Results

The query result is saved to the specified variable and available in subsequent functions:

{=db_result=}

Use Cases

  • Storing user data
  • Product and service catalogs
  • Order and booking history
  • Analytics and reporting