Skip to content

Integrations — events

Per-module slice of docs/events-catalog.md (auto-generated). Update both files when adding or removing events.

Published

This module does not publish any events.

Subscribed

EventHandlerEffect
patient.createdintegrations.handlers.IntegrationsHandlers.on_patient_createdTransactional — queues one WebhookDelivery row per active subscription listing this event, on the publisher's own session. All deliveries for this publish share one event_id. No network I/O; the scheduled dispatch_outbox tick sends it.
appointment.completedintegrations.handlers.IntegrationsHandlers.on_appointment_completedSame shape — queues one WebhookDelivery per active subscription. Shared event_id.
appointment.scheduledintegrations.handlers.IntegrationsHandlers.on_appointment_scheduledPhase 2. Same shape. Publisher: agenda/service.py (db=).
appointment.cancelledintegrations.handlers.IntegrationsHandlers.on_appointment_cancelledPhase 2. Same shape. Publisher: agenda/service.py (db=).
appointment.no_showintegrations.handlers.IntegrationsHandlers.on_appointment_no_showPhase 2. Same shape. Publisher: agenda/service.py (db=).
budget.sentintegrations.handlers.IntegrationsHandlers.on_budget_sentPhase 2. Same shape. Publisher: budget/workflow.py (db=).
budget.acceptedintegrations.handlers.IntegrationsHandlers.on_budget_acceptedPhase 2. Same shape. Publisher: budget/workflow.py (db=).
budget.rejectedintegrations.handlers.IntegrationsHandlers.on_budget_rejectedPhase 2. Same shape. Publisher: budget/workflow.py (db=).

Deferred triggers (publish without db=)

These events exist in EventType but their publishers do not pass a session (db=), so subscribing would violate ADR 0019. Fixing them requires a publisher-side change, tracked as a follow-up:

  • patient.updated — patients/service.py
  • invoice.issued / invoice.paid — billing/service.py
  • payment.recorded — payments/service.py

Adding a new event

  1. Add the constant to backend/app/core/events/types.py (EventType).
  2. Publish from a service method with db=session (ADR 0019 guard).
  3. Add a transactional handler to handlers.py and register it in __init__.py.get_event_handlers().
  4. Add the event to SUPPORTED_EVENT_TYPES in triggers.py.
  5. Add a frozen sample payload sample_payloads/<event>.json.
  6. Add the row to the table above.
  7. Run python backend/scripts/generate_catalogs.py to refresh the global catalog.