> ## Documentation Index
> Fetch the complete documentation index at: https://docs.jelou.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Conditional

> Direct the conversation along different paths based on user responses or data

The **Conditional** node acts as a decision point within your flow: it evaluates information you already have about the user and decides which path to take. Think of it as a fork in the road — depending on what the user responds or the data they have, the conversation will follow one route or another.

## Key concept: paths and rules

Before configuring, it is important to understand two concepts:

* **Path**: a route the conversation can follow. Each path has a descriptive name and one or more rules that must be met for it to activate.
* **Rule**: an individual condition that compares a variable against a value. For example: *"the user's age is greater than or equal to 18"*.

<Note>
  If a path has **multiple rules**, **all** of them must be met for that path to activate (AND logic). If you need it to activate when **any** of the conditions is met, create **separate paths** for each one.
</Note>

### Default path: "Otherwise"

Every Conditional node automatically includes a path called **"Otherwise"** (fallback). This path activates when **none** of the other paths are met. It is your safety net to ensure the conversation always has a path to follow.

***

## Step-by-step configuration

<Steps>
  <Step title="Create a new path">
    Click **"New path"** to add your first condition. Give it a descriptive name that helps you quickly identify what it evaluates (for example: "Adult", "Premium customer", "Business hours").
  </Step>

  <Step title="Configure the first rule">
    Each rule has three parts:

    1. **Variable** — the data you want to evaluate (for example, `{{$memory.age}}`)
    2. **Operator** — how you want to compare that data (for example, "Greater than or equal")
    3. **Value** — what you compare it against (for example, `18`)
  </Step>

  <Step title="Add more rules if needed">
    If you need multiple conditions to be met at the same time, click **"+"** inside the same path to add additional rules. All rules within a path are evaluated with **AND** logic (all must be true).
  </Step>

  <Step title="Create additional paths">
    Repeat the process for each alternative route you need. Each path is evaluated in order: the first one that is met will be the one executed.
  </Step>

  <Step title="Connect the following nodes">
    Each path (including "Otherwise") has a connection point on the right. Drag a line from each point to the node that should execute on that route.
  </Step>
</Steps>

***

## Available operators

Operators define **how** the variable is compared to the value. They are organized into four categories:

### Equality comparison

| Operator      | Description                | Example                                       |
| :------------ | :------------------------- | :-------------------------------------------- |
| **Equal**     | The value is exactly equal | `{{$memory.status}}` equal to `active`        |
| **Not equal** | The value is different     | `{{$memory.status}}` not equal to `cancelled` |

### Numeric comparison

| Operator                  | Description                   | Example                                           |
| :------------------------ | :---------------------------- | :------------------------------------------------ |
| **Greater than**          | The value is strictly greater | `{{$memory.age}}` greater than `18`               |
| **Greater than or equal** | The value is greater or equal | `{{$memory.score}}` greater than or equal to `70` |
| **Less than**             | The value is strictly less    | `{{$memory.attempts}}` less than `3`              |
| **Less than or equal**    | The value is less or equal    | `{{$memory.debt}}` less than or equal to `0`      |

### Text search

| Operator                | Description                                  | Example                                       |
| :---------------------- | :------------------------------------------- | :-------------------------------------------- |
| **Contains**            | The text includes the word or phrase         | `{{$message.text}}` contains `help`           |
| **Does not contain**    | The text does not include the word or phrase | `{{$message.text}}` does not contain `cancel` |
| **Starts with**         | The text begins with the value               | `{{$user.email}}` starts with `admin`         |
| **Does not start with** | The text does not begin with the value       | `{{$user.phone}}` does not start with `+593`  |
| **Ends with**           | The text ends with the value                 | `{{$user.email}}` ends with `@company.com`    |

### Type validation (Is / Is not)

The **Is** and **Is not** operators allow you to verify whether a variable corresponds to a specific data type. Instead of entering a value, you select the type from a list:

| Type             | What it validates            |
| :--------------- | :--------------------------- |
| **Alphanumeric** | Letters and numbers combined |
| **Alphabetic**   | Letters only                 |
| **Name(s)**      | Person name format           |
| **Number**       | Numeric values only          |
| **Email**        | Email address format         |
| **ID number**    | Identity document number     |
| **URL**          | Web link format              |
| **Date**         | Date format                  |
| **Image**        | Image file                   |
| **Tax ID**       | Unique Taxpayer Registry     |
| **Location**     | Coordinates or address       |

**Example**: `{{$memory.email}}` **Is** → **Email** verifies that what the user entered has an email address format.

### Empty check

| Operator      | Description                        | Example                         |
| :------------ | :--------------------------------- | :------------------------------ |
| **Empty**     | The variable has no assigned value | `{{$memory.name}}` is empty     |
| **Not empty** | The variable has some value        | `{{$memory.name}}` is not empty |

<Note>
  The **Empty** and **Not empty** operators do not require a comparison value — they only evaluate whether the variable has content or not.
</Note>

### Regular expressions (Regex)

| Operator            | Description                      | Example                                    |
| :------------------ | :------------------------------- | :----------------------------------------- |
| **Regex match**     | Matches the regex pattern        | `{{$message.text}}` regex match `^\d{10}$` |
| **Regex not match** | Does not match the regex pattern | `{{$message.text}}` regex not match `[<>]` |

<Warning>
  Regular expressions are an advanced tool. If you are not familiar with regex, the other operators cover most common scenarios.
</Warning>

***

## Evaluation logic

The Conditional node evaluates paths **from top to bottom**, in the order they appear in the panel. The first path whose rules are met will be the one executed.

```
Is Path 1 met?
  └─ Yes → Execute Path 1 route
  └─ No → Is Path 2 met?
            └─ Yes → Execute Path 2 route
            └─ No → Is Path 3 met?
                      └─ Yes → Execute Path 3 route
                      └─ No → Execute "Otherwise" route (fallback)
```

<Note>
  You can **reorder paths** by dragging them with the grab icon (⠿) that appears to the left of each path. This is important because the order affects which one is evaluated first.
</Note>

### AND vs OR logic

| What you need                       | How to configure it                               |
| :---------------------------------- | :------------------------------------------------ |
| All conditions met at the same time | Add multiple rules **within the same path**       |
| Any one of the conditions met       | Create **separate paths**, one for each condition |

***

## View modes

The configuration panel offers two display modes you can toggle with the view button in the upper corner:

* **Expanded view**: shows each rule as a card with descriptive labels (Variable, Operator, Value). Ideal when you are configuring conditions for the first time.
* **Compact view**: shows each rule on a single horizontal line. Ideal when you already know the conditions and want a quicker overview.

***

## Practical examples

### Age verification

A flow that needs to verify whether the user is of legal age:

| Path          | Rule | Variable          | Operator              | Value |
| :------------ | :--- | :---------------- | :-------------------- | :---- |
| Adult         | 1    | `{{$memory.age}}` | Greater than or equal | `18`  |
| **Otherwise** | —    | —                 | —                     | —     |

The "Adult" path activates if the age is 18 or more. Any other case continues through "Otherwise".

### Routing by country and customer type

A flow that directs premium customers from Colombia to a special flow:

| Path             | Rule | Variable                    | Operator | Value      |
| :--------------- | :--- | :-------------------------- | :------- | :--------- |
| Premium Colombia | 1    | `{{$user.country}}`         | Equal    | `Colombia` |
|                  | 2    | `{{$memory.customer_type}}` | Equal    | `premium`  |
| Regular Colombia | 1    | `{{$user.country}}`         | Equal    | `Colombia` |
| **Otherwise**    | —    | —                           | —        | —          |

In "Premium Colombia", **both** rules must be met (AND): the country must be Colombia **and** the customer type must be premium. If only the first is met, the flow moves on to evaluate "Regular Colombia".

### Input format validation

A flow that validates whether the user entered an email address:

| Path          | Rule | Variable            | Operator | Type  |
| :------------ | :--- | :------------------ | :------- | :---- |
| Valid email   | 1    | `{{$memory.email}}` | Is       | Email |
| **Otherwise** | —    | —                   | —        | —     |

If the data has an email format, it continues through "Valid email". If not, you can use the "Otherwise" path to ask the user to enter it again.

### Intent detection from text

A flow that detects keywords in the user's message:

| Path            | Rule | Variable            | Operator | Value    |
| :-------------- | :--- | :------------------ | :------- | :------- |
| Wants to cancel | 1    | `{{$message.text}}` | Contains | `cancel` |
| Wants help      | 1    | `{{$message.text}}` | Contains | `help`   |
| Greeting        | 1    | `{{$message.text}}` | Contains | `hello`  |
| **Otherwise**   | —    | —                   | —        | —        |

Each path is independent (OR logic): if the message contains "cancel", it follows the first route; if it contains "help", the second, and so on.
