Menu

Expand
Rate this page:

Split Based On...

Split Based On... Widget

Description:

Split Based On... allows you to split your Flow and connect to specific Widgets based on user conditions. Use this Widget to deal with conditions like a user replying “YES” to a SMS, or pressing “1” on their keypad while on a call.

Note: Studio conditions are not case-sensitive and automatically trim leading and trailing spaces of the values.

Required Configuration:

Name

Description

Example

Default

Variable To Test

The value (or expression) that is being tested.

For example, if you want to branch on message body, the Input would be the variable you stored the message in.

Select a predefined variable from the drop-down, or type a dynamic variable directly with curly braces: {{widgets.http_1.parsed.foo}}

{{widgets.send_message_1.message.Body}}

N/A



Transitions:

You’ll define the event(s) that trigger transitions from this Widget. You get No Match for free once you set a branch.

Name

Description

Default

Condition Matches

Example: “YES” for when text matches “YES”

NEW TRANSITION

No Match

Input does not match any of the user-defined conditions

NO MATCH

Conditions take the form: subject predicate [value] and can be set in the right-side panel.

subject: the configuration parameter defined as Input.

predicate: the operator to use -- equals, greater than, etc.

[value]: the value you are comparing against. Constants, variables, and expressions are supported. Value can be null for certain conditions, such as “is blank” or “has any value”

In the following example, we have asked the user if they would like to receive reminders. Following the Send & Wait For Reply Widget is a Split Based On... Widget that evaluates the user’s response.

We have three conditions:

  1. The user enters Y (YES) when prompted
  2. The user enters N (NO) when prompted
  3. The user enters another value (NO MATCH)

Subject

Predicate

Value

{{widgets.reminders_response.inbound.Body}}

Equals

Y

{{widgets.reminders_response.inbound.Body}}

Equals

N

The YES condition Transitions to a Send SMS Widget called REMINDERS_CONFIRM, while the NO and NO MATCH conditions Transition to a Send SMS Widget called REMINDERS_OPTOUT

Here are some usage examples of other conditions:

Subject

Predicate

Value

{{flow.data.appointment_date}}

Is After Date

2017-09-04

{{flow.data.appointment_time}}

Is Before Time 16:35

{{flow.data.reward_points}}

Greater Than

1000

{{flow.data.first_name}}

Is Blank

{{trigger.message.Body}}

Matches Any Of yes,yeah,yup

{{flow.data.survey_result}}

Regex

[1-5]

Note: Omit leading and trailing slashes. Matching is case-insensitive, and will only match if the provided regular expression matches the entire string.

Rate this page:

Need some help?

We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd browsing the Twilio tag on Stack Overflow.

        
        
        

        Thank you for your feedback!

        We are always striving to improve our documentation quality, and your feedback is valuable to us. How could this documentation serve you better?

        Sending your feedback...
        🎉 Thank you for your feedback!
        Something went wrong. Please try again.

        Thanks for your feedback!

        Refer us and get $10 in 3 simple steps!

        Step 1

        Get link

        Get a free personal referral link here

        Step 2

        Give $10

        Your user signs up and upgrade using link

        Step 3

        Get $10

        1,250 free SMSes
        OR 1,000 free voice mins
        OR 12,000 chats
        OR more