Switch
Routes workflow execution across multiple named cases based on a value. The node evaluates an expression and sends execution down the branch whose label matches the result.
Use Switch when you have more than two possible outcomes based on a single value:
- Route Stripe event types:
payment_intent.succeeded,customer.subscription.deleted,invoice.payment_failed - Handle different HTTP methods on the same workflow
- Route messages to different handlers based on a
typeoractionfield
For exactly two outcomes (true/false), use If instead.
| Handle | Type | Description |
|---|---|---|
input | any | The value used for case matching. |
| Handle | Type | Description |
|---|---|---|
[case label] | control | One handle per case you define. Execution flows down the matching branch. |
default | control | Execution flows here when no case matches. |
| Setting | Type | Description |
|---|---|---|
condition | expression | Expression whose result is compared against the case labels. |
cases | dynamic list | Ordered list of case labels. Each label creates one output handle. |
matchMode | enum | How to compare: exact (default), contains, or regex |
| Mode | Behavior |
|---|---|
exact | Case label must exactly equal the evaluated expression result |
contains | Case label matches if the result contains the label as a substring |
regex | Case label is treated as a regular expression pattern |
Route Stripe webhook events to different logic:
- Condition:
{{ webhook.body.type }} - Cases:
payment_intent.succeeded,customer.subscription.deleted,invoice.payment_failed - Default: connects to a Stop node
Webhook → Switch ({{ webhook.body.type }})
→ payment_intent.succeeded → [charge logic]
→ customer.subscription.deleted → [cancel logic]
→ invoice.payment_failed → [retry logic]
→ default → Stop
- Case labels are case-sensitive when
matchModeisexact. - The
defaultbranch fires if no case label matches. If you leavedefaultunconnected, execution silently stops on no-match — which is usually fine. - Cases are evaluated in order. The first matching case wins.
