# Connection with a timer (пока таймеры пропускаем, Андрей сказал, что они отключены в МАВИ)

#### **Delay before answer**

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

The transition to the next block will occur after the time interval specified in the **Delay before answer** field. The time can be measured in seconds, minutes, hours, days, or months. This functionality is used to send automated messages that do not require a user response.

Leave the **Delay before answer** field empty if the transition should occur in response to a user action or message.

You can check if a message is scheduled in the **Clients** section. To do this, open the dialogue with the client, go to the **About client** tab — **Scheduled messages:**

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

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

A scheduled message can also be found in the client’s variables:

<figure><img src="/files/gZwtoPy1XThfisJLcLaW" alt=""><figcaption></figcaption></figure>

Clicking on **"Message scheduled"** will open a window with information about the message:

<figure><img src="/files/NcE2ehb9pUWTD8dElaYi" alt=""><figcaption><p>Диалог с клиентом: проверяем запланированные сообщения</p></figcaption></figure>

### **Cancel if leaving the block (toggle switch)**

Enable this toggle if you need to interrupt the sequence of automated messages when the user takes any action and moves to another block.

<figure><img src="/files/4KZ2SzH2gSIuAcCvjgiK" alt=""><figcaption></figcaption></figure>

{% hint style="warning" %}
Please note, for this setting to take effect, the client's position in the funnel must change. They need to move to a different state block.
{% endhint %}

**Example:**\
\
The client receives Message 1 with a button. If they press the button, they will receive Message 2. Their position in the funnel will change, and the message scheduled with a 10-minute timer will be canceled.\
If the client does not press the button within 10 minutes, they will receive a new message with the button saying, "You still haven’t pressed the button."

<figure><img src="/files/v0x7hdL34YfSSjeU3W2O" alt=""><figcaption><p>Вариант 1</p></figcaption></figure>

<figure><img src="/files/41n9uaEg0gvbH1CcBqzf" alt=""><figcaption><p>Вариант 2</p></figcaption></figure>

*<mark style="color:red;">**Let’s consider the error scenario**</mark>*\
\
When transitioning to the Message 1 block, a 10-minute timer arrow with the "Cancel if leaving the block" setting enabled is scheduled for the user. There is also an arrow with the condition "Button pressed" set with a 5-minute timer.\
\
In this situation, when the button is clicked, Message 2 will be scheduled and sent 5 minutes after the button click. The client does NOT change their position in the funnel until they receive Message 2 (i.e., until they transition to the Message 2 block).\
\
If the position in the funnel hasn’t changed, the client will receive the message "You still haven’t pressed the button" after 10 seconds. Then, according to the timer, the text from the "Message 2" block will follow.

<figure><img src="/files/CsRF8i6vwYGZ2YBQtvdU" alt=""><figcaption><p>Error: with the current settings, the client will receive the reminder message after 3 minutes even if they pressed the button.</p></figcaption></figure>

*<mark style="color:red;">**Second error scenario**</mark>*\
\
The client will also receive the message from the "You still haven’t pressed the button" block, even if they manage to press the button. The reason: **"Not a state"** blocks DO NOT change the client’s position in the funnel.

<figure><img src="/files/E1lXHhz1N8xQgu9hl5cC" alt=""><figcaption><p>Ошибка: блок Не состояние НЕ МЕНЯЕТ Позицию в воронке у клиента</p></figcaption></figure>

### &#x20;Cancel timed messages (toggle switch)

If the toggle is enabled, all scheduled timed messages will be canceled upon transitioning via the arrow, except for those where **"Do not cancel"** is enabled.

<figure><img src="/files/Hi3rlOUuXcycyyaXxft2" alt=""><figcaption></figcaption></figure>

### **Do not cancel** (toggle switch)

Messages scheduled via an arrow with the **"Do not cancel"** toggle enabled will remain scheduled, even if the client transitions through arrows with the **"Cancel timed messages"** toggle enabled.

<figure><img src="/files/0MM9OCl0P8Z6ti7UAGBa" alt=""><figcaption></figcaption></figure>

### Date and time of sending field

To schedule a message for a specific time, enter the sending time in the format **HH:MM** or select it using the sliders.

<figure><img src="/files/U7WwEf1UQd8R8KfUUyNN" alt="" width="563"><figcaption><p>Send time settings</p></figcaption></figure>

To schedule a message for a specific date, enter it in the format **DD.MM.YYYY** or select it using the calendar.

<figure><img src="/files/XsH4GtZjDPAynrEZ2KV3" alt=""><figcaption><p>Send date settings</p></figcaption></figure>

{% hint style="info" %}
It is best to specify the sending time in the **"Time of sending"** field along with this date field.
{% endhint %}

\
If the sending time is not specified, the message will be sent **1 minute before the start of the specified date** (at 23:59).<br>

If a delay is set in the **"Delay before response"** field, it will be added to the scheduled time.

<figure><img src="/files/whG2A5eI87CEP2gfKIY5" alt=""><figcaption></figcaption></figure>

The message will be sent at the specified date and time.<br>

If a numeric value is entered in the **"Delay before response"** field, that delay will be added to the scheduled time.

<figure><img src="/files/mpaoX5vGLjXlODL59UhW" alt=""><figcaption><p><strong>Arrow settings: Sending time + Delay before response</strong><br>The message will be sent <strong>30 minutes after</strong> the scheduled time of <strong>08:28</strong>, i.e., at <strong>08:58 on June 17</strong>.</p></figcaption></figure>

<figure><img src="/files/UCI5c7YCJHD95kAo7bDO" alt=""><figcaption><p>In the client’s card, you can view the <strong>date and time</strong> of the scheduled message, taking the delay into account.</p></figcaption></figure>

You can use variables to specify the time.

A time variable can be set either in the **project constants** or defined in the block’s **Calculator**.

<figure><img src="/files/eJdEbustM7NQkDN8kZLE" alt=""><figcaption><p>Let’s define a variable in the <strong>Calculator</strong>.</p></figcaption></figure>

Similarly, you can use a **sending date** by specifying it in the format **DD.MM.YYYY**.

<figure><img src="/files/H6oK85v1LKnyRRkuIAkx" alt=""><figcaption><p>In the arrow's <strong>"Time of Sending"</strong> field, specify the variable.</p></figcaption></figure>

### **Send if date has passed** (toggle switch)

If the message's scheduled time has already passed on the specified date, and the **"Send if date has passed"** toggle is enabled, the message will be scheduled for the next day.&#x20;

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

{% hint style="warning" %}
The **"Send if date has passed"** toggle works ONLY when used together with a message sending date.
{% endhint %}

**Scenario 1:** The arrow has a sending time set to 10:00 and the **"Send if date has passed"** toggle is OFF.\
If the client enters the funnel and receives **Message 1** at 16:34, the next message will be **scheduled for the next day**.

In the scheduled messages, they will have the text from **Message 2** set to be sent the next day at 10:00.

<figure><img src="/files/nxlgkHSTpPOcMuDXJkKB" alt="" width="563"><figcaption><p>Message 2 will NOT be sent with these settings if the client entered the Message 1 block after 10:00.</p></figcaption></figure>

**Scenario 2:** The arrow has a sending time set to 10:00 and the **"Send if date has passed"** toggle is ON.

The client enters the funnel and receives **Message 1** at 16:34 on February 23.

The message will be **scheduled for the next day**.

In the scheduled messages, they will have the text from **Message 2** set to be sent the next day at 10:00.

<figure><img src="/files/0fpJOhyIdRtBgsNFyMRw" alt="" width="544"><figcaption><p>Arrow settings: Time + Send if date has passed</p></figcaption></figure>

<div align="center"><figure><img src="/files/non6yhDSs8ud9ZXyRWUP" alt="" width="563"><figcaption><p><strong>Scenario 2:</strong> The client enters the <strong>Message 1</strong> block on February 23 after 10:00, with the <strong>"Send if date has passed"</strong> toggle enabled in the arrow.</p></figcaption></figure></div>

**Scenario 3:** The arrow has a **sending date** specified and a sending time of 10:00. The **"Send if date has passed"** toggle is OFF.

If the client enters the funnel and receives **Message 1** at 16:34, the next message will **NOT be scheduled for the next day**.

The client will remain in the **Message 1** block, and there will be no scheduled messages in the dialogue.

<figure><img src="/files/kyvPJgbA1cmNgRF091tE" alt=""><figcaption><p>The <strong>sending date</strong> field contains the built-in variable <code>current_date</code> = the current day.</p></figcaption></figure>

### **Example**

A timer arrow is an arrow where the transition occurs after a specified delay. They are shown as dashed lines, with the delay time displayed.

In our diagram, there are several such arrows. The first one comes from the bright green **"Good afternoon"** block. This arrow has a delay set to 0 seconds.

How it works: after the bot replies to the client with **"Good afternoon"**, the next question **"Would you like to place an order?"** immediately follows.

<figure><img src="/files/SxyvRkiMbGLuOtHpyTEj" alt=""><figcaption></figcaption></figure>

So, to set a delay before the response, fill in the corresponding field in the settings form.\
Similarly, you can specify the exact date and time for sending a message by filling in the **"Send time"** fields.

{% hint style="info" %}
To the right of the **"Delay before response"** field, you can select the unit of measurement: **seconds, minutes, hours, days**.
{% endhint %}

{% hint style="warning" %}
If you use delays along with variable comparison conditions and have **"Cancel timed messages"** turned off, then enter **#{question}** in the **"Strings to ignore"** field.
{% endhint %}

<figure><img src="/files/X83j9AMa42wwUtuDqeCu" alt=""><figcaption></figcaption></figure>

### **Go once**

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

If this toggle is enabled, the user will be able to transition through the connection only once during the conversation with the bot. At the same time, the message will be scheduled as many times as the condition for scheduling the message linked to the arrow is met.

{% hint style="warning" %}
**"Go once"** is <mark style="color:red;">NOT the same</mark> as **scheduling** the transition via the arrow only once.
{% endhint %}

Let’s analyze scenarios of arrow triggering with the **"Transition once"** toggle enabled:

**Go once** + **Cancel messages with a timer**

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

If the **Cancel messages with a timer** toggle is enabled in the arrow, then when the client re-enters the **Message 1** block, previously scheduled messages will be canceled, and only the most recently scheduled message will remain.

The **Transition once** toggle is also enabled. This means that once the transition through the arrow to **Message 2** occurs, it will not be scheduled again.

**Transition once only (other toggles disabled).**

If only the **Transition once** toggle is enabled in the arrow settings, new messages will continue to be scheduled **until the actual transition** through the arrow occurs.

<figure><img src="/files/qqMOisclsI6KbhEkH5YQ" alt=""><figcaption></figcaption></figure>

The client enters the **Message 1** block, and a transition to **Message 2** is scheduled.\
As long as the user hasn't received the text from **Message 2**, transitions will continue to be scheduled.

The **"Transition once"** toggle is triggered **ONLY UPON ACTUAL TRANSITION**.\
After transitioning to **Message 2**, future entries into **Message 1** will **no longer schedule** the transition via this arrow.&#x20;

{% hint style="success" %}
Be careful with your settings and always test different user behavior scenarios in the bot.
{% endhint %}


---

# 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/connection-with-a-timer-poka-taimery-propuskaem-andrei-skazal-chto-oni-otklyucheny-v-mavi.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.
