Read raw request.body() bytes before JSON parsing, check the timestamp header is within a 5-minute window, compute HMAC-SHA256 and compare with hmac.compare_digest (constant-time), insert event_id into an idempotency table with ON CONFLICT DO NOTHING, and enqueue heavy work before returning 202/200.
Follow-up Interview Question · Why must you verify HMAC over the raw request bytes rather than re-serialized JSON?