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

# Webhook verification

> How an endpoint verifies each provider's requests, answers provider handshakes, and types the event its subscribers receive.

**An endpoint's `source` tells Trigger.dev how to verify a provider's requests and what type the event has.** Use a [built-in provider](https://trigger.dev/docs/webhooks/providers.md), such as `webhooks.stripe()` or `webhooks.firecrawl()`, or describe the provider's scheme with [`webhooks.custom()`](https://trigger.dev/docs/webhooks/custom-providers).

## Presets

Presets supply the verification configuration, and most also carry the provider's part of the endpoint's [setup prompt](https://trigger.dev/docs/webhooks/connect.md#set-it-up-with-an-ai-agent). Set the endpoint's signing secret or public key as described in [Connect a provider](https://trigger.dev/docs/webhooks/connect.md).

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

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

export const stripeEvents = webhook({
  id: "stripe-events",
  endpoint: stripe,
  onEvent: async ({ event }) => {
    if (event.type === "payment_intent.succeeded") {
      console.log(event.id);
    }
  },
});
```

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

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

export const githubEvents = webhook({
  id: "github-events",
  endpoint: github,
  onEvent: async ({ headers }) => {
    // GitHub puts the event type in a header
    console.log(headers.get("x-github-event"));
  },
});
```

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

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

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

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

export const myProvider = webhooks.endpoint.define({ id: "my-provider", source: webhooks.standardWebhooks() });

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

The available presets are `stripe()`, `github()`, `svix()`, `standardWebhooks()`, `square()`, and `discord()`.

### Svix and Standard Webhooks

`svix()` and `standardWebhooks()` use HMAC-SHA256 over `id.timestamp.body` with a base64-encoded `whsec_` secret. Their header names differ:

| Source | Headers |
| - | - |
| `svix()` | `svix-id`, `svix-timestamp`, `svix-signature` |
| `standardWebhooks()` | `webhook-id`, `webhook-timestamp`, `webhook-signature` |

Named sources such as `webhooks.clerk()` and `webhooks.openai()` select the corresponding configuration.

## Named providers

More than 40 named providers, such as `webhooks.firecrawl()`, `webhooks.linear()` and `webhooks.hookdeck()`, build on the same verifiers. [Providers](https://trigger.dev/docs/webhooks/providers.md) lists every one, with where to register the URL and set the signing secret.

## Custom providers

For a provider without a built-in source, describe its signature scheme with `webhooks.custom()`. See [Custom providers](https://trigger.dev/docs/webhooks/custom-providers.md) for the verification schemes and options.

## Endpoint validation

Some sources also define a response for the provider's endpoint-validation request. These requests don't create deliveries or task runs.

`discord()` answers a verified `{ type: 0 }` PING with HTTP `204` and no body. It also returns `204` for accepted events and `401` for invalid signatures. Set the Discord application's public key as the endpoint's verification credential.

Slack's `url_verification` challenge is handled the same way by `@trigger.dev/slack`.

`notion()` handles Notion's verification request, which is not signed: when you create a subscription, Notion sends a `verification_token` that it then uses to sign every later delivery. While the endpoint has no signing secret, the endpoint answers that request with `200` and stores the token as its signing secret. The endpoint page shows the token so you can paste it into Notion's Verify dialog. If the token doesn't arrive, select **Resend token** in that dialog. Deploy the endpoint and leave its signing secret unset before you create the subscription. Once a secret is set, a later verification request is rejected like any unsigned delivery. Before you re-create the subscription or resend its token, select **Clear signing secret** on the endpoint page so the endpoint stores the new token.

`whatsapp()` answers Meta's GET verification request when `hub.mode` is `subscribe` and `hub.verify_token` matches the endpoint's verify token. It returns `hub.challenge` as text. The verify token is separate from the App Secret used to verify event signatures; see [Verify a WhatsApp endpoint URL](https://trigger.dev/docs/webhooks/providers/whatsapp.md#verify-the-callback-url). Endpoints without GET verification return `405` to GET requests.

## Typing the event

Stripe and GitHub sources provide default event shapes; other sources default to `unknown`. Pass an event type to the source function for typed handler parameters and autocomplete. This example uses `Stripe.Event` from the `stripe` package, which must be installed in your project:

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

export const stripe = webhooks.endpoint.define({ id: "stripe", source: webhooks.stripe<Stripe.Event>() });

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

For `webhooks.custom<T>()`, pass your own event type as `T`. The endpoint's event type flows to every subscriber: `webhook()` handlers, `chat.event` keys and filters, and [waiter](https://trigger.dev/docs/webhooks/waiters.md) `match` paths are all checked against it.

> [!NOTE]
>
> Event types are compile-time annotations. Signature verification doesn't validate the body against
> a TypeScript type. Validate `event` inside `onEvent` if your handler needs runtime schema checks.

## How verification works

Requests must pass verification before they reach any subscriber. Sources can check a signature or credential, enforce a timestamp tolerance, and derive an idempotency key for [deduplication](https://trigger.dev/docs/webhooks/deliveries.md#deduplication). Verification failures return the source's rejected HTTP status (`400` by default).

To verify a provider that isn't built in, choose a scheme for a [custom provider](https://trigger.dev/docs/webhooks/custom-providers.md#verification-schemes).


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