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

# WhatsApp webhooks

> Receive and verify WhatsApp webhooks with Trigger.dev. Check the HMAC-SHA256 signature in x-hub-signature-256 and run a task for each WhatsApp event.

**`webhooks.whatsapp()` verifies the HMAC-SHA256 signature WhatsApp sends in `x-hub-signature-256`, keyed by the App Secret on every request.**

```ts /trigger/whatsapp.ts theme={"theme":"css-variables"}
import { webhook, webhooks } from "@trigger.dev/sdk";

export const whatsapp = webhooks.endpoint.define({
  id: "whatsapp",
  source: webhooks.whatsapp(),
});

export const whatsappEvents = webhook({
  id: "whatsapp-events",
  endpoint: whatsapp,
  onEvent: async ({ event }) => {
    console.log(event);
  },
});
```

| Setting | Value |
| - | - |
| Source | `webhooks.whatsapp()` |
| Verification | HMAC-SHA256 in `x-hub-signature-256`, keyed by the App Secret |
| Credential | Signing secret issued by WhatsApp |
| WhatsApp docs | [WhatsApp webhook docs](https://developers.facebook.com/docs/whatsapp/cloud-api/guides/set-up-webhooks/) |

## Set up WhatsApp

1. Start `trigger dev` or deploy, then copy the endpoint's **Webhook URL** from the **Webhooks** page.
2. In the Meta app dashboard, set the WhatsApp webhook's callback URL to the webhook URL. Meta checks the URL with a GET request that needs a verify token; see [Verify the callback URL](#verify-the-callback-url).
3. Copy the app's **App Secret**, then choose **Set signing secret** on the Trigger.dev endpoint. Meta signs event deliveries with it.
4. Subscribe the webhook to the fields your subscribers need, such as `messages`.
5. Send a test event from WhatsApp, or use the endpoint's **Test** tab, and check the endpoint's **Deliveries** tab. See [Verify the connection](https://trigger.dev/docs/webhooks/connect.md#verify-the-connection) if nothing arrives.

## Verify the callback URL

`webhooks.whatsapp()` also needs a verify token for Meta's URL check. On the endpoint, choose **Generate verify token** and paste the value into Meta's **Verify Token** field. Set Meta's App Secret as the signing secret, then validate the URL in Meta's dashboard.

The verify token answers the URL check. The signing secret verifies event deliveries. See [Verification](https://trigger.dev/docs/webhooks/verification.md#endpoint-validation) for the response behavior.


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