Logic
Nodes in the Logic section control scenario branching and choose which execution path should run next.
1. Condition
Condition evaluates a JavaScript boolean expression and routes the scenario through either the True or False branch.
Use Condition when you need to:
- check a variable value;
- evaluate an HTTP request result;
- branch by status, number, or text value;
- combine several checks in one expression;
- choose a different next step based on the result.
Settings
| Field | Meaning |
|---|---|
Expression |
JavaScript boolean expression or an expression in {{ expression }} form |
TrueAction |
Transition used when the result is true |
FalseAction |
Transition used when the result is false |
NextAction |
Internal fallback when the selected branch is empty |
The main Condition DTO does not expose NextAction, so in the editor it is better to explicitly connect both visible branches: True and False.
Connections
- Input: one standard connector.
- Outputs:
TrueandFalse. TrueActionis used when the expression evaluates to a true result.FalseActionis used when the expression evaluates to false.- If the selected branch is empty, the backend may use the internal
NextActionfallback. - If neither the selected branch nor the fallback is set, the execution has nowhere to continue.
Expressions
Condition.Expression accepts a raw JavaScript expression:
#node.12.http.statusCode == 200 && #node.12.http.isSuccess
or an expression wrapped in a single outer {{ ... }} pair:
{{ #node.12.http.statusCode == 200 && #node.12.http.isSuccess }}
Helper functions can also be used:
parseJson(#node.12.http.rawBody).items.length > 0
How the result is evaluated
The expression result is converted to boolean.
These values are treated as false:
""
0
false
no
null
undefined
NaN
These values are treated as true:
non-zero number
true
yes
any other non-empty string
Objects and arrays are not converted directly to boolean. Check a specific property or length instead.
Output variables
After execution, Condition creates:
#node.{id}.condition.result
#node.{id}.condition.action
If evaluation fails, it may also create:
#node.{id}.condition.error
condition.result contains True or False, while condition.action contains the action selected for the branch.
Example
HTTP Request
-> Condition "#node.12.http.isSuccess"
| True -> Screen "Success"
| False -> Screen "Something went wrong"
Example using JSON response data:
parseJson(#node.10.http.rawBody).order.status === "paid"
Important details
- A missing
#varbecomesnulland normally evaluates tofalse. - An empty expression, invalid JavaScript syntax, or a runtime exception creates an execution error and stops the scenario.
- A
Conditionerror does not automatically route execution to theFalsebranch. - Expressions containing
;are rejected as disallowed statements. - Objects and arrays cannot be used as a direct boolean result — check a specific property or
.length. - HTML entities inside the expression are decoded, so editor-saved
>is executed as>. - Each expression has a
100 mstimeout, a maximum of50statements, and recursion depth5. Conditioncan be used in a synchronous AI tool.
2. Switch
Switch (SwitchNode) routes a scenario by exact values of one expression. Use it instead of a chain of Condition nodes when one variable or template result should lead to several possible branches.
Settings
| Field | Meaning |
|---|---|
ValueTemplate |
Value to compare; supports #var and {{ JS }} |
Cases[] |
List of cases: static Value text plus Action transition |
NextAction |
Default branch when no case matches |
Connections
- Input: one standard connector.
- Outputs: one output for each case, plus
NextActionas the default branch. - Comparison is exact and case-sensitive.
- The first matching case wins; duplicate values are allowed.
- A matched case with an empty action falls back to
NextAction. - If no case matches and
NextActionis empty, execution has nowhere to continue and fails.
Output variables
After execution, Switch creates:
#node.{id}.switch.result
#node.{id}.switch.action
switch.result contains True when a case matched and False when the default branch was used. switch.action contains the selected action.
Example
Switch "#node.7.city"
| "Kyiv" -> Screen "Kyiv branch"
| "Lviv" -> Screen "Lviv branch"
| default -> Screen "Other regions"
Important details
- Editing cases replaces the whole cases list.
- A case
Valueis static text and does not pass through the template renderer. Switchis not used in a synchronous AI tool.
3. Go to schema
Go to schema moves a member to another schema of this bot. The member immediately receives the target schema's first screen (from its OnMemberFollow) and stays there for all subsequent messages. The node ends the chain and has no output. You can connect a button, Next, a Condition branch, a Switch case, or another transition to it; several buttons can lead to the same node, for example “Back to main menu”.
Settings
| Field (panel label) | Description |
|---|---|
toActiveSchema (Main schema (active)) |
Moves the member to the bot's main schema — whichever schema is active at the time of the transition. |
targetSchemaId (Target schema) |
Another schema of this bot. The list includes only schemas with a connected OnMemberFollow; the current schema and AI tool schemas are excluded. |
Important details
- How to return. In Telegram,
/startalways returns the member to the main schema. Instagram has no/start: add a “Back to main menu” button to each schema that leads toGo to schemawithMain schema (active). - If the transition fails (the target schema was deleted, its
OnMemberFollowwas disconnected, etc.),OnErrorruns and the member receives a response. The panel marks this node as “Schema is not available”. - Old menus, for example in Telegram. If a member presses a button from the previous schema's menu after moving, that button does not run: the bot starts
OnErrorin the member's current schema (or the main schema if the current one has noOnError). You configure the response screen inOnError. - Deletion and import. A schema targeted by
Go to schemafrom other schemas cannot be deleted: the panel shows the names of those schemas. After importing a schema into another bot, the transition target is reset (Schema not selected) — select it again. A node withMain schema (active)remains unchanged.