feat: add Resend inbound webhook endpoint and client (refs #155)
- ResendInboundClient: webhook signature verification via Svix, email fetch/download/parse with mailparser - POST /api/webhooks/resend/inbound endpoint with rawBody, signature verification, idempotency check, queue insertion, async processing - Config: resend_webhook_secret (optional) in secrets schema - Route registration in app.ts following Stripe webhook pattern Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* @ai-summary Resend inbound webhook route registration
|
||||
* @ai-context Public endpoint (no JWT auth) with rawBody for signature verification
|
||||
*/
|
||||
|
||||
import { FastifyPluginAsync } from 'fastify';
|
||||
import { EmailIngestionController } from './email-ingestion.controller';
|
||||
|
||||
export const emailIngestionWebhookRoutes: FastifyPluginAsync = async (fastify) => {
|
||||
const controller = new EmailIngestionController();
|
||||
|
||||
// POST /api/webhooks/resend/inbound - PUBLIC endpoint (no JWT auth)
|
||||
// Resend authenticates via webhook signature verification (Svix)
|
||||
// rawBody MUST be enabled for signature verification to work
|
||||
fastify.post(
|
||||
'/webhooks/resend/inbound',
|
||||
{
|
||||
config: {
|
||||
rawBody: true,
|
||||
},
|
||||
},
|
||||
controller.handleInboundWebhook.bind(controller)
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user