Goal
Build reliable downstream automation from StackShift Mail events without trusting unsigned payloads.Prerequisites
- A public HTTPS webhook endpoint
- Storage for webhook endpoint secret values
- An idempotent event handler
Workflow
Event types
- Message events: mail.message.queued, mail.message.sending, mail.message.sent, mail.message.deferred, mail.message.failed, mail.message.bounced, mail.message.suppressed.
- Suppression events: mail.suppression.created and mail.suppression.deleted.
- OTP events: mail.otp.created, mail.otp.sent, mail.otp.verified, mail.otp.failed_attempt, mail.otp.failed, mail.otp.expired, and mail.otp.canceled.
- Template events: mail.template.created, mail.template.updated, mail.template.deleted, mail.template.version.created, and mail.template.test_sent.
- Domain events: mail.domain.created, mail.domain.verified, mail.domain.failed, and mail.domain.deleted.
- Webhook events: mail.webhook.created, mail.webhook.updated, mail.webhook.disabled, mail.webhook.delivery.succeeded, and mail.webhook.delivery.failed.
Create a webhook
Verify a signature
Operational APIs
- GET /mail/events filters by type, resourceType, resourceId, messageId, from, to, limit, and cursor.
- GET /mail/messages/{id}/timeline returns timeline items with type, label, createdAt, and optional metadata.
- GET /mail/webhooks/{webhookId}/deliveries filters webhook deliveries by status, limit, and cursor.
- GET /mail/webhook-deliveries/{deliveryId} includes delivery attempts.
- POST /mail/webhook-deliveries/{deliveryId}/retry requests a retry for a delivery.
Expected result
Your application processes mail lifecycle events once, verifies signatures, and can recover failed webhook deliveries.
Common failures
Related guides
Send email
Send a single outbound email with the official SDK or REST API, then inspect the message, attempts, logs, and timeline.
Bounces, suppressions, and reputation
Handle hard and soft bounces, workspace-scoped suppressions, sending limits, warmup stage, domain reputation, and reputation events.
Templates and OTP
Create versioned templates, preview and test them, send from a template, and use the built-in one-time-code challenge flow.