Event Processing
Understanding the event lifecycle helps you debug issues and optimize your integration.
Event Lifecycle
Every event goes through these stages:
- 1. Ingestion — Event received via API
- 2. Validation — Payload checked, rate limits applied
- 3. Routing — Matching endpoints found
- 4. Queuing — Delivery queued for each endpoint
- 5. Delivery — HTTP POST sent to endpoint
- 6. Verification — Response recorded, retry scheduled if needed
- 7. Completion — Delivery marked as delivered or failed
Ingestion
When you send an event via POST /v1/webhooks, HookSniff:
- 1. Authenticates your API key
- 2. Checks idempotency key (returns cached response if duplicate)
- 3. Validates event type format and payload size
- 4. Checks rate limits
- 5. Finds matching endpoints (active, matching event filter)
- 6. Creates delivery records and queues them
- 7. Returns 200 with delivery IDs
Routing
HookSniff finds all active endpoints that match the event type:
- Exact match: order.created matches only order.created
- Wildcard: order.* matches order.created, order.updated, etc.
- All: * matches everything (default)
Delivery
The worker picks up queued deliveries and sends HTTP POST requests:
- 1. Signs the payload with HMAC-SHA256
- 2. Adds Standard Webhooks headers
- 3. Sends with 30s timeout
- 4. Records the response (status code, body, timing)
- 5. On 2xx: marks as delivered
- 6. On failure: schedules retry or moves to DLQ
Payload İmzalama
Teslimattan önce, HookSniff payload'ı HMAC-SHA256 kullanarak imzalar:
- İmza:
v1,{base64(hmac_sha256(secret, body))} - Zaman damgası:
webhook-timestamp(Unix saniye) - Teslimat ID:
webhook-id
Fanout
Bir olay birden fazla uç noktaya teslim edilebilir. order.created'ı dinleyen 5 uç noktanız varsa, HookSniff 5 ayrı teslimat oluşturur — her birinin kendi imza gizli anahtarı, tekrar politikası ve teslimat takibi vardır.
Sıralama
HookSniff olayları uç nokta başına FIFO sırasıyla teslim eder. Her teslimat bir sıra numarası içerir. Bir teslimat başarısız olup tekrar denendiğinde, aynı uç noktaya yapılan sonraki teslimatlar tekrar tamamlanana kadar bekletilir.
Zaman Aşımları
Her teslimat denemesinin 30 saniyelik bir zaman aşımı vardır. Uç noktanız 30 saniye içinde yanıt vermezse, deneme başarısız olarak işaretlenir ve tekrar denenir.
En iyi uygulama: Hemen 200 döndürün ve asenkron işleyin. En İyi Uygulamalar'a bakın.