Skip to main content

Notification Service

Keeping users informed with real-time and scheduled alerts.

Overview

The Notification Service is a centralized hub for sending messages to users across multiple channels. It decouples the logic of what to send from the logic of how to send it.

Key Responsibilities

  • Email Notifications: Sends transactional emails (e.g., welcome emails, password resets) via providers like SendGrid or AWS SES.
  • In-App Alerts: Manages the delivery of real-time notifications to LibreApps Desktop dashboard using WebSockets or SSE.
  • SMS Alerts: Sends text messages for urgent notifications or two-factor authentication.
  • Template Management: Stores and manages message templates for different types of notifications.
  • Preference Management: Respects user settings for which types of notifications they want to receive and on which channels.

API Endpoints

POST /api/notifications/send

Sends a notification to a specific user or group of users.

GET /api/notifications/history

Retrieves the notification history for the current user.

PUT /api/notifications/preferences

Updates the user's notification preferences.

Architecture

The service often uses a message queue (e.g., RabbitMQ or Kafka) to handle high volumes of notifications asynchronously. This ensures that the main application flow is not blocked by slow external API calls to email or SMS providers.

Best Practices

  • Do this: Use templates for all notifications to ensure a consistent look and feel.
  • Do this: Implement retry logic for failed notification deliveries.
  • Don't do this: Send too many notifications to a user; it can lead to "notification fatigue" and cause them to ignore important alerts.