Skip to main content

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

  1. Connect a generic data object to the Value input.
  2. The node automatically detects the possible "Variants" (types).
  3. It creates a Flow Output for each variant (e.g., Case_Message, Case_NewMember).
  4. 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 Match or Regex for each case.

Example

CasePatternMatches
1^help"help me", "help"
2order_\d+"order_123"
3`(yesyeah

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 "If This, Then That" node.

Use it to send users down different paths based on data.

Configuration

  • Expression: A simple math or logic formula.
  • Else Ifs: Check other things if the first check fails.

Examples:

  • Check age: var.age >= 18
  • Check membership: user.is_premium == true
  • Check input: message.text == "Secret"

Outputs:

  • True: It matched!
  • False: No match.

🔢 Switch (logic.switch)

Simple routing based on exact text.

Great for menus! If user picks "Sales", go to Sales flow.

Configuration

  • Cases: List of options (e.g., "Sales", "Support").

Outputs:

  • Sales: Fires if input is "Sales"
  • Support: Fires if input is "Support"
  • Default: Fires if they typed something else

🧩 Regex Check (logic.regex)

Validates patterns (like emails or phone numbers).

Common Patterns:

  • Email: .+@.+\..+
  • Phone: \d{10}
  • Hash tag: #\w+

Outputs:

  • Match: It's valid!
  • NoMatch: Invalid format.