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.

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

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.

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:

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

Next, from the block with the successful unsubscription confirmation message, create a block below that will contain the unsubscribe function:
unsubscribe()
Pay attention!
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.

Attention!
The client will resubscribe to messages if they send any message to the bot; until then, no messages will be sent to them..
How to Partially Unsubscribe from Mailings
For partial unsubscription, you need to assign variables and check their values before sending messages.
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:

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:

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.

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).)

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

This callback works in Viber and Telegram.
Last updated