Ack fast

Return 2xx within a few seconds. Queue slow work (LLM calls, database writes) off the request thread.

Retries

Failed deliveries (non-2xx, timeout, or connection error) are retried with exponential backoff. Treat delivery as at-least-once — dedupe on eventId.

Idempotency

const seen = new Set<string>();

if (seen.has(event.eventId)) return res.status(200).end();
seen.add(event.eventId);
For production, persist eventId in your database with a unique constraint.