Keragon’s Branch logic allows you to control the flow of your workflows based on specific conditions. With this, you can create dynamic and intelligent automations that adapt to different scenarios by splitting the workflow into multiple paths.
When to Use the Branch Logic
- Execute different actions based on user attributes (e.g., gender, subscription status).
- Route leads or tickets to appropriate teams based on priority.
- Handle different data scenarios without duplicating workflows.
How to Use the Branch Logic
1. Add the Branch Logic Step
Open your workflow editor.
Click the + icon to add a new step.
Navigate to the "Logic" tab.
Select the "Branch" action.
2. Configure Branches
-
Click on the "Branch" step in the editor. The step panel lists each branch path, plus a "Test step" button and an "Add new branch" button.
-
Every Branch step also has a Default path on the canvas. It runs when none of the branch conditions are met.
-
Click a branch path to open it, then set the "Branch name" to something meaningful, for example
"Male","Female"or"Other". Clear names also make test results and run details much easier to read, since new branches all start with the same default name.
Add Conditions to Branches
-
Under "Execute this branch if...", choose whether All or Any of the conditions should be true for the branch to run.
-
Value 1 is the variable you want to evaluate. Map it using the variable selector.
-
Comparison is the operator, for example
equals,does not equal,containsorstarts with. -
Value 2 is the value you want to compare against, for example
"Male". -
Click "Add condition" to add more conditions to the same branch, or "Add group" to combine conditions into groups.
-
Click "Save" to apply the conditions.
3. Add More Branches if Needed
Click "Add new branch" to create additional paths.
Repeat the process of adding conditions for each branch.
Note on how branches are evaluated. The Branch step evaluates one branch at a time, from left to right, and takes the first branch whose conditions are met. Only that branch runs. Any branches to its right are never checked, even if their conditions would also be met. Keep this in mind when ordering your branches, and place the most specific conditions first. When you test the step, branches that were skipped this way show as unchecked (see section 6).
4. Rename the Branch Step
Click on the title of the Branch step and rename it to clearly indicate its purpose.
5. Add Actions Under Each Branch
Based on the logic paths, add the relevant actions under each branch. For example
Male sends a custom message.
Female runs a different set of actions.
Default handles cases that don’t match any specific criteria.
6. Test the Branch Step
-
Open the Branch step and click "Test step". Only the Branch step is evaluated. The steps that come after it will not run as part of the test, so it is safe to test even when later steps write data to other systems.
-
The test panel has three tabs. Details shows the run status, Inputs lists each branch with its name and the condition that was evaluated, and Outputs shows which branch was taken and what happened to every other branch.
-
Tip. Before testing, run the steps above the Branch step so their data is available for the conditions to evaluate.
Reading the Outputs tab
branchTaken shows the name of the branch the run would follow. If no condition was met, it shows Default.
branches lists every path out of the step, including Default, in the same left to right order the canvas draws them. Each entry has a position, a title and an outcome. The position tells branches apart even when two of them share the same name.
| Outcome | What it means |
|---|---|
matched | The conditions were met and this is the branch the run takes |
did-not-hold | The conditions were checked and were not met |
unchecked | The branch was never evaluated because an earlier branch already matched. This is not the same as failing |
used | Shown on Default when no branch matched, so the run falls through to Default |
not-used | Shown on Default when a branch matched, so Default is skipped |
Example 1. The first branch fails and the second one matches
{
"branchTaken": "Send to channel product",
"branches": [
{ "position": 1, "title": "Send to channel bots", "outcome": "did-not-hold" },
{ "position": 2, "title": "Send to channel product", "outcome": "matched" },
{ "position": 3, "title": "Default", "outcome": "not-used" }
]
}
Example 2. No branch matches, so the run falls through to Default
{
"branchTaken": "Default",
"branches": [
{ "position": 1, "title": "Patient is in Alabama", "outcome": "did-not-hold" },
{ "position": 2, "title": "Patient is in Alaska", "outcome": "did-not-hold" },
{ "position": 3, "title": "Default", "outcome": "used" }
]
}
Example 3. Two branches would both be true
Here both branches kept the default name, so position is the only thing that tells them apart. The first branch matches, and the second is never evaluated, so it reads unchecked. If you expected the second branch to run, reorder your branches or make their conditions more specific.
{
"branchTaken": "If condition is true then...",
"branches": [
{ "position": 1, "title": "If condition is true then...", "outcome": "matched" },
{ "position": 2, "title": "If condition is true then...", "outcome": "unchecked" },
{ "position": 3, "title": "Default", "outcome": "not-used" }
]
}
Because the Branch step records its inputs and outputs, the run details for a published workflow also show which branch was taken on each run, in this same format.
Testing a Continue If step
A Continue If step only has one question to answer, whether the run carries on. Its Outputs tab shows { "continued": true } when the condition holds and the run would continue, and { "continued": false } when the condition fails and the run would stop.
Available Comparison Operators
| Operator | Explanation |
|---|---|
| is true | Checks if a value is true |
| is false | Checks if a value is false |
| is null | Checks if a value is null |
| is not null | Checks if a value is not null |
| is empty | Checks if an array is empty |
| is not empty | Checks if an array is not empty |
| equals | Checks if two values are equal |
| does not equal | Checks if two values are not equal |
| greater than | Checks if a value is greater |
| greater than or equal | Checks if a value is >= another |
| less than | Checks if a value is less |
| less than or equal | Checks if a value is <= another |
| starts with | Checks if a string starts with value |
| does not start with | Checks if a string doesn't start with value |
| contains | Checks if a string contains value |
| does not contain | Checks if a string doesn’t contain value |
Example Use Case:
- Check the patient’s gender and perform actions accordingly:
- If
gender = Male, trigger a notification for a male-specific program. - If
gender = Female, schedule a follow-up for a female wellness program. - Else, send a general message.
- If