Notifications — events
Scaffolded stub — replace with proper documentation when this module is next touched.
Per-module slice of docs/events-catalog.md (auto-generated). Update both files when adding or removing events.
Published
Published by the gateway (gateway.py) across the outbox lifecycle:
| Event | When |
|---|---|
notification.queued | A message is enqueued for delivery. |
notification.sent | An adapter delivered the message. |
notification.failed | A send attempt failed (will retry until max_attempts). |
notification.delivered | Vendor webhook reports delivered/read. |
notification.reply_received | Inbound reply logged (vendor webhook, Phase 2). |
email.sent / email.failed | Legacy, dual-published for channel=email only, one release, so patient_timeline keeps working. |
Subscribed
| Event | Handler | Effect |
|---|---|---|
appointment.scheduled | handlers.on_appointment_scheduled | Enqueue appointment_confirmation. |
appointment.cancelled | handlers.on_appointment_cancelled | Enqueue appointment_cancelled. |
patient.created | handlers.on_patient_created | Enqueue welcome. |
budget.sent | handlers.on_budget_sent | Enqueue budget_sent (only when send_method=email). |
budget.accepted | handlers.on_budget_accepted | Enqueue budget_accepted. |
invoice.sent | handlers.on_invoice_sent | Enqueue invoice_sent (only when send_method=email). |
Adding a new event
- Add the constant to
backend/app/core/events/types.py(EventType). - Publish from a service method, after the DB commit succeeds.
- Add the row to the table(s) above.
- Run
python backend/scripts/generate_catalogs.pyto refresh the global catalog.