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.

When to Use

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 type or action field

For exactly two outcomes (true/false), use If instead.

Inputs

HandleTypeDescription
inputanyThe value used for case matching.

Outputs

HandleTypeDescription
[case label]controlOne handle per case you define. Execution flows down the matching branch.
defaultcontrolExecution flows here when no case matches.

Settings

SettingTypeDescription
conditionexpressionExpression whose result is compared against the case labels.
casesdynamic listOrdered list of case labels. Each label creates one output handle.
matchModeenumHow to compare: exact (default), contains, or regex

Match Modes

ModeBehavior
exactCase label must exactly equal the evaluated expression result
containsCase label matches if the result contains the label as a substring
regexCase label is treated as a regular expression pattern

Example

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

Common Gotchas

  • Case labels are case-sensitive when matchMode is exact.
  • The default branch fires if no case label matches. If you leave default unconnected, execution silently stops on no-match — which is usually fine.
  • Cases are evaluated in order. The first matching case wins.

See Also

  • If — binary true/false branch
  • Stop — terminate the default branch explicitly
On this page