Notifications

Multi-channel notification system delivering messages via email, SMS, and in-app channels.

Architecture

LayerLocation
Notification processorsbackend/src/lib/notifications/
Email templatesbackend/src/lib/email-templates/
SMS modulebackend/src/lib/sms/
Portal notificationsportalNotifications DB table
Notification bellPortalNotificationBell component

Channels

ChannelProviderImplementation
EmailResend Emailbackend/src/lib/email-templates/
SMSMessageBird SMSbackend/src/lib/sms/
In-app (portal)InternalportalNotifications table + PortalNotificationBell

Notification Types

TypeChannel(s)Trigger
Document obtaining remindersEmail, SMSOverdue document requests
Document rejectionEmail, in-appDocument Review rejection
Appointment confirmationEmail, SMSAppointment booked
Portal accessEmail, SMSNew Portal token issued
Form submission confirmationEmailForm submitted

Background Processing

Notifications are processed asynchronously via Background Jobs (BullMQ notification queue). This prevents notification delivery from blocking API responses and provides retry capabilities for transient failures.

Document Obtaining Reminders

Dedicated tables track reminder state:

TablePurpose
documentObtainingReminderHistoryTracks when reminders were sent per document request
documentObtainingNotificationsConfigures reminder schedules and escalation rules

See Document Obtaining for the full document collection workflow.

Email Templates

Email templates at backend/src/lib/email-templates/ are HTML templates with placeholder interpolation. Template selection and content are managed through the Admin Dashboard (email template settings).

SMS Delivery

SMS messages are sent via MessageBird SMS with SMS_CATCH_ALL_PHONE_NUMBERS for development/staging environments (prevents sending real SMS during testing).

In-App Notifications

The portalNotifications table stores in-app notifications for Portal users. The PortalNotificationBell component displays unread count and notification list.