Appearance
If node
The If node splits a flow in two. It evaluates a condition and sends the flow down either the true port or the false port — the basic building block for "do this, otherwise do that".
Component id: flowrunner/if.
Two ways to write the condition
If supports two condition formats. If a structured expression is present it wins; otherwise the engine falls back to a text condition.
Structured expression (expression)
A structured expression is the format the visual condition builder produces. It's a tree of comparisons combined with and / or groups. Each comparison has a left operand, an operator, and (for most operators) a right operand. Operands are either a reference (variable.field) or a literal.
Supported operators:
| Operator | Meaning | Right side |
|---|---|---|
== / != | equal / not equal | required |
> < >= <= | numeric comparison | required |
contains | left string contains right string | required |
startsWith / endsWith | string prefix / suffix | required |
truthy | left value is truthy | none |
falsy | left value is falsy | none |
Groups combine children: an and group is true when every child is true; an or group is true when any child is true. An empty group evaluates to true.
Text condition (condition)
When no structured expression is set, the engine reads the condition string and runs a small, deliberately-limited evaluator. It supports a single comparison — no &&, ||, parentheses, or function calls:
text
start.age >= 18
response.status == 200
start.role != "admin"
result.count # bare ref → truthy checkBoth sides may be references or literals. Literals are numbers, "quoted strings", true, false, or null. A dotted token like start.age reads from refs; a bare token is treated as a namespace lookup.
Config
| Field | Required | Description |
|---|---|---|
expression | No | Structured condition tree (kind: 'group' | 'cmp'). Used when present. |
condition | No | Text condition string. Used as the fallback when there is no structured expression. |
Ports
| Port | Followed when |
|---|---|
true | The condition evaluated to true. |
false | The condition evaluated to false. |
If evaluating the condition throws an error, the flow goes down false — unless you have wired an error port, in which case the failure routes there instead.
Example
Route paying customers differently from free users:
text
If condition: start.plan == "pro"
true → grant premium access
false → show upgrade promptTIP
For anything more complex than one comparison — multiple conditions combined with and/or — use the structured expression builder rather than the text condition, which only handles a single comparison.