Condition Node
Documentation for the Condition node in the SMSPort Visual Bot Builder. Learn how to route customer conversations based on dynamic conditions, variables, customer answers, and mathematical or text comparisons.
The Condition card allows your bot to make intelligent runtime decisions. Depending on whether an expression evaluates to True or False, the bot immediately takes the corresponding branch.
Operations & Logic Flow
graph TD
PrevNode[Previous Node: Ask Age] --> Cond[Condition: gt({{age}}, 60)]
Cond -->|true| SeniorCare[Send Text: Routed to Senior Citizen Priority Care]
Cond -->|false| GeneralQueue[Send Text: Routed to Standard Consultation]
Cond -->|default| Fallback[Default Fallback Branch]- True Branch: Followed when the expression evaluates to truthy (boolean
true, non-zero number, non-empty string). - False Branch: Followed when the expression evaluates to
false,0, ornull. - Default / Fallback Branch: Followed if an expression encounters a runtime error or uninitialized variable.
Inspector Screen: Field-by-Field Guide
When you click on a Condition node in the canvas, the right-side property inspector displays:
1. Expression Mode
- Label on Screen: Condition Mode
- Options:
Simple Builder|Advanced Expression (Formula) - Default:
Simple Builder
2. Simple Builder Mode
- Variable Key: The bot variable you want to test (e.g.
patient_age,triage_score,user_intent). - Operator Dropdown:
equals: Exact match ({{triage_grade}} == 'Emergency')not_equals: Does not matchcontains: Text contains substring ({{message_text}} contains 'pricing')greater_than(>): Numeric comparisongreater_or_equal(>=)less_than(<)less_or_equal(<=)in_list: Matches one of comma-separated values (e.g.dental, ortho, cardio)is_empty: Checks if variable was never provided or is blank
- Comparison Value: The static value or variable to compare against (e.g.
60,true,emergency).
3. Advanced Expression Mode (Formula)
Write complex boolean formulas combining multiple conditions:
| Expression Formula | Meaning | Real Use Case |
|---|---|---|
gt({{patient_age}}, 60) |
Numeric age > 60 | Senior citizen triage |
and(equals({{status}}, 'VIP'), gt({{cart_total}}, 500)) |
VIP customer AND bill > $500 | High-value routing |
or(contains({{text}}, 'pain'), contains({{text}}, 'bleeding')) |
Urgency keywords | Emergency dispatch |
not(is_empty({{patient_email}})) |
Email is provided | Skipping intake step |
Output Branches & Canvas Connections
A Condition card has 3 distinct output handles on the canvas:
true(Green handle): Connect this wire to the action you want to take when the condition passes.false(Red handle): Connect this wire to the alternative path when the condition fails.default(Gray handle): Connect this wire to handle edge cases (e.g. user entered non-numeric text for age).
Step-by-Step Tutorial: Age-Based Clinical Routing
Here is how to set up an automated screening flow:
- Add
Ask NumberCard:- Label:
Ask Age - Prompt: "Please enter your age in years:"
- Save answer to:
patient_age
- Label:
- Add
ConditionCard:- Variable:
{{patient_age}} - Operator:
greater_or_equal - Comparison Value:
60
- Variable:
- Wire Outputs:
- Connect
truehandle to a Send Text card: "You qualify for our Senior Priority Consultation. Connecting to Dr. Rao..." - Connect
falsehandle to a Send Text card: "Please choose from our general outpatient clinics below." - Connect
defaulthandle to an Ask Number card to ask the patient to re-enter a valid number.
- Connect
Common Issues & Troubleshooting
1. "Expression evaluated to false unexpectedly"
- Cause: Type mismatch. For example, comparing a text string
"60"with number60. - Fix: When using
Ask Text, numbers are stored as strings. UseAsk Numberso the bot engine parses the response as a numeric float/integer.
2. "Variable not found in scope"
- Cause: The variable name in
{{...}}does not match the output variable name configured in the preceding card. - Fix: Check the preceding
AskorData Lookupcard and ensure the variable name matches exactly (e.g.{{patient_age}}vs{{patientAge}}). Variable names are case-sensitive.