Skip to main content

Notification Service

The Notification Service is a centralized utility for delivering user-facing notifications across multiple channels, including Email, SMS, and real-time WebSockets.

Overview

In a microservices architecture, sending emails or SMS directly from business services can be complex and error-prone. The Notification Service simplifies this by:

  • Providing a unified API for all channels.
  • Abstracting specific provider details (e.g., switching from SendGrid to SMTP without code changes).
  • Handling notifications asynchronously via queues for reliability and retries.
  • Managing templates and localization centrally.

Supported Channels

  • Email: Support for SMTP, SendGrid, and more.
  • SMS: Integration with Twilio and a generic webhook adapter for custom gateways.
  • WebSockets: Real-time push notifications via NATS.

Key Features

  • Asynchronous Delivery: Notifications are queued and processed by background workers.
  • Provider-Agnostic: Change providers via configuration, not code.
  • Sender Profiles: Define different identities (e.g., "Support", "Marketing") for the same channel.
  • CID Embedding: Emails support embedded images, reducing reliance on external CDNs.

Integration

To send a notification, services simply POST a JSON payload to the /notify endpoint.

Example Request:

{
"channel": "email",
"recipient": "user@example.com",
"template_name": "otp-verification",
"data": {
"code": "123456"
}
}