Skip to content

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:

EventWhen
notification.queuedA message is enqueued for delivery.
notification.sentAn adapter delivered the message.
notification.failedA send attempt failed (will retry until max_attempts).
notification.deliveredVendor webhook reports delivered/read.
notification.reply_receivedInbound reply logged (vendor webhook, Phase 2).
email.sent / email.failedLegacy, dual-published for channel=email only, one release, so patient_timeline keeps working.

Subscribed

EventHandlerEffect
appointment.scheduledhandlers.on_appointment_scheduledEnqueue appointment_confirmation.
appointment.cancelledhandlers.on_appointment_cancelledEnqueue appointment_cancelled.
patient.createdhandlers.on_patient_createdEnqueue welcome.
budget.senthandlers.on_budget_sentEnqueue budget_sent (only when send_method=email).
budget.acceptedhandlers.on_budget_acceptedEnqueue budget_accepted.
invoice.senthandlers.on_invoice_sentEnqueue invoice_sent (only when send_method=email).

Adding a new event

  1. Add the constant to backend/app/core/events/types.py (EventType).
  2. Publish from a service method, after the DB commit succeeds.
  3. Add the row to the table(s) above.
  4. Run python backend/scripts/generate_catalogs.py to refresh the global catalog.