Condition Funnel

The Condition Funnel block lets you route a conversation into different paths based on variable values, user input, or message content. It is commonly used to validate inputs (such as email or phone number), check user attributes, or control logic using numeric or text-based conditions.


1. Condition Funnel Overview

Main components

  1. Select a variable Choose the variable you want to evaluate (for example: user input, custom field, or system variable).

  2. Condition operator Defines how the selected variable will be compared to the value or rule you provide.

  3. Enter value / rule The comparison value.

    • For basic operators, this is a text or number.

    • For regex, this is a regex pattern.

  4. Add condition (+) Add multiple conditions. Each condition creates its own branch.

  5. Otherwise path If none of the conditions are met, the conversation will follow the Otherwise path.


2. Condition Operators Explained

Equality & comparison operators

Operator
Meaning
Example

Equal

Variable value is exactly the same

country = USA

Not Equal

Variable value is different

country ≠ SG

Less Than

Numeric comparison

order_count < 3

Less Than or Equal

Numeric comparison

score ≤ 60

Greater Than

Numeric comparison

order_count > 5

Greater Than or Equal

Numeric comparison

amount ≥ 1000

💡 Numeric operators should only be used with number-based variables.


List & Text Matching Operators

Operator
Meaning
Example

In

Variable matches any value in a list

country in [USA, SG]

Contains

Variable includes the given text

Message contains "refund"

Is Empty

Variable has no value

Phone number is empty


3. Matches Regular Expression (Regex)

The Matches Regex operator allows advanced pattern matching using regular expressions. It is useful for validating formats such as email addresses, phone numbers, or structured user input.

How it works

  • Enter a regex pattern between / /

  • Optionally enable regex flags for additional control

  • The condition passes if the variable matches the regex pattern

Common examples

Use case
Regex example
Example

Validate email format

^[^\s@]+@[^\s@]+\.[^\s@]+$

Validate phone number with country code

^\+[1-9]\d{6,14}$

+14155552671

Only numeric input

^\d+$

123456


4. Advanced Regex Flags Explained (Optional)

Regex flags control how the pattern is evaluated.

Flag
Name
Description

g

Global

Matches all occurrences

m

Multi Line

^ and $ apply to each line

i

Case Insensitive

Ignores letter casing

x

Extended

Allows whitespace and comments

s

Single Line

. matches newline characters

u

Unicode

Enables Unicode matching

U

Ungreedy

Makes quantifiers lazy by default

A

Anchored

Forces matching from the start

J

Jchanged

Allows duplicate named groups


5. Example Scenarios

Example 1: Email validation

  • Variable: User Input

  • Operator: Matches Regex

  • Pattern: ^[^\s@]+@[^\s@]+\.[^\s@]+$

Result

  • Matches → Continue to the next step

  • Does not match → Ask the user to re-enter a valid email address


Example 2: Route by country

  • Variable: Country

  • Operator: In

  • Value: USA, SG

Result

  • Matches (USA or SG) → Route to the regional flow

  • Otherwise → Route to the global/default flow


Example 3: Empty phone number check

  • Variable: Phone Number

  • Operator: Is Empty

Result

  • Empty → Ask the user to provide their phone number

  • Not empty → Continue the flow


6. Best Practices & Tips

  • Start with simple operators (Equal, In, Contains) before using regex.

  • Always configure an Otherwise path to prevent dead ends.

  • When using regex:

    • Anchor patterns with ^ and $ to avoid partial matches

    • Test patterns with real user input

  • Keep condition logic readable—multiple simple conditions are often clearer than one complex rule.

Last updated