# Webhooks

> One URL and one secret per tenant. There is no per-customer URL.

You do not call `POST /api/v1/webhooks/meta`. That is Meta’s callback into Whitelabel WhatsApp Cloud API. You configure the URL Whitelabel WhatsApp Cloud API calls on your server.

Scope: `webhooks:manage`.

```http
PUT /api/v1/webhook-config
Authorization: Bearer $VITRAL_WHATSAPP_API_KEY
Content-Type: application/json

{
  "webhookUrl": "https://example.com/webhooks/whatsapp",
  "webhookSecret": "at-least-16-chars"
}
```

`webhookUrl` is required and may be `null` to clear it. Omit `webhookSecret` to keep the current secret. `webhookSecret: null` clears it. A secret shorter than 16 characters is `400` `VALIDATION_ERROR`. A successful save sets `webhookFailCount` to 0 and closes the circuit.

```http
GET /api/v1/webhook-config
```

```json
{
  "data": {
    "webhookUrl": "https://example.com/webhooks/whatsapp",
    "hasSecret": true,
    "circuitOpen": false,
    "circuitUntil": null,
    "failCount": 0
  }
}
```

The secret is not returned. The PUT response is only `webhookUrl` and `hasSecret`.

## Envelope

Every queued delivery is:

```json
{
  "event": "message.received",
  "tenantId": "ck_tenant",
  "timestamp": "2026-09-30T16:00:00.000Z",
  "data": {}
}
```

`message.received` and `message.status` still put Meta’s change object in `data`. The envelope also has `customerId`, `phoneNumberId` (Whitelabel WhatsApp Cloud API id), and `setupLinkId`. Those three are `null` when this API could not resolve them. The same fields are added onto `data` when that key is not already set. `data.value.metadata.phone_number_id` stays Meta’s id. Existing fields are not removed.

Event list and example payloads: [Events](/whatsapp/webhooks/events.md).

Signature: [Security](/whatsapp/webhooks/security.md). Retries and the circuit breaker: [Delivery](/whatsapp/webhooks/delivery.md).

## Logs and test

```http
GET /api/v1/webhook-config/deliveries?page=1&pageSize=20
```

Query names are `page` and `pageSize` (default 20, max 100). `meta` still uses `limit` and `total`.

```http
POST /api/v1/webhook-config/test
```

Posts `event: "webhook.test"` directly. `data.success` is true when your server returns 2xx. This call does not create a delivery row. No URL saved: `400` `NO_WEBHOOK_URL`.
