# Reliability & Observability

Use message state, delivery records and the audit log to determine what happened.
An accepted send is not proof of delivery to an inbox.

## Message lifecycle

| Event | Meaning | Webhook producer |
|---|---|---|
| `message.sent` | Sender accepted the message and returned a transmission ID | Send/reply/scheduled path |
| `message.received` | Inbound email arrived | Inbound parser |
| `message.delivered` | Recipient server accepted the message; inbox placement is not guaranteed | Authenticated provider callback |
| `message.opened` | An open was reported; privacy tools may affect tracking | Authenticated provider callback |
| `message.clicked` | A tracked click was reported | Authenticated provider callback |
| `message.bounced` | A bounce was reported | Authenticated provider callback |
| `message.complained` | A complaint was reported | Authenticated provider callback |

All seven event types use a durable outbox before Redis dispatch. Delivery and
engagement events require enabled, authenticated provider callbacks and matching
subscriptions. If callback ingress is disabled, no live engagement events are
produced. Read current message state with `GET /v1/inboxes/{inbox_id}/messages/{id}`
or `get_message`. See [Webhooks](/docs/webhooks) for payloads.

## Retry policy

Signing, retries, dead-letter recovery and replay are included in every plan.
Each attempt has a 30-second timeout; any 2xx response acknowledges receipt.
There are seven attempts total, with delays of 1, 2, 4, 8, 16 and 32 seconds.
Existing queued jobs keep their original retry options.

After the last failure, automatic retries stop and a dead-letter entry is
available for recovery. Delivery is not guaranteed. Read
`GET /v1/webhooks/{id}/deliveries` for each attempt's status and duration.

## Event replay

- `GET /v1/webhooks/{id}/dlq` lists failed events.
- `POST /v1/webhooks/{webhook_id}/deliveries/{delivery_id}/replay` retries one event.
- `POST /v1/webhooks/{webhook_id}/replay-failed` queues a filtered batch.

Replay preserves event ID and data, with a new timestamp and replay metadata in
a freshly signed envelope. It uses the current registered destination and secret,
with tenant checks and DNS-pinned public egress. It never sends another email.
See [Replay Mechanics](/docs/concepts/replay-mechanics).

## Signatures and duplicates

Verify `X-Mailbot-Signature` using HMAC-SHA256 over the raw body. The timestamp
is inside the signed JSON body, not a separate header. Deduplicate using
`event_id`, also carried by `X-Mailbot-Event-Id` and `Idempotency-Key`.
At-least-once delivery means duplicates can arrive; arrival order is not guaranteed.

Persist a verified event durably before returning 2xx. Process slower work in
your own retryable worker. Read `GET /v1/audit-log` and delivery statistics to
investigate missing effects after an acknowledged callback.

## Owner notifications

Scheduled-send failures can produce an hourly owner digest with a count and UTC
window. This is separate from webhook delivery. See
[Owner Notifications](/docs/operations/owner-notifications) for preferences,
retry behavior and the implemented coverage.
