> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ycloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# whatsapp.user.preferences

> Occurs when a WhatsApp user stops marketing messages or a WhatsApp user resumes marketing messages.

Use `whatsapp.user.preferences` to handle this event at your webhook endpoint.

## Triggers

Occurs when a WhatsApp user stops marketing messages or a WhatsApp user resumes marketing messages.

Subscribe to `whatsapp.user.preferences` when you [configure your webhook endpoint](https://docs.ycloud.com/en/api-reference/guides/api-fundamentals/configure-webhooks.md).

## Syntax

YCloud sends an HTTP `POST` request to your configured webhook URL. The following shape shows one payload variant. Angle-bracket values are placeholders; their types are listed under **Parameters**. Optional fields and other variants are described below.

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "id": "<ID>",
  "type": "whatsapp.user.preferences",
  "apiVersion": "<API_VERSION>",
  "createTime": "<CREATE_TIME>",
  "whatsappUserPreference": {
    "wabaId": "<WABA_ID>",
    "businessPhoneNumber": "<BUSINESS_PHONE_NUMBER>",
    "businessPhoneId": "<BUSINESS_PHONE_ID>",
    "contactName": "<CONTACT_NAME>",
    "contactPhoneNumber": "<CONTACT_PHONE_NUMBER>",
    "userId": "<USER_ID>",
    "parentUserId": "<PARENT_USER_ID>",
    "detail": "<DETAIL>",
    "category": "<CATEGORY>",
    "value": "<VALUE>",
    "timestamp": "<TIMESTAMP>"
  }
}
```

## Parameters

Validate the `YCloud-Signature` HTTP header before you process the JSON body. See [signature validation](https://docs.ycloud.com/en/api-reference/guides/api-fundamentals/configure-webhooks.md).

### Event envelope

| Parameter | Type | Required | Description |
| - | - | - | - |
| `id` | string | Yes | Unique ID for the event. Minimum length: `6`. Maximum length: `128`. |
| `type` | string | Yes | Always `whatsapp.user.preferences`. |
| `apiVersion` | string | Yes | The API version used to render this event. |
| `createTime` | string (date-time) | Yes | The time at which this event was created, formatted in [RFC 3339](https://datatracker.ietf.org/doc/html/rfc3339). e.g., `2022-06-01T12:00:00.000Z`. |

### Event payload

| Parameter | Type | Required | Description |
| - | - | - | - |
| `whatsappUserPreference` | object | No | Event-specific `whatsappUserPreference` payload. |

The four common envelope fields are required. Payload fields depend on the event variant. In each object table, **Required** applies when its parent object is present. Optional fields can be omitted; a sample does not make a field required.

#### whatsappUserPreference

| Parameter | Type | Required | Description |
| - | - | - | - |
| `wabaId` | string | No | WhatsApp Business Account ID. |
| `businessPhoneNumber` | string | No | Phone number in [E.164](https://en.wikipedia.org/wiki/E.164) format. |
| `businessPhoneId` | string | No | Phone number ID. |
| `contactName` | string | No | WhatsApp user name. |
| `contactPhoneNumber` | string | No | WhatsApp user phone number. Phone number in [E.164](https://en.wikipedia.org/wiki/E.164) format. |
| `userId` | string | No | The WhatsApp user's Business-scoped user ID (BSUID). |
| `parentUserId` | string | No | The WhatsApp user's parent Business-scoped user ID. Omitted when parent BSUIDs are not enabled. |
| `detail` | string | No | Description of marketing message preference. |
| `category` | string | No | Preference category reported by WhatsApp, for example `marketing_messages`. |
| `value` | string | No | Marketing message preference. |
| `timestamp` | string | No | Unix timestamp indicating when the webhook was triggered. |

## Example

The following JSON is the body delivered to your receiver. IDs, phone numbers, and other account values are illustrative.

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "id": "evt_example_whatsapp_user_preferences",
  "type": "whatsapp.user.preferences",
  "apiVersion": "v2",
  "createTime": "2026-05-26T12:00:00.000Z",
  "whatsappUserPreference": {
    "wabaId": "whatsapp-business-account-id",
    "businessPhoneNumber": "+12025550123",
    "businessPhoneId": "1234567890123456",
    "contactName": "Example customer",
    "contactPhoneNumber": "+12025550124",
    "userId": "US.13491208655302741918",
    "parentUserId": "US.ENT.11815799212886844830",
    "detail": "User requested to stop marketing messages",
    "category": "marketing_messages",
    "value": "stop",
    "timestamp": "1779796800000"
  }
}
```

After verifying the signature and durably accepting the event, return a `2xx` response. Process slow work asynchronously.

```http theme={"theme":{"light":"github-light","dark":"github-dark"}}
HTTP/1.1 200 OK
```

For scenario walkthroughs, see [annotated examples](https://docs.ycloud.com/en/api-reference/guides/examples/webhook-examples/whatsapp-inbound-message-webhook-examples).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.