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:
| Property | Description |
|---|
| Variable | The variable to check |
| Operator | Comparison operator |
| Value | Value to compare against |
| Target | Node to route to if true |
Operators
| Operator | Description | Example |
|---|
== | Equals | status == "active" |
!= | Not equals | plan != "free" |
< | Less than | age < 18 |
> | Greater than | total > 100 |
<= | Less than or equal | quantity <= 10 |
>= | Greater than or equal | score >= 80 |
exists | Variable is set | order_number exists |
is_empty | Variable not set | email is_empty |
contains | Contains substring | issue contains "refund" |
not_contains | Doesn’t contain | notes not_contains "urgent" |
in | Value in list | department in ["sales", "support"] |
not_in | Value not in list | status not_in ["cancelled", "expired"] |
regex | Matches pattern | order_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.