Ingest SMTP2GO webhook events for outbound email delivery status #28

Open
opened 2026-07-27 04:41:23 -07:00 by westfarn · 0 comments
Owner

Summary

Follow-on to password-reset / outbound email work (#1, PR #27).

We now persist OutboundEmail rows (queued → sending → sent/failed) in Django admin, and set custom header X-Hesychia-Email-Id on each message for correlation.

SMTP2GO supports webhooks for email lifecycle events (docs): processed, delivered, bounce (hard/soft), open, click, spam, reject, etc.

Goal

Update OutboundEmail status (and an event history) from SMTP2GO webhooks so admin shows real delivery outcome, not only “accepted by SMTP”.

Scope

  • POST /api/.../webhooks/smtp2go/ (or similar) endpoint — auth via shared secret / Authorization header
  • Map webhook event → status / child OutboundEmailEvent rows (delivered, bounced, opened, …)
  • Match messages via X-Hesychia-Email-Id custom header (and/or SMTP2GO email_id stored after send if available)
  • Configure webhook in SMTP2GO app/API for prod + beta (setup)
  • Admin: show provider events + last provider status on OutboundEmail
  • Tests with sample SMTP2GO payloads

Notes

  • Free SMTP2GO plans: 1 webhook; paid: up to 10
  • Prefer JSON output format
  • Do not expose PII beyond what we already store on OutboundEmail
## Summary Follow-on to password-reset / outbound email work ([#1](https://git.aimloperations.com/ai_ml_operations/chat_backend/issues/1), PR #27). We now persist `OutboundEmail` rows (queued → sending → sent/failed) in Django admin, and set custom header `X-Hesychia-Email-Id` on each message for correlation. SMTP2GO supports webhooks for email lifecycle events ([docs](https://developers.smtp2go.com/docs/webhooks-overview)): **processed**, **delivered**, **bounce** (hard/soft), **open**, **click**, **spam**, **reject**, etc. ## Goal Update `OutboundEmail` status (and an event history) from SMTP2GO webhooks so admin shows real delivery outcome, not only “accepted by SMTP”. ## Scope - [ ] `POST /api/.../webhooks/smtp2go/` (or similar) endpoint — auth via shared secret / Authorization header - [ ] Map webhook `event` → status / child `OutboundEmailEvent` rows (delivered, bounced, opened, …) - [ ] Match messages via `X-Hesychia-Email-Id` custom header (and/or SMTP2GO `email_id` stored after send if available) - [ ] Configure webhook in SMTP2GO app/API for prod + beta ([setup](https://developers.smtp2go.com/docs/setup-a-webhook)) - [ ] Admin: show provider events + last provider status on `OutboundEmail` - [ ] Tests with sample SMTP2GO payloads ## Notes - Free SMTP2GO plans: 1 webhook; paid: up to 10 - Prefer JSON output format - Do not expose PII beyond what we already store on `OutboundEmail`
westfarn self-assigned this 2026-07-27 04:41:23 -07:00
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: ai_ml_operations/chat_backend#28