AI agents with Discord webhooks

Receive Discord webhooks on Trigger.dev and use them to start, resume or message your AI agents.

Get started now

What you can do with Discord webhooks

Start an agent

Discord events can start a new agent run. For example, an agent that greets each server that adds your Discord app.

Resume an agent

An agent can pause until the Discord event it needs arrives, for up to 90 days, and costs nothing while it waits.

Message an agent

Discord events can land in a running agent's conversation, so it acts on them with full context.

Events you can receive from Discord

Discord sends events like APPLICATION_AUTHORIZED, APPLICATION_DEAUTHORIZED, ENTITLEMENT_CREATE and ENTITLEMENT_DELETE, and your agent can filter on any of them.

Example

An agent that greets each server that adds your Discord app

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,
filter: "event.event.type == 'APPLICATION_AUTHORIZED'",
onEvent: async ({ event }) => {
// Start, resume or message your agent with the event
console.log(event);
},
});

Handled for you

Verified for you

webhooks.discord() checks the Discord signature on every request. Bad requests are rejected before anything runs.

Filter before anything runs

Only the Discord events you care about start a run. Filtered webhooks use no compute.

See every delivery

Every webhook is recorded with its payload, headers and the agents it reached, so you can debug it and replay it.

Get started

  1. 1

    Set up the agent

    Copy the starter prompt into your coding agent, like Claude Code, Cursor or Codex. It creates a Trigger.dev project and adds the webhook endpoint. Prefer to write it yourself? Start from the example above.

  2. 2

    Add the webhook in Discord

    Deploy your project, or run trigger dev, and the endpoint appears on the Webhooks page of the Trigger.dev dashboard with its URL. Add that URL in Discord's webhook settings and pick the events you need. The endpoint's Copy setup prompt button gives your coding agent the exact steps.

  3. 3

    Add Discord's public key

    Copy the public key from Discord. Then on the endpoint's page in the Trigger.dev dashboard, choose Set public key and paste it in, so Trigger.dev can check every request really came from Discord.

  4. 4

    Try it

    Send a test event from Discord, or use the endpoint's Test tab. It appears on the endpoint's Deliveries tab, with the agents it reached.

Related integrations

Ready to build with Discord webhooks?

Declare an endpoint, deploy, and paste the URL into your provider.

Get started for free