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

# Discord webhooks

> Receive and verify Discord webhooks with Trigger.dev. Check the Ed25519 signature in x-signature-ed25519 and run a task for each Discord event, filtered on event.event.type.

**`webhooks.discord()` verifies the Ed25519 signature Discord sends in `x-signature-ed25519` on every request.**

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

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

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

To run a subscriber only for some events, add a [filter](https://trigger.dev/docs/webhooks/filters.md) on `event.event.type`.

| Setting | Value |
| - | - |
| Source | `webhooks.discord()` |
| Verification | Ed25519 signature in `x-signature-ed25519` |
| Credential | Discord's public key |
| Event type | `event.event.type` |
| Discord docs | [Discord webhook docs](https://docs.discord.com/developers/events/webhook-events) |

## Set up Discord

1. Start `trigger dev` or deploy, then copy the endpoint's **Webhook URL** from the **Webhooks** page.
2. In the [Discord Developer Portal](https://discord.com/developers/applications), open the application and copy the **Public Key** from its **General Information** page. Choose **Set public key** on the Trigger.dev endpoint and paste it.
3. Open the application's **Webhooks** page. Set the **Endpoint URL** to the webhook URL, turn **Events** on, and select the event types your subscribers need. Discord sends a PING when you save, and the endpoint can only answer it once the public key is set.
4. Send a test event from Discord, 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.

## Endpoint validation

The endpoint answers Discord's verified PING with an empty `204`, so the PING creates no delivery or run.


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