Webhook Handler
Type-safe webhook receiver with signature verification, retry logic, event logging, and dead letter queue. Supports Stripe, GitHub, Slack, and custom webhook sources.
TypeScriptIntegrationsBuilt with Claude
1.3k
Stars
6.8k
Installs
1
Deps
2
Comments
Install / Copy
npx create-freestack-module webhook-handlerCode Preview
index.tsx
import { createHmac } from "crypto";
interface WebhookConfig {
secret: string;
source: "stripe" | "github" | "slack" | "custom";
handler: (event: WebhookEvent) => Promise<void>;
retries?: number;
}
export function createWebhookHandler(config: WebhookConfig) {
return async function handler(request: Request) {
const body = await request.text();
const signature = request.headers.get("x-signature");
if (!verifySignature(body, signature, config.secret)) {
return new Response("Invalid signature", { status: 401 });
}
const event = JSON.parse(body) as WebhookEvent;
await logEvent(event);
try {
await config.handler(event);
return new Response("OK", { status: 200 });
} catch (error) {
await addToDeadLetterQueue(event, error);
return new Response("Processing failed", { status: 500 });
}
};
}IN
integrations-lead5 days ago
The dead letter queue saved us when a downstream service went down. Events were replayed cleanly.
AP
apidev2 weeks ago
Added a custom source for our partner API in 15 minutes. Well-abstracted.
Related Modules
Agent Loop
Autonomous agent execution loop with tool calling, memory management, and graceful error recovery. Supports OpenAI and Anthropic function calling formats.
2.9kTypeScript
Prompt Chain
Multi-step prompt chaining framework with validation, retry logic, and intermediate result caching. Define complex AI workflows as composable, typed chains.
1.2kTypeScript
Email Sender
Transactional email service with React email templates, queue-based sending, retry logic, and delivery tracking. Supports Resend, SendGrid, and SMTP providers.
1.1kNode.js