Choose which step to execute next based on a condition or value.Component key: branch
The branch component allows you to add branching logic to your integration. Think of branches like if/then or switch/case programming statements. Your integration can follow one branch or another depending on the values of some config variables or results from previous steps.
For example, if your customers have different data repositories (like AWS S3, Azure Files, or Dropbox) that they would like integrations to write data to, you can use the Branch On Value action to execute AWS, Azure or Dropbox actions based on a config variable that is set for that customer.
You can also use the Branch On Expression action to follow different branches of execution based on complex comparisons and expressions. This is explained in more detail below.
Choose which step to execute next based on a condition | key: branchOnExpression
|conditions||The set of conditions to satisfy in order to branch.|
The branch on expression action allows you to create logical branches within your integration based on comparisons of config variables, results from previous steps, or static values. You can use the following comparison functions to compare two values:
- equals: check that the two fields are equal to one another.
- does not equal: check that the two fields are not equal to one another.
- is greater than: check that the left field is greater than the right field.
- is greater than or equal to: same as is greater than, but the values can also be equivalent.
- is less than: check that the left field is less than the right field.
- is less than or equal to: same as is less than, but the values can also be equivalent.
- contains: check that the left field contains the right field.
The left field must be an array.
For example, you can check if
- does not contain: check that the left field (an array) does not contain the right field.
Multiple expressions can be grouped together with And or Or clauses, which execute like programming and and or clauses:
Choose which step to execute next based on a value. | key: branchOnValue
Branch Value Mapping
|branchValueMappings||The branches that are associated with an expected value.|
- name: Send SMS
- name: Send Email
|inputValue||The value used for routing to a branch. This should reference a config variable or output from a previous step.|
The branch on value action allows you to branch into one of many paths of an integration based on an input and branch mapping. Think of it like a switch/case or if/elseif/else statement.
For example, if you have a config variable that could be set to
"slack" based on how your customer would like to receive notifications, you can create branches for SMS, email, and Slack:
This setup would be equivalent to some pseudocode reading:
An "else" branch is generated in the case that the input value does not match any of the values in your branch value mapping. In the example above, if the notification preference config variable is not equal to "sms" or "email", it's assumed that it must be equal to "slack", and the "Slack" branch is executed.