Notifications

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

Architecture

LayerLocation
Notification service layerbackend/src/lib/notifications/ (notification-service, channel-resolver, renderers, portal-notifications)
BullMQ job processorbackend/src/lib/jobs/processors/notifications.ts (routes email/SMS jobs + scheduled jobs)
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 SMS (provider now branded “Bird”, BIRD_API_KEY)backend/src/lib/sms/
In-app (portal)InternalportalNotifications table + PortalNotificationBell

Notification Intents

Current intents (backend/src/lib/notifications/types.ts):

IntentChannel(s)Trigger
password_reset, email_verification, magic_link, welcome_emailEmailAuthentication flows
phone_verification, 2fa_codeSMSPhone/2FA verification
document_reminder, new_document_requestsEmail, SMSDocument Obtaining requests and overdue reminders
rejection_bundleEmailConsolidated Document Review rejections (10-min bundling window)
help_responseEmail, in-appPortal help chat responses
generic_notificationAnyAd-hoc notifications

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. The processor at backend/src/lib/jobs/processors/notifications.ts dispatches email/SMS jobs and delegates scheduled work to sibling processors: document-reminder, reminder-scheduler, rejection-bundle, escalation-scheduler, token-cleanup, entra-sync, and the billing-* jobs.

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 (the provider rebranded to “Bird”; the backend reads BIRD_API_KEY) with SMS_CATCH_ALL_PHONE_NUMBERS for development/staging environments (prevents sending real SMS during testing).

Email i18n

Email templates are bilingual: each template takes a language: 'de' | 'en' parameter and renders per-language content blocks at the backend boundary.

In-App Notifications

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