Skip to content

Remix / React Router

app/routes/webhooks.github.ts
import { createWebhookHandler } from 'verihook/remix';
export const action = createWebhookHandler('github', process.env.GITHUB_WEBHOOK_SECRET!, async (payload, result, args) => {
console.log(result.eventType);
});

The handler receives the action’s arguments (request, params, context). It works with Remix and React Router v7 framework mode. Webhook routes have no loader, so GET requests get React Router’s default 405.

onError(result, args) returns your own Response for failures.

Situation Response
Invalid, missing or expired signature 401 { error, code }, unless you pass onError
Duplicate event (with dedupeStore) 200 { received: true, duplicate: true }
Body over maxBodySize (default 2 MB) 413 { code: "PAYLOAD_TOO_LARGE" }
Exception during verification 500 with a generic message
Your handler throws or responds >= 500 The dedupe key is released so the retry is processed

All verification options (tolerance, dedupeStore, url, …) can be passed as the last argument. Pick your provider in Providers for the secret and the headers it sends.