Skip to main content
Trigger.dev has built-in webhook endpoints, and we recommend them for most projects. They verify each provider’s signature, drop duplicate retries, record every delivery, and route events to tasks, agents and waiting runs. See Webhooks. If you prefer to handle webhooks yourself, receive them in a route in your own app and trigger runs from there with tasks.trigger(), the same way any backend code does.

When to use your own handler

Trigger a task from your route

Verify the request with the provider’s SDK, then trigger the task. This Next.js route uses Stripe’s SDK; import the task as a type so the route doesn’t bundle the task code.
app/api/webhooks/stripe/route.ts
Return quickly: the task runs in the background, so the provider gets its response before the work starts. Set TRIGGER_SECRET_KEY in your app to a named Trigger only API key from the Trigger.dev environment the app uses, so the route can trigger tasks but do nothing else.

Framework guides

Custom webhook handler with Next.js

Handle a webhook in a Next.js API route and trigger a task.

Custom webhook handler with Remix

Handle a webhook in a Remix action and trigger a task.