Branch

Choose which step to execute next based on a condition or value.

Component key: branch

Description#

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.

Actions#

Branch on Expression#

Choose which step to execute next based on a condition | key: branchOnExpression

InputKeyNotes

Condition

conditional
/ Required
conditionsThe 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 ["a","b","c"] contains "b".
  • 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:

if ((foo > 500 and bar <= 20) or ("b" in ["a","b","c"]))

Branch on Value#

Choose which step to execute next based on a value. | key: branchOnValue

InputKeyNotesExample

Branch Value Mapping

string
/ Required
branchValueMappingsThe branches that are associated with an expected value.
type: complex
value:
- name: Send SMS
type: value
value: sms
- name: Send Email
type: value
value: email

Input Value

string
/ Required
inputValueThe 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 "sms", "email" or "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:

if required_config_vars.notification_preference == "sms":
send_an_sms()
else if required_config_vars.notification_preference == "email":
send_an_email()
else:
send_a_slack_message()
// or
switch(required_config_vars.notification_preference) {
case "sms":
send_an_sms()
break
case "email":
send_an_email()
break
default:
send_a_slack_message()
}

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.