Skip to main content
The If/Else stage routes conversations based on variable values and conditions. Create branching logic to handle different scenarios.

Overview

If/Else nodes evaluate conditions against collected data and route to different paths:
             ┌─────────────┐
             │   If/Else   │
             └──────┬──────┘
        ┌──────────┼──────────┐
        │          │          │
        ▼          ▼          ▼
   [Condition A] [Condition B] [Default]
If/Else nodes are colored yellow on the canvas.

Configuration

Conditions

Each condition evaluates a variable against a value:
PropertyDescription
VariableThe variable to check
OperatorComparison operator
ValueValue to compare against
TargetNode to route to if true

Operators

OperatorDescriptionExample
==Equalsstatus == "active"
!=Not equalsplan != "free"
<Less thanage < 18
>Greater thantotal > 100
<=Less than or equalquantity <= 10
>=Greater than or equalscore >= 80
existsVariable is setorder_number exists
is_emptyVariable not setemail is_empty
containsContains substringissue contains "refund"
not_containsDoesn’t containnotes not_contains "urgent"
inValue in listdepartment in ["sales", "support"]
not_inValue not in liststatus not_in ["cancelled", "expired"]
regexMatches patternorder_number regex "^[A-Z]{2}[0-9]{6}$"

Default Target

The fallback route when no conditions match. Always set a default to handle unexpected cases.

Evaluation Order

Conditions are evaluated in order from top to bottom. The first matching condition wins.
Conditions:
  1. issue_type == "billing"     → Billing Team
  2. issue_type == "technical"   → Tech Support
  3. priority == "high"          → Urgent Queue
  4. Default                     → General Support
If issue_type is “billing”, the caller goes to Billing Team even if priority is also “high”.

Example Configurations

Conditions:
  - variable: department
    operator: ==
    value: "sales"
    target: Sales Conversation

  - variable: department
    operator: ==
    value: "support"
    target: Support Conversation

  - variable: department
    operator: ==
    value: "billing"
    target: Billing Conversation

Default: General Conversation
Conditions:
  - variable: customer_tier
    operator: ==
    value: "enterprise"
    target: VIP Support

  - variable: wait_time
    operator: >
    value: "10"
    target: Priority Queue

  - variable: issue_severity
    operator: ==
    value: "critical"
    target: Urgent Handler

Default: Standard Queue
Conditions:
  - variable: order_status
    operator: ==
    value: "shipped"
    target: Tracking Info

  - variable: order_status
    operator: ==
    value: "processing"
    target: Processing Update

  - variable: order_status
    operator: ==
    value: "cancelled"
    target: Cancellation Handling

  - variable: order_status
    operator: is_empty
    target: Order Lookup

Default: Order Support
Conditions:
  - variable: language
    operator: ==
    value: "spanish"
    target: Spanish Agent

  - variable: return_customer
    operator: ==
    value: "true"
    target: Loyalty Program

  - variable: cart_value
    operator: >
    value: "500"
    target: Premium Sales

Default: Standard Flow

Common Patterns

Validate Required Data

Check if required information was collected:
Conditions:
  - variable: customer_email
    operator: exists
    target: Proceed with Email

  - variable: customer_phone
    operator: exists
    target: Proceed with Phone

Default: Collect Contact Info

Business Hours Routing

Route based on time-related variables:
Conditions:
  - variable: is_business_hours
    operator: ==
    value: "true"
    target: Live Support

Default: After Hours Message

Sentiment-Based Routing

Route frustrated customers differently:
Conditions:
  - variable: sentiment
    operator: ==
    value: "angry"
    target: De-escalation Handler

  - variable: sentiment
    operator: ==
    value: "frustrated"
    target: Priority Support

Default: Standard Support

Flow Examples

Simple Branch

┌─────────────────┐
│ Data Extraction │
│ - issue_type    │
└────────┬────────┘

    ┌────▼────┐
    │ If/Else │
    └────┬────┘
    ┌────┴────┬────────┐
    │         │        │
    ▼         ▼        ▼
[Returns] [Exchange] [Default]

Nested Conditions

┌─────────────────┐
│ Data Extraction │
└────────┬────────┘

    ┌────▼────┐
    │ If/Else │ (Department)
    └────┬────┘

    ┌────▼────┐
    │ If/Else │ (Priority)
    └────┬────┘

    ┌────▼────┐
    │ Handler │
    └─────────┘

Best Practices

Always Set Default

Every If/Else needs a default path. Unhandled cases break flows.

Order Matters

Put most specific conditions first. More general conditions go later.

Test All Paths

Verify each condition branch works as expected with test data.

Keep It Simple

Avoid deeply nested If/Else chains. Consider restructuring complex logic.