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

# PlanetScale webhooks

> Receive and verify PlanetScale webhooks with Trigger.dev. Check the HMAC-SHA256 signature in x-planetscale-signature and run a task for each PlanetScale event, filtered on event.event.

**`webhooks.planetscale()` verifies the HMAC-SHA256 signature PlanetScale sends in `x-planetscale-signature` on every request.**

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

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

export const planetscaleEvents = webhook({
  id: "planetscale-events",
  endpoint: planetscale,
  filter: "event.event == 'branch.ready'",
  onEvent: async ({ event }) => {
    console.log(event);
  },
});
```

| Setting | Value |
| - | - |
| Source | `webhooks.planetscale()` |
| Verification | HMAC-SHA256 in `x-planetscale-signature` |
| Credential | Signing secret issued by PlanetScale |
| Event type | `event.event` |
| PlanetScale docs | [PlanetScale webhook docs](https://planetscale.com/docs/api/webhooks) |

## Set up PlanetScale

1. Start `trigger dev` or deploy, then copy the endpoint's **Webhook URL** from the **Webhooks** page.
2. Select the database in PlanetScale, then **Settings > Webhooks > Add webhook**. Enter the webhook URL and select the events your subscribers need. This needs the database administrator role.
3. In the webhook's menu, choose **Show secret**, copy it, and choose **Set signing secret** on the Trigger.dev endpoint.
4. Choose **Test webhook** in the same menu to send a `webhook.test` event, 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.


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