> ## Documentation Index
> Fetch the complete documentation index at: https://internal.softcrum.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Module Spec — messaging (schema messaging)

> Owns templates, campaigns, sends, deliverability, suppressions AND the platform-wide notification routing (standards/notifications.md).

## Entities & invariants

| Table                                                                                                       | Key invariants                                                                                                                                                                  |
| ----------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| message\_templates                                                                                          | React Email; versioned; variables validated against attribute\_definitions                                                                                                      |
| campaigns                                                                                                   | blast (segment one-shot) \| automation (standing trigger); category transactional\|marketing\|product                                                                           |
| campaign\_triggers                                                                                          | event \| date\_property (timezone-aware: birthday, customer\_since anniversary; per-contact tz else tenant tz) \| segment\_entered \| segment\_exited \| points\_expiring\_soon |
| sends                                                                                                       | correlation\_id + origin\_event\_id + channel\_code; created only after resolveChannels passes ALL gates                                                                        |
| send\_status\_history                                                                                       | partitioned; parametric statuses queued→sent→delivered→opened→clicked / bounced / complained / failed; fed by provider status adapters (Resend webhooks today)                  |
| suppressions                                                                                                | global per tenant; auto-write on hard bounce/complaint/unsubscribe; checked on EVERY send                                                                                       |
| sender\_domains                                                                                             | per-tenant SPF/DKIM verification flow; default shared subdomain; custom = add-on (DEC-F4)                                                                                       |
| platform\_channel\_status / tenant\_channel\_settings / module\_channel\_settings / event\_channel\_routing | cascade levels 0–3                                                                                                                                                              |

## Behavior rules

* Blasts: batch endpoints only, marketing rail, per-tenant token bucket; a blast NEVER degrades transactional latency (ADR-015).
* date\_property triggers run on cron fan-out at tenant-local send window; duplicates impossible via (campaign, contact, date) idempotency key.
* Unsubscribe link mandatory on marketing; preference center per channel×category; transactional no-opt-out.

## Events emitted

campaign.triggered · message.sent|delivered|opened|clicked|bounced|complained
