If/Else Node

Configure the If/Else node to create conditional branching in your workflows.

Overview

The If/Else node enables conditional branching in your workflow. Each condition creates a separate output port that you connect to different downstream paths, allowing your workflow to take different actions based on the data.

If/Else node configuration panel If/Else node configuration panel

Configuration

To add an If/Else node to your workflow:

  1. Click Add Node and select If/Else
  2. Add two or more conditions
  3. Connect each output port to the appropriate downstream nodes

Options

Conditions

Each condition requires:

OptionDescription
PathA name for this branch (displayed on the output port)
ConditionA JavaScript expression that evaluates to true or false

Click Add Condition to add additional branches.

Writing conditions

Conditions are JavaScript expressions that evaluate against the workflow item data. Use the item object to access data from previous nodes.

Basic comparisons

item.severity === "critical"
item.alert.priority >= 3
item.source !== "test"

Boolean checks

item.alert.is_critical === true
!item.acknowledged

String operations

item.message.includes("error")
item.service.startsWith("prod-")

Combining conditions

item.severity === "high" && item.environment === "production"
item.priority > 2 || item.escalated === true

Output ports

Each condition creates an output port on the node. The ports are labeled with the Path name you specified.

When the workflow executes:

  1. Conditions are evaluated in order
  2. The item flows through the first port whose condition evaluates to true
  3. If no conditions match, the item does not continue (consider adding a catch-all condition)

Best practices

Design effective conditional logic:

  • Use descriptive path names: Name branches clearly (e.g., “Critical Alert”, “Low Priority”) so the workflow is self-documenting
  • Order conditions carefully: Place more specific conditions before general ones
  • Add a catch-all: Include a final condition like true to handle items that don’t match other conditions
  • Test with sample data: Verify conditions with realistic data before deploying

Example patterns

Severity-based routing

Route alerts to different channels based on severity:

PathCondition
Criticalitem.severity === "critical"
Highitem.severity === "high"
Othertrue

Environment filtering

Process only production events:

PathCondition
Productionitem.environment === "production"
Non-Productionitem.environment !== "production"

AI-assessed severity routing

When a Teammate node returns JSON output, the response fields become available as item.* variables. Use conditions that reference these fields to route based on the teammate’s analysis — for example, combining a severity assessment with a confidence score to decide whether to escalate.

This pattern separates AI reasoning from operational decisions. The teammate assesses the situation. The If/Else node applies team-defined thresholds. See Structured output for deterministic branching for how to configure teammate JSON output, and Workflow Patterns for complete end-to-end examples.