email.onAll
Every email event in one stream — runs before the specific hooks.
Fires for every email event, before its specific hook runs. type says which event it is, data holds that event’s payload, and emailDriver names the driver that produced it. Built for logging, metrics, and one-table event stores.
hooks: {
email: {
onAll: async (event) => {
await prisma.emailEvent.create({
data: {
type: event.type,
emailDriver: event.emailDriver,
payload: event.data,
},
});
},
},
},
context is set only for sync-replayed events — see Sync & recovery.
Payload
PropType
emailDriver?string
EmailKit driver id that produced this event
Type
stringtype| "inbound"
| "outbound"
| "delivered"
| "opened"
| "clicked"
| "bounced"
| "complained"
| "rejected"
| "unknown"
Which email event this is
Type
| "inbound"
| "outbound"
| "delivered"
| "opened"
| "clicked"
| "bounced"
| "complained"
| "rejected"
| "unknown"dataunknown
The event payload, shaped by `type`
Type
unknownraw?unknown
Provider-specific raw data (for debugging or advanced use cases)
Type
unknowncontext?unknown
User round-trip data from `SyncInput.context`, set only for sync-replayed events.
Type
unknown