Webhook Consumers
Webhook handlers must be replay-safe and verifiable.
Verification
- Validate provider signatures before parsing payloads.
- Reject requests that fail signature checks with 401.
- Store the raw body if the provider requires exact-byte verification.
Dedupe
- Persist event IDs.
- Skip already processed IDs.
- Make handlers idempotent even if dedupe storage is delayed.
Processing model
- Verify signature.
- Validate payload schema.
- Persist event record.
- Apply domain state update.
- Return success quickly.
Keep heavy side effects in async workers if possible.
Failure handling
- Return non-2xx only for transient retryable failures.
- Alert on repeated processing failures.
- Keep dead-letter workflow for poison events.
Example use cases in Mimic
- Stripe subscription and invoice updates
- Agent/job status callbacks
- External event feeds that enrich pilot analytics