# Connection with a trigger

## The tr**igger field**

This field specifies the trigger for transitioning to another block.

<div data-with-frame="true"><figure><img src="/files/Dh5JeTdxYwxloIBqBiHn" alt="" width="563"><figcaption></figcaption></figure></div>

{% hint style="success" %}
The transition trigger can be set by a keyword (callback). You can read more about [Triggers and match type **here**](/chatbot/builder/setting/trigger/type.md).
{% endhint %}

{% hint style="info" %}
If the **Trigger** field in the connection is left empty, the transition will occur on any word or phrase from the user.
{% endhint %}

### Connection triggers

An connection with a trigger is a connection that activates a transition only if a certain trigger is met.

<div data-with-frame="true"><figure><img src="/files/EcStN9l6iR499rPqM6KI" alt="" width="563"><figcaption></figcaption></figure></div>

The connections's triggers can be set:

* By a certain word (callback) — specified in the **Trigger** field.\
  For example, when the **NO** button is pressed, the bot replies with **"Have a nice day!"**. You can read more about this **here**.\
  At the same time, words (callbacks) that the arrow should ignore can be specified (mostly used when the **Trigger** field is empty).
* By analyzing variable values — specified in the **Variable** field. You can read more about this **here**.

Additionally, it is possible to create keyboard (reply) buttons. To do this, simply enter the button text in the **Trigger** field and enable the **Display as button** toggle.

You can also specify a check for user input in the connection trigger using regular expressions:

<div data-with-frame="true"><figure><img src="/files/P3YAXNTsKMs5kYWE8pwo" alt=""><figcaption></figcaption></figure></div>

You can also use a variable for comparison:

<div data-with-frame="true"><figure><img src="/files/IOI9gD3XClCrnWypKNY3" alt=""><figcaption></figcaption></figure></div>

<mark style="color:$warning;">**However, according to the syntax rules, you cannot specify multiple comparison triggers  for the same variable in a single trigger.**</mark>

<div data-with-frame="true"><figure><img src="/files/b8pqzUAfOosrhesfSLqa" alt=""><figcaption></figcaption></figure></div>

If you need to check multiple values in a condition, use the operators **and (&&)**, **or (||)**, and others.

{% hint style="info" %}
[You can read more about variable comparison in the article of the same name.](/chatbot/functions/variables.md)
{% endhint %}

### Match type

By default, **"Fuzzy match"** is selected.&#x20;

In MaviBot, there are five types of trigger matching:

1. Fuzzy match;\
   The condition will be checked for partial matches with the user’s input. This means that if the user enters a word or phrase with mistakes or different endings, the condition will still trigger.
2. Keyword match;\
   If this option is selected, the transition will trigger if the user’s response contains at least one keyword from the "Trigger" field.
3. RegEx match;\
   The condition checks the user’s response against the regular expression you specify.
4. Exact match;\
   This condition checks the word or phrase for an exact match, without errors or modifications.
5. Semantic search.\
   This is the smart search for semantic in a client message with AI.

<div data-with-frame="true"><figure><img src="/files/wLr70mHWH1yKR8jCyJoC" alt="" width="563"><figcaption></figcaption></figure></div>

{% hint style="info" %}
For example: validating phone number format, email, input of digits only, etc. You can read more about [regular expressions **here**.](/chatbot/functions/regex.md)
{% endhint %}

### **Advanced connection settings**

To open the Advanced settings, click on **"Advanced settings"** below the **Match type** field, as shown in the image below.

<div data-with-frame="true"><figure><img src="/files/6kC7cNlB1BSdeboRFOFo" alt="" width="563"><figcaption></figcaption></figure></div>

### Ignore triggers

Enter the "negative words" here — words or phrases that the bot should not respond to when checking the trigger.

<div data-with-frame="true"><figure><img src="/files/WWhha9Lpz09x73qdLU3s" alt="" width="563"><figcaption></figcaption></figure></div>

### Variable

The variable for comparison works together with the trigger or the "Ignore triggers" stroke. That is, both the trigger and the trigger in the variable must be met.

<div data-with-frame="true"><figure><img src="/files/nz4buIsQ54ASgfUAaLOw" alt="" width="563"><figcaption></figcaption></figure></div>

If you specify only the variable name in the comparison variable field, without an expression, the condition will be compared with the variable’s value instead of the user’s input.

{% hint style="warning" %}
You should specify it without `#{}`, using only the variable name.
{% endhint %}

In the example shown in the image below, the transition will occur if the value of the "AGE"variable:

<div data-with-frame="true"><figure><img src="/files/PE01h8eOXwvwzJI8lGH8" alt=""><figcaption></figcaption></figure></div>

The example created four blocks:

1. A **Start block** for entering the bot: this block asks the client's age.
2. A **second block** with a connection that collects the client's data into a variable (this variable will help route the client through the funnel).
3. **Two blocks** connected to the previous block:
   * If the client is **over 18**, the message "The second message" will be sent.
   * If the client is **under 18**, the message "I'm sorry, you can't text to the bot" will be sent.

<div data-with-frame="true"><figure><img src="/files/aLKThPQPZQPXdbLUCv3V" alt="" width="563"><figcaption></figcaption></figure></div>

<div data-with-frame="true"><figure><img src="/files/gjxGE8ZQdDMHeyAzCjLf" alt="" width="563"><figcaption></figcaption></figure></div>

{% hint style="success" %}
Learn more about data collection connections in the article "[Connection with a data collection](/chatbot/builder/connections/data.md)".
{% endhint %}

Step 1. Create four blocks.

<figure><img src="/files/4JFFo5hZkr5asQjUIYzo" alt="" width="375"><figcaption></figcaption></figure>

Step 2. Connect the "Start" block to the second "Chat" block.

<div data-with-frame="true"><figure><img src="/files/PZCQVIL0dhhXH9DSI32N" alt="" width="563"><figcaption></figcaption></figure></div>

Step 3. Go to the connection settings and activate the "Data collection" checkbox.

<div data-with-frame="true"><figure><img src="/files/Cc3r4m2DhXxX8GaHLr3v" alt="" width="563"><figcaption></figcaption></figure></div>

Step 4. Enter the variable in the "Input data" field and save the connection settings.

<figure><img src="/files/3AiFq2FNL7zAZ3kA61PU" alt="" width="563"><figcaption></figcaption></figure>

Step 5. Connect the second block to the remaining blocks.

<div data-with-frame="true"><figure><img src="/files/o7EeivqAyYrRjKLsrp9u" alt="" width="563"><figcaption></figcaption></figure></div>

Step 6. Go to the connection settings and enter 'age ≥ 18' in the "Variable" field.

<div data-with-frame="true"><figure><img src="/files/nH6Ir4Lyj150vdrmCDqj" alt=""><figcaption></figcaption></figure></div>

Step 7. Set the timer to "0 seconds" on the same connector.

<div data-with-frame="true"><figure><img src="/files/OFWn00iUicCnYUIerR7z" alt=""><figcaption></figcaption></figure></div>

Step 8. Set the value to "age < 18", and configure the connector similarly to the previous one.

<div data-with-frame="true"><figure><img src="/files/GxMHSAUXARppZcAgnuSg" alt=""><figcaption></figcaption></figure></div>

{% hint style="success" %}
Done! You have now learned how to create a bot that checks a client's age and sends a message based on their age!
{% endhint %}

### Priority

By default, the priority value is set to 10. The higher the priority of the condition, the earlier it will be checked.

<div data-with-frame="true"><figure><img src="/files/WJkg8dOjUcA40oZc0dz2" alt="" width="563"><figcaption></figcaption></figure></div>

### Callback-Only trigger

If this toggle is activated, the client will only proceed to the next block connected by the arrow if a callback is received by the system.

<div data-with-frame="true"><figure><img src="/files/BnjaLGmT9QGZAfAwExXX" alt="" width="386"><figcaption></figcaption></figure></div>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.mavibot.ai/chatbot/builder/connections/trigger.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
