Skip to main content
Automation API

conditional

Use this action to run nested actions only when a condition holds, with an optional else branch.

Tip

Read the live config shape of each action type from GET /v1/automation/meta/action before you build on it.

In the automation editor, this action is Conditional actions in the Flow control family. Its group is control_flow, and it works with every trigger.

Send it in the actions array of Create an automation or Update an automation. An update replaces the whole array, so include the other actions.

Example​

When a deal is worth more than 50,000, this action asks the sales director for approval. Otherwise, it tells the account owner that the deal is ready to close:

{
"type": "conditional",
"config": {
"condition": {
"operator": "and",
"rows": [
{
"subject": { "kind": "variable", "source": "field", "field_id": 601, "field_type": "number", "previous": false, "collection": false, "triggering": false },
"operator": "greater_than",
"value": { "type": "number", "number": ["50000"] }
}
]
},
"action_rows": [
{
"type": "send_email",
"config": {
"to_address": ["romeo@acme.com"],
"subject": ["Approval needed: deal over 50,000"]
}
}
],
"else_action_rows": [
{
"type": "send_email",
"config": {
"to_address": ["juliet@acme.com"],
"subject": ["Deal ready to close"]
}
}
]
}
}

Config​

PropertyTypeDescriptionExample value
conditionfilter group | nullThe if condition. null or left out counts as true.{ "operator": "and", "rows": [ … ] }
action_rowsarray of nested actionsThe then branch. Runs when the condition holds. Empty when left out.[{ "type": "send_email", "config": { … } }]
else_action_rowsarray of nested actionsThe else branch. Runs when the condition fails. Leave it out to switch the else branch off.[{ "type": "exit", "config": { "exit_type": "success" } }]

To find the field IDs, see App and field IDs.

General behavior​

  • No key is required.
  • The condition and both branches live in config, like every other action. Each branch is a nested list of actions.
  • A missing, null or empty condition counts as true. The then branch runs on every run. It reads back as condition: null.
  • Leave else_action_rows out to switch the else branch off. Send it, even as [], to switch it on. There are no *_enabled flags.
  • action_rows and else_action_rows hold full action objects. GET /v1/automation/meta/action lists the types you can nest.
  • When the API rejects the input of a nested action, the error names its path, for example config/else_action_rows/0.
  • condition uses the same filter tree as the collect actions. GET /v1/automation/meta/filter lists the operators for each field type.

Requirements​

  • To add or change this action through the API, your token needs the automations:edit capability. See Capabilities.
  • You must administer the workspace that the automation's database app belongs to.

Next steps​