MATIH Platform is in active MVP development. Documentation reflects current implementation status.
8. Platform Services
Architecture

Notification Service Architecture

Production - 5 controllers, 7 channels, state machine delivery

The Notification Service is the multi-channel notification delivery backbone of the MATIH platform. Running on port 8085, it handles sending notifications through email, SMS, push, Slack, Microsoft Teams, in-app, and webhook channels. It includes template management with variable substitution, user preference tracking, delivery analytics with open/click tracking, and unsubscribe management compliant with RFC 8058.


Service Overview

PropertyValue
Service Namenotification-service
Port8085
TechnologySpring Boot 3.2, Java 21
DatabasePostgreSQL (JPA/Hibernate)
Event BusKafka (notification events)
EmailSMTP (configurable: SendGrid, SES, etc.)
State MachineSpring State Machine for delivery lifecycle

Controllers

ControllerBase PathPurpose
NotificationController/api/v1/notificationsSend, retry, cancel notifications
TemplateController/api/v1/templatesTemplate CRUD, preview rendering
PreferenceController/api/v1/preferencesUser notification preferences
TrackingController/api/v1/notifications/trackOpen/click tracking, analytics
UnsubscribeController/api/v1/notifications/unsubscribeUnsubscribe management

Notification Delivery Pipeline

Send Request -> Validate -> Resolve Template -> Check Preferences
       |            |             |                    |
       v            v             v                    v
   Enqueue -> Route to Channel -> Deliver -> Track Events
                    |                |            |
              +-----+-----+         v            v
              |     |     |    Record Status   Analytics
            Email  Slack  Push
            SMS   Teams  Webhook
                  In-App

Notification State Machine

Notifications follow a state machine lifecycle:

PENDING -> QUEUED -> SENDING -> DELIVERED
              |          |          |
              v          v          v
           FAILED    FAILED     BOUNCED
              |          |
              v          v
          RETRYING   RETRYING -> DELIVERED | FAILED
StatusDescription
PENDINGCreated, not yet queued
QUEUEDIn the delivery queue
SENDINGBeing processed by a channel
DELIVEREDSuccessfully delivered
FAILEDDelivery failed (retryable or permanent)
RETRYINGScheduled for retry
CANCELLEDCancelled before delivery
BOUNCEDEmail bounced back

Channels

ChannelImplementationDescription
EMAILEmailChannelSMTP-based email delivery
SMSSmsChannelSMS via configured provider
PUSHPushChannelMobile push notifications
SLACKSlackChannelSlack webhook integration
TEAMSTeamsChannelMicrosoft Teams webhook
IN_APPInAppChannelIn-application notifications
WEBHOOKWebhookChannelCustom HTTP webhook delivery

All channels implement the NotificationChannel interface:

public interface NotificationChannel {
    void send(Notification notification, RenderedTemplate template);
    boolean supports(Notification.Channel channel);
}

Next Steps