# Unsubscribe

The Unsubscribe operation is an essential tool for managing your contacts' communication preferences and ensuring compliance with data protection laws (such as LGPD).

Unlike the "Block" operation, which is a general block, this action allows you to record that a contact has requested not to receive further communications through a specific channel (such as Email, Phone, SMS, etc.).

The operation works by locating the person by the channel identifier (the "key", such as the email address or phone number) and marking them as "unsubscribed" for that type of communication.

#### How to Configure

1. In Hablla Studio, add the "People" block to your automation flow.
2. In the "Operation" field, select the "Unsubscribe" option.
3. In the "Type" field, select the communication channel from which the person wishes to unsubscribe.
4. In the "Key" field (`key`), enter the identifier corresponding to the selected type (the email, the phone number, etc.).

### Parameters

| Field         | Type         | Required? | Description                                                                                                                                                             |
| ------------- | ------------ | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Type (`type`) | Options List | ✅ Yes     | The communication channel to which the unsubscribe will be applied. Options: `Email`, `phone`, `Telegram`, `Facebook`, `Instagram`.                                     |
| Key (`key`)   | Text         | ✅ Yes     | The unique identifier of the contact in the chosen channel. For example, if the `Type` is `Email`, the `Key` should be the email address (e.g.: `contato@exemplo.com`). |

### Structure (Using JSON)

The JSON request body must contain the `channel` type and the `key` (contact identifier).

To unsubscribe an email:

JSON

```
{
  "type": "email",
  "key": "joana.souza@example.com"
}
```

To unsubscribe a phone:

JSON

```
{
  "type": "phone",
  "key": "+5511987654321"
}
```

***

### 🚀 Example Use Case

Purpose: Automatically process unsubscribe requests coming from the footer of a marketing email.

1. Configure your email sending platform to send a Webhook to an endpoint of your flow in Hablla whenever a user clicks the "Unsubscribe" link. The platform must send the user's email address in the webhook body.
2. Create a flow that starts with this Webhook trigger.
3. Add the "People" block with the "Unsubscribe" operation.
4. In the "Type" field, select the option `Email`.
5. In the "Key" field, enter the variable that contains the user's email coming from the trigger (e.g.: `{{trigger.body.email}}`).
6. (Optional) Add a subsequent step to remove the "Newsletter" tag from the person's profile to ensure they are not included in future segmentations for that communication.

With this flow, you automate 100% of the opt-out process, ensuring the user's request is handled instantly, preventing improper sends and keeping your company in compliance with market best practices.
