Logic Nodes
Logic nodes allow your bot to make smart decisions, validate data, and branch into different paths.
🔀 Type Switch (logic.type_switch)
This is an advanced node for handling Complex Data Types. It works like a traffic director for data shapes.
Use Case: You have a generic "Update" object, but you want to do different things if it's a New Member event vs a Message event.
How it works
- Connect a generic data object to the
Valueinput. - The node automatically detects the possible "Variants" (types).
- It creates a Flow Output for each variant (e.g.,
Case_Message,Case_NewMember). - It creates a Data Output for each variant with specific fields.
🔎 Match Pattern (logic.match)
A powerful version of the Switch node that supports Regular Expressions.
Configuration
- Cases: A list of patterns to check.
- Mode: Select
Exact MatchorRegexfor each case.
Example
| Case | Pattern | Matches |
|---|---|---|
| 1 | ^help | "help me", "help" |
| 2 | order_\d+ | "order_123" |
| 3 | `(yes | yeah |
Outputs:
- A unique Flow Output for each case (e.g.
Case 1). Index: Which case number matched (1, 2, 3...).Key: The value of the matching pattern.
⚖️ Condition (logic.condition)
The standard If/Else check.
Configuration
- Expression: A boolean formula (e.g.,
var.age >= 18). - Else Ifs: Additional conditions to check if the first one fails.
Outputs:
True: If the expression is true.False: If all expressions fail.Else If X: If a specific alternative condition matches.
🔢 Switch (logic.switch)
Simple routing based on exact values. Great for menus.
Configuration
- Cases: List of strings (e.g., "Support", "Sales", "Tech").
Outputs:
- A Flow Output for each string.
Default: If the input doesn't match any case.
🧩 Regex Check (logic.regex)
Validates if a string matches a pattern (e.g., "Is this a valid email?").
Outputs:
Match: It fits the pattern.NoMatch: It doesn't fit.MatchedText: The part of the string that matched.