Verify and handle webhooks delivered through the Hookdeck Event Gateway. Use when receiving webhooks via Hookdeck and need to verify the x-hookdeck-signature header. Covers signature verification for Express, Next.js, and FastAPI.
Verify and handle webhooks delivered through the Hookdeck Event Gateway. Use when receiving webhooks via Hookdeck and need to verify the x-hookdeck-signature header. Covers signature verification for Express, Next.js, and FastAPI.
When webhooks flow through the Hookdeck Event Gateway, Hookdeck queues and delivers them to your app. Each forwarded request is signed with an x-hookdeck-signature header (HMAC SHA-256, base64). Your handler verifies this signature to confirm the request came from Hookdeck.
When to Use This Skill
Receiving webhooks through the Hookdeck Event Gateway (not directly from providers)
Verifying the x-hookdeck-signature header on forwarded webhooks
Using Hookdeck headers (event ID, source ID, attempt number) for idempotency and debugging
# Required for signature verification# Get from Hookdeck Dashboard → Destinations → your destination → Webhook Secret
HOOKDECK_WEBHOOK_SECRET=your_webhook_secret_from_hookdeck_dashboard
Express Webhook Handler
const express = require('express');
const app = express();
// IMPORTANT: Use express.raw() for signature verification
app.post('/webhooks',
express.raw({ type: 'application/json' }),
(req, res) => {
const signature = req.headers['x-hookdeck-signature'];
if (!verifyHookdeckSignature(req.body, signature, process.env.HOOKDECK_WEBHOOK_SECRET)) {
console.error('Hookdeck signature verification failed');
return res.status(401).send('Invalid signature');
}
// Parse payload after verificationconst payload = JSON.parse(req.body.toString());
// Handle the event (payload structure depends on original provider)console.log('Event received:', payload.type || payload.topic || 'unknown');
// Return status code — Hookdeck retries on non-2xx
res.json({ received: true });
}
);
For the full overview of what the Event Gateway does — guaranteed ingestion, durable queuing, automatic retries, rate limiting, replay, observability, and more — see the hookdeck-event-gateway skill.
Recommended: webhook-handler-patterns
We recommend installing the webhook-handler-patterns skill alongside this one for handler sequence, idempotency, error handling, and retry logic. Key references (open on GitHub):
Handler sequence — Verify first, parse second, handle idempotently third