Prompt
How do I debug missing email webhook events?
Latest observation
Here’s a practical way to debug missing email webhook events.
1) Confirm the event is actually being generated
First determine whether the provider ever emitted the event.
Check:
- The provider’s event/log dashboard
- Delivery logs for the specific message ID
- Whether the email was actually delivered, bounced, opened, clicked, etc.
If the provider never generated the event, the issue is upstream:
- Event type not enabled
- Wrong message/template
- Suppression list, invalid recipient, or bounce preventing later events
- Open/click tracking disabled or blocked
2) Verify webhook configuration
Make sure the webhook endpoint is:
- Correct URL
- Enabled for the right event types
- Pointing to the right environment, not staging vs prod
- Not filtered by domain, sender, tenant, or tag in a way that excludes the event
Common mistake: the provider is sending events to an old or test endpoint.
3) Check whether requests reached your server
Look at:
- Web server logs
- Load balancer / API gateway logs
- CDN/WAF logs
- Container or app logs
Questions to answer:
- Did the provider send the POST request?
- What status code did your app return?
- Was it retried?
If there’s no inbound traffic at all, the problem is likely routing/DNS/firewall/endpoint configuration.
4) Inspect response codes and timeouts
Webhook providers often stop retrying or mark events failed if you return:
- Non-2xx responses
- Timeouts
- TLS/SSL handshake errors
- Redirects they don’t follow
Make sure your handler:
- Returns a 2xx quickly
- Doesn’t do heavy work synchronously
- Acknowledges immediately and processes asynchronously if needed
5) Look for signature or auth failures
If you verify webhook signatures, missing events can be due to:
- Wrong secret
- Rotated secret not updated
- Body altered before verification
- Incorrect timestamp tolerance
- Parsing JSON before verifying raw payload
Check your app logs for:
- Invalid signature
- Unauthorized
- HMAC mismatch
6) Check retry behavior and dead-lettering
Many providers retry events on failure.
Inspect:
- Retry counts
- Backoff schedule
- Dead-letter queue or failed delivery queue
- Whether the same event was delivered multiple times and later dropped by your dedupe logic
Sometimes the event was delivered, but your consumer rejected it or moved it to a failure queue.
7) Validate deduplication logic
A common “missing event” issue is actually an over-aggressive dedupe filter.
Ensure you are not dropping events because:
- Event IDs are reused across tenants/providers
- You dedupe on message ID only, not event ID + type + tenant
- Clock skew causes event ordering assumptions to fail
- A partial payload is treated as a duplicate
8) Compare provider event IDs to your records
For a suspicious email, compare:
- Provider message ID
- Event ID
- Recipient
- Timestamp
- Event type
Create a timeline:
- Sent
- Delivered
- Opened
- Clicked
- Bounced
- Complained
If the provider has the event but your DB doesn’t, the issue is in ingestion, validation, or storage.
9) Check payload parsing and schema changes
Your consumer may be silently failing because:
- A field is missing or renamed
- The provider added new fields
- Nested JSON differs between event types
- Encoding issues break parsing
Log raw payloads for failed deliveries and compare them to what your parser expects.
10) Add observability
If you don’t already have it, add:
- Request logs with event ID, message ID, status code
- Error logs with payload excerpts
- Metrics for received vs processed vs failed events
- Alerts for spikes in 4xx/5xx/timeouts
- A dead-letter queue or replay mechanism
11) Test with a known-good payload
Use:
- Provider’s webhook test feature
- A manual cURL request to your endpoint
- A local tunnel like ngrok if testing locally
Verify:
- Endpoint receives the request
- Signature verification works
- You store the event
- Downstream processing succeeds
12) Consider email-specific quirks
For email events specifically:
- Opens may be blocked by image suppression or privacy features
- Clicks may be absent if links are rewritten incorrectly
- Spam complaints may be delayed or unavailable depending on mailbox provider
- Delivered events may be suppressed if the message was rejected upstream
- Some providers batch or delay event emission
Quick checklist
- Provider emitted the event
- Correct webhook URL and environment
- Endpoint reachable from the internet
- 2xx response returned quickly
- No signature/auth failure
- No retries or DLQ failures
- Dedupe logic not too aggressive
- Payload schema matches parser
- Raw inbound logs available
- Metrics and alerts in place
If you want, I can also help you debug this for a specific provider like SendGrid, Mailgun, Postmark, SES, or Resend.