# Unsubscribing from the Bot

## How to fully stop receiving messages

For example, in WhatsApp there is no option to block messages, so to prevent the user from pressing the “SPAM” button, you need to stop sending messages upon their request.\
\
A notification about the unsubscription will appear in the chat with the client, and in the “About the Client” tab, there will be a mark indicating that the client has opted out of bot messages (unsubscribed): a message with a cross icon.

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

If the client has an unsubscribed mark, messages will not be delivered to the user.

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

{% hint style="info" %}
Attention!\
Not all messengers send notifications when a client unsubscribes from messages.&#x20;
{% endhint %}

### How to Unsubscribe Manually

In the bot, you can set up the option for a client to unsubscribe from messages.\
Let’s take WhatsApp as an example.

Create a block with a condition based on your funnel logic. The **Start** block has the highest execution priority.

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

In the **Trigger** field, list all possible words users might type to unsubscribe from bot messages, separated by semicolons. In this block, we’ll also ask the client again if they really want to unsubscribe and create two buttons: “Yes” and “No.

When entering the Start block, the client will need to click one of the buttons, and the button names will be specified in the arrow trigger:

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

In the next block, where the arrow follows the “Yes, unsubscribe me” trigger, enter the message confirming that the client has successfully unsubscribed:

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

Next, from the block with the successful unsubscription confirmation message, create a block below that will contain the unsubscribe function:

`unsubscribe()`

{% hint style="danger" %}
Pay attention!&#x20;

Inside the block, actions in the Calculator are processed first, and only after that is the message text sent.\
If you include both the unsubscribe text and the unsubscribe function in the same block, the client will **not** receive the message from that block—it will no longer be delivered to the user.
{% endhint %}

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

{% hint style="warning" %}
**Attention!**&#x20;

The client will resubscribe to messages if they send any message to the bot; until then, no messages will be sent to them..
{% endhint %}

## How to Partially Unsubscribe from Mailings

For partial unsubscription, you need to assign variables and check their values before sending messages.

{% hint style="info" %}
Assign variables in the block using the Calculator field.\
You can also manually create a client variable in the “About the Client” tab during a chat, which can later be used to exclude them from mailings.
{% endhint %}

For example, if a user has the variable `send_in_the_morning`  set to `no`*,* you can exclude users in the mailing filter settings based on the value of this variable:

<figure><img src="/files/COnmIRnBPTyy37TWFPkz" alt=""><figcaption><p>Setting up a filter when creating a mailing to exclude users based on a variable’s value</p></figcaption></figure>

Also, in the block or the arrow leading to the mailing block, you can specify in the Variable for Comparison field  `send_in_the_morning == "no"` *,* so that this person receives the message in the evening. Conditions can be combined in various ways.

Example of using the “*Variable for Comparison*” field when scheduling messages:

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

We can see that the client has the variable `send_in_the_morning` set to "`no"`.  And a message is scheduled for them at 8:00 PM.

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

## How to Set Up a Reaction to Unsubscription

It is often necessary to perform certain actions in the bot after a client unsubscribes. For example, sending information to analytics, adding or removing from lists, applying or removing tags, making a server request, and more.\
\
For these purposes, you can set up a conditional block that reacts to the client’s unsubscription notification. This callback (notification) appears in the client chat after the client has unsubscribed from messages in a messenger (for example,  “Stop and block the bot” in Telegram).)

<figure><img src="/files/kXz5f94EqttO0LhgQHhi" alt="" width="375"><figcaption><p>Client unsubscribe callback</p></figcaption></figure>

In the block, enter the callback `client_unsubscribed` in the “Condition” field and set the Match Type - to Exact Match.

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

{% hint style="info" %}
Actions and requests configured in the block will be executed, but the message WILL NOT be sent to the client, since they have already unsubscribed.
{% endhint %}

{% hint style="success" %}
This callback works in Viber and Telegram.
{% 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/business-mailings/unsubscribing-from-the-bot.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.
