Condition (If / Else)
Branch your workflow based on a condition. If the condition is true, the 'then' path runs; otherwise the 'else' path runs. Supports comparison and membership checks.
Logic action Logic
Branch your workflow based on a condition. If the condition is true, the 'then' path runs; otherwise the 'else' path runs. Supports comparison and membership checks.
At a Glance
| Field | Value |
|---|---|
| Action ID | if |
| Category | Logic |
| Connector | Not required |
| Requires gas | No |
| Funds movement | None declared |
| Tags | logic, conditional, branching, control-flow |
Payload Schema
| Field | Type | Required | Description |
|---|---|---|---|
condition | object | Yes | Condition DSL. Top-level must be $and or $or. Inside arrays: comparison format { "{{left}}": { "$op": right } } where $op is $eq, $ne, $gt, $gte, $lt, $lte, $in, $nin. Left operand (key) can be a template variable like {{node.result.field}} or literal. Right operand (value) can be number, string, template variable, or array (for $in/$nin). |
Result Schema
| Field | Type | Required | Description |
|---|---|---|---|
branch | string | Yes | Which branch to take |
Examples
json{ "type": "if", "payload": { "condition": { "$and": [ { "{{root.result.price}}": { "$gt": 1000 } } ] } }, "children": []}
bashcurl -X POST "https://api.b3os.org/v1/actions/if/test" \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "inputs": { "condition": { "$and": [ { "{{root.result.price}}": { "$gt": 1000 } } ] } }}'
Payload fields can use workflow expressions such as {{$trigger.body.amount}}, {{$nodes.fetch.result.price}}, and {{$props.asset}} when the value should come from a trigger, prior node, or reusable workflow prop.
