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

