Formulas
Formulas are GetMyBot's built-in calculation language. You can use them to compute a discount amount, build a string, evaluate a condition, transform a list, or format a date — directly in message text, in the "Compute" action, and in decision-table conditions. The syntax is similar to spreadsheet formulas and supports Russian function name aliases.
Where formulas work
- In text — the
{{= expression}}construct evaluates the expression and inserts the result. For example,{{= ROUND(param.total * 0.9) }}. - The "Compute" action (
compute) — evaluates an expression and saves the result toctx(the "Save to ctx" field) and/or to a subscriber parameter (the "Save to parameter" field). - Decision table — in the "Compute" action, instead of a single expression you can define a list of "when → then" rules: the value of the first rule whose condition is true is returned, otherwise the default value.
Syntax
- Operators: arithmetic
+ - * / %, comparisons== != < > <= >=, logic&& || !, parentheses( ). - Literals: numbers (
42,3.14), strings in quotes ("hello"), booleans (true,false). - Data references: inside an expression you can reference parameters and context values by name —
param.total,ctx.items,recipient.email. - Function call:
NAME(argument1, argument2). Names are case-insensitive and understand Russian aliases.
Functions
Names are given in their canonical (English) form. Each function also accepts a Russian alias — case is not significant.
Math
SUM, AVERAGE, MAX, MIN, MOD, POW, SQRT, PI, ROUND, CEIL, FLOOR, TRUNC, ABS, RANDBETWEEN.
Text
LEN, LEFT, RIGHT, MID, LOWER, UPPER, UPPERFIRST, REPEAT, CONCAT, SUBSTITUTE, FIND, SEARCH, FIELD, TRIM, LTRIM, RTRIM, PADLEFT, PADRIGHT, SPLIT, JOIN, STARTSWITH, ENDSWITH, CONTAINS, NL.
Logic
IF, AND, OR, NOT, EMPTY, ISNUMBER, COALESCE.
Lists
SORT, RSORT, UNIQUE, FILTER, FOREACH, REDUCE, INDEX, SLICE, COUNTA, COUNTUNIQUE, ARRAYADD, ARRAYREMOVE, ARRAYREPLACE, ARRAYFIND.
Date and time
TODAY, NOW, DATEADD, DATESUB, DATEDIF, DATEFORMAT, DATEVALUE, WEEKDAY.
JSON
TOJSON, FROMJSON, JSONPATH, JP, JSONOBJECT, JSONARRAY, KEYS, VALUES.
Cryptography and encoding
HASH, TOBASE64, FROMBASE64, FROMJWT, FROMJWK.
Parameters
PARAMID, PARAMREPLACE, PARAMREMOVE.
Examples
- 10% discount on a total:
{{= ROUND(param.total * 0.9) }}. - Condition:
{{= IF(param.total > 1000, "wholesale", "retail") }}. - String assembly:
{{= CONCAT("Order #", ctx.order_id) }}. - List size:
{{= COUNTA(ctx.items) }}.
Formula tester
The "Compute" action editor has a validation button: enter an expression and sample data and the platform returns the result and highlights syntax errors — without leaving the builder. This is useful for debugging long formulas before saving the reaction.
What's next
- Substitutions and Formulas —
{{...}}variables,ctxcontext, and parameters. - Actions — the "Compute" action and decision tables.
- Messages and Buttons — formulas in texts and button templates.
- Collections and Data — the data that formulas operate on.