ฐานความรู้ GetMyBot

Actions

What your bot can do after a message or button press: reply, save an application, grant access, request data, or take payment. Settings and limits.

บนหน้านี้

An action is a specific task for the bot: send a reply, save a phone number, create an order, or notify a manager. A reaction can contain several actions. For example, after someone submits a request, the bot can save its details, add the "New request" label, and send a confirmation.

Open Actions in the editor and select Add action. The bot runs the list from top to bottom. Pass a result to the next step through temporary data (ctx). Save information needed in later conversations as user parameters. See Substitutions and formulas.

Messages and replies

  • Send message: the primary action: assembles a response from blocks (text, photo, file, delay, AI, reaction call), adds inline buttons, menus, and dialog steps. See Messages and buttons for details.
  • Save message: stores the incoming message text in a user parameter.
  • Forward: forwards the incoming message to specified chats (with an optional topic ID).
  • Notification: sends a notification to service chats with data about the user, chat, and message text.
  • Menu button: changes the Telegram menu button (setChatMenuButton) without restarting the bot: default, command list, or a Mini App with text and URL (substitutions work). Scope "this chat" only works in a private chat with the subscriber who triggered the reaction — in a group or any other conversation kind the action fails; scope "all chats" changes the bot-wide default for every chat with no button of its own, and cannot sit inside a loop. Channels other than Telegram skip the action silently.

User: labels and parameters

  • Edit labels: adds and/or removes subscriber labels. The "Duration, days" (ttl_days) setting makes added labels temporary: when the period ends, the label is removed automatically and the bot receives a "Label expired" system event (see triggers). For example, add a label for 30 days after payment, then remove the person from a private chat when it expires.
  • Edit parameters: sets, deletes, or increments user parameter values.

Moderation

  • Delete received: deletes the incoming message (optionally all of the user's messages, with a delay).
  • Delete sent: deletes the bot's messages (from this reaction or all in the chat, with a delay).
  • Change rights: mute / unmute / ban / unban / restrict rights / kick / approve join request / decline join request for a member, temporarily or permanently where applicable. For restrictions, select specific rights.

Kick (kick) removes a member without adding them to Telegram's block list: Telegram bans and immediately unbans them. VK can only remove someone through the community blacklist (groups.ban); otherwise VK cannot perform this operation.

Approve (approve) accepts a subscriber's existing request to join a private chat or community.

Decline (decline) rejects an existing join request. The person is not blocked and can apply again, so this operation has no duration or set of rights. If there is no request, there is nothing to decline. In Telegram the bot needs can_invite_users, which also controls join requests. VK supports approving a community request but not declining one: a campaign node fails, while an ordinary reaction is rejected during send preparation.

The applicant comes from the event itself, not from user_chat_id. Telegram provides user_chat_id as a temporary private conversation in which the bot may message the applicant; it is not the applicant's ID for moderation.

The "Chat" (chat_id) field sets the target chat explicitly. If empty, the action uses the event chat only when the reaction started in a group or channel. For a "Label expired" event, schedule, campaign node, or any other start from a private dialog, enter the chat explicitly or the action is skipped.

  • Important reaction (color): marks the conversation with a color for the operator.

Data and collections

  • Create record: adds a row to a collection. With a deduplication key, repeating the same key updates the previous row instead of creating another; this is called upsert.
  • Update records: modifies rows matching a filter.
  • Find records: reads rows into the context as an array (for iteration).
  • Search collection (record_search): searches selected text fields and alternate names, optionally allowing typos. Saves rows and information about whether the search result is complete.
  • Related records (record_related): reads rows sharing a key, such as class dates found by class code, or one row by _record_id.
  • Read collection page (record_page): reads a bounded page with filters and sorting. Its cursor continues the same query; reaching the final page does not make that page the entire collection.
  • Aggregate whole collection (record_aggregate): calculates over all matching records eligible under retention rules, without loading them into the reaction first.
  • Atomic collection transaction (collection_transaction): checks conditions and commits several changes together. A conflict rolls them all back. Collection exercises.
  • Delete records: removes rows matching a filter.
  • Loop over list: iterates over an array from ctx and runs nested actions for each element: totalling orders, writing every element into a collection, calling an external service per row.

A loop is not for mass sending: one event may send at most 50 messages, while a loop takes up to 500 elements. Mass delivery belongs to Broadcasts and Campaigns, which have their own pacing and accounting. Details in "The budget of one event" below.

For more on collections, see Collections and data.

External requests

  • Web request: sends an HTTP request with headers, a JSON or text body, success codes, timeout, and retries. It supports GET, HEAD, OPTIONS, POST, PUT, PATCH, and DELETE. Only network errors and responses 429 or 5xx are retried; other 4xx responses are not. For POST and PATCH, retries are enabled only if you set Idempotency-Key yourself and the receiving service can reject duplicates using that key. The platform also sends its own key, which stays the same when it retries a step, but that key alone does not enable POST or PATCH retries. Save a selected response part to a user parameter or temporary ctx data via JSONPath. The request can run in the background and route success and failure to different reactions.
  • Fetch URL: downloads a page and saves its readable text to ctx (for subsequent processing or AI).
  • Source request: reads data from a connected connector (REST / OzmaDB) into ctx.
  • Write to source: writes data to a connector (POST/PUT/DELETE).

For sources and keys, see Sources and keys.

AI and computation

  • AI: calls a language model: prompt, save the response to a parameter or ctx, optional JSON schema for structured extraction, send the response to the user. See AI responses.
  • Compute: computes a value in one of three modes, exactly one per action: "Formula" (a short expression, expr), "Decision table" (rules of the form "when → then", first true wins, rules), or "Advanced formula" (the full language with lists, JSON, and hashes, formula). The result is saved to ctx and/or a parameter. See Formulas.

Logic and scenarios

  • Chain reaction: triggers another reaction by name.
  • Call block (call_block): runs shared logic with declared inputs and outputs. Select a specific version or the latest version. Order calculation example.
  • Next reaction: passes control to the next matching reaction in the list.
  • Choose next step (branch_result): checks a search result. Route separately for no records, one or several records, an approximate match, or an incomplete result. The first matching condition chooses the target reaction; put the incomplete-result check before other branches.
  • Run scenario: starts a step-by-step wizard (flow). See Scenarios.
  • Request approval: sends an approval card to an approver; "approve" / "reject" buttons trigger configured reactions.
  • Transfer to operator: moves the conversation to the operator inbox. See Chats and operators.

Payments

  • Create payment: creates an invoice with the bot's payment provider and provides the payment URL as {payment:url}. A separate reaction with the Payment trigger handles the payment. See Payments and balance.

Enter the amount as a decimal in major currency units, for example 1500.50; the action converts it to minor units. An explicit link lifetime is 300 to 2 592 000 seconds; 0 uses the default. To create a subscription, enter a stable plan key, amount, and period. Updating one can keep its current amount or period. Cancelling stops future charges without refunding past payments. An optional plan key narrows the subscriptions selected.

Integrations

The GetCourse, Google Sheets, and Google Drive actions connect through the corresponding integrations (see Integrations). Universal delivery to external services is available through the Webhook integration and the Web request action.

Google Sheets supports five operations. Fields are matched to the column headers of the header row (the first one by default), so the column order of the sheet does not matter:

  • Append a row: "header → typed value" pairs with substitutions; an unknown header is an error. Result: {row_number, range}.
  • Read rows: the rows after the headers as objects with the _row number; page limit (default 50, maximum 500), offset, and has_more and next_offset under a separate key.
  • Read the last row: the last non-empty row of the sheet.
  • Find a row by column value: the first row whose column (a header, case-insensitive, or a letter A, B, …) equals the value; the value supports substitutions ({{param.email}}).
  • Update a row: changes the cells of row row_number, for example {{ctx.lead.row_number}}.

A single-row read is saved to a parameter or context as JSON {"found":true,"row_number":12,"cells":[…],"values":{"Email":"…","Plan":"…"}}. When saved to the lead context, {{ctx.lead.found}}, {{ctx.lead.row_number}} and {{ctx.lead.<header>}} are available, for example {{ctx.lead.Plan}}. If no row is found, found is false and the cells are empty. If the sheet is too large to scan, the step fails instead of returning a wrong row.

GetCourse creates or updates a user and a deal by sections (user, system, session, deal, custom fields) and exports users, deals and groups; the import result is {user_id, deal_id, lead_id}. Google Drive uploads a file and saves {file_id, web_view_link}. Every integration action and AI has optional response parsing, and a failure runs the configured error route. Details: Integrations.

The budget of one event

One inbound event: a subscriber's message, a button press, a trigger firing: spends an event budget. It is shared by every piece of work that event caused: the reaction itself, chained reactions, nested loops, and asynchronous web requests that keep running after the reply. The budget exists so that one mistake in a reaction (or one hostile input) cannot occupy workers shared by every bot.

Three boundaries:

What is boundedHow muchWhat happens at the boundary
Actions per event5000, nested ones includedThe action does not run; the step is marked as an error
Outbound messages per event50The message is not queued; the step is marked as an error
Time per event5 minutesThe event stops; external calls still in flight are cancelled

One loop is bounded separately: up to 500 elements per pass. If the array is longer, the extra elements are simply not processed, and the reaction card does not show it: so do not rely on a loop where the whole list must be processed.

Why 50 messages but 500 elements

This is neither a typo nor a forgotten setting. It is the boundary between two different things.

A reaction answers one person's action. Fifty outbound messages for one inbound message is already generous.

A broadcast delivers to many. It has its own pacing, its own pauses, its own accounting of what was sent, and a pause button. See Broadcasts and Campaigns.

So a 500-element loop with a message send inside is not a broadcast: it is a truncated one: the first 50 messages go out and the remaining 450 are refused. That is the intended answer, not a fault. If you need to send to a list, use a broadcast.

What is counted is outbound messages, not actions. A reply made of several blocks (text, photo, file) spends one per block. If the next reply does not fit into the remaining budget, none of it is sent: better no message than half a message.

How to tell you hit the budget

The refusal shows up in the reaction card inside the subscriber's dialog (People → the dialog): among the steps there is an error step about the event budget, and it names which budget ran out: actions, sends or deadline. (That step's title comes from the engine and is written in Russian in every interface language.)

What the refusal is not in: it does not appear in an API response and it never reaches the subscriber. If the reaction was started through the API or a web request, that answer is an ordinary success: the call itself was accepted; it is work inside it that was refused. The reaction card is the only place to see it.

A refusal does not break the loop: it keeps iterating over the remaining elements, and each of them is refused the same way. So the card holds many error steps, one per element that did not fit, and the reaction itself finishes with an error.

What to do instead

  • You need to send to many people: Broadcasts or Campaigns. They carry no event budget: they are a separate, paced process with their own accounting.
  • You need to process a large list without sending (write, total, synchronise): a loop is the right tool, but remember the 500 elements per pass: narrow the selection with a filter or a collection limit.
  • You need nested loops: multiply: an outer 100 by an inner 100 is 10,000 actions, twice the budget.
  • A reaction runs into the 5 minutes: it is almost always external calls. Make the Web request asynchronous and continue in a separate reaction on success or error.

Contact verification

Verify contact supports requesting an email code, checking the supplied code, or checking phone ownership. To verify an email address:

  1. Save the person's address to a param and add Send code to email.
  2. Ask the person to enter the code and, in the next step, add Check code from email.
  3. Save the result to a param: 1 means the check succeeded, 0 means it did not. The 0 branch should offer another attempt.

The code is valid for 15 minutes and allows up to five attempts. After a successful check, the address is linked to the current person's profile. If the address already belongs to another profile in the same project, that profile is merged into the current one unless external CRM links conflict. An address typed without code confirmation never merges profiles. If the merge cannot be completed, the result is 0 and the code can be reused until it expires.

To avoid sending a code to an address that is already verified, enable Skip the code if the email is already verified (skip_if_verified) in Send code to email and fill in Save result to param (save_result_to): without it the reaction cannot be saved. For such an address no code is sent and the param gets already_verified.

The reaction is saved only with this chain:

  1. Right after sending the code comes Choose a step by value, and it is the last action in the reaction. The editor can add it for you.
  2. The action's value reads the saved result, for example {user:email_status}.
  3. The first branch checks that the value equals already_verified and leads to the next reaction.
  4. If no branch matches leads to a different reaction, and that is where the bot asks for the code.

For this setup, use a simple param name without the characters :, #, { and }. Do not place the action inside a for_each loop; additional branches compare text without regular expressions or numeric operators. If the reaction is called by another reaction through chain or an embedded block, do not put the code question in the parent reaction after the call: the parent may continue even if the child reaction fails.

Sending and checking a code are also supported in the web widget when email is configured. Phone verification uses the already confirmed WhatsApp identity and does not send a code.

Captcha

Captcha is available on Telegram. Enter a question and two to eight answer buttons, with exactly one correct answer. Only the person being checked can answer. The timeout is 10 seconds to one day, with a default of two minutes. An incorrect answer can be retried until the timeout.

For a new group member, the bot restricts the member until they answer correctly. On timeout, it kicks or bans them according to the setting. The bot needs can_restrict_members.

For a join request, the question is sent to the applicant in a private chat. A correct answer approves the request; a timeout declines it. The bot needs can_invite_users, and the failure action is not applicable. Telegram normally allows the bot to message the applicant for up to five minutes after the request; this limits sending the question, not the configured answer timeout. The reaction templates under “Groups and channels” include templates for new members and join requests.

Lists, aggregates, and data branches

Use these actions to process data from the context, an HTTP response, or a collection:

  • Transform list (list_transform): filter, sort, deduplicate, and select a page.
  • Map list fields (list_map): extract nested fields and calculate new values for each row.
  • Join lists (list_join): add data from another list using a shared key.
  • Group and aggregate (list_aggregate): count, sum, average, minimum, maximum, and distinct count, optionally by group.
  • Branch by value (branch_value): check ordered conditions against text, a number, or a state.
  • Update record if (record_update_if): change one record atomically only if its expected fields still match.

These actions do not assume a particular kind of business or bot. Testing data in the editor does not run later steps. See parameters and examples.

Start with practical lessons: find a class, process an HTTP response, calculate category totals, and confirm an application only if its current state allows it. Each exercise lists the settings and result to check. The mapping and joining lesson shows how to extract a customer's name, calculate an amount, and add a class name from a lookup list.

Step outcomes and draft testing

In fields that take data from previous steps, use the available-data picker. It shows each result and its available fields. Pass the whole result to list processors when you need to preserve information about completeness.

Supported actions can route by outcome, for example to respond separately to a successful update, a conflict, and a technical error. Successful message enqueueing does not prove delivery.

Draft testing runs the current unsaved chain on sample data. It shows calculations, selected routes, and expected actions without sending live messages or changing collections.

What's next