Multi-Channel Notification System
Overview
The Multi-Channel Notification System is a comprehensive solution for delivering notifications across multiple communication channels (Email, SMS, WhatsApp, Telegram, and FCM). It provides a unified interface for sending notifications while respecting user preferences, Do Not Disturb (DND) settings, and notification categories.
Core Features
Multiple Delivery Channels
- Email: Default channel using Spring Mail
- SMS: Twilio integration for SMS delivery
- WhatsApp: WhatsApp Business API integration
- Telegram: Telegram Bot API integration
- Firebase Cloud Messaging (FCM): Push notifications for mobile devices
Notification Categories
- BILLING: Payment and subscription-related notifications
- SECURITY: Password changes, security alerts
- SUPPORT: Support ticket updates
- PROMOTIONAL: Marketing and special offers
- SYSTEM: System maintenance and updates
- ACCOUNT: Account-related changes
- SUBSCRIPTION: Subscription status updates
User Preferences Management
- Per-channel enable/disable settings
- Category-based filtering
- DND (Do Not Disturb) scheduling
- Timezone-aware delivery
- Localization support
System Architecture
graph TD
A[Client Application] --> B[GraphQL API Layer]
B --> C[MultiChannelNotificationService]
C --> D[Channel Services]
D --> E[EmailService]
D --> F[SmsService]
D --> G[WhatsAppService]
D --> H[TelegramService]
D --> I[FCMService]
J[NotificationPreferences] --> C
K[MessageTemplates] --> C
L[RateLimiter] --> C
GraphQL API Reference
Notification Preferences
Get User Preferences
query GetNotificationPreferences {
getNotificationPreferences {
enabledChannels
enabledCategories
dndEnabled
dndStartTime
dndEndTime
timezone
}
}
Update Preferences
mutation UpdateNotificationPreferences($input: NotificationPreferencesInput!) {
updateNotificationPreferences(input: $input) {
enabledChannels
enabledCategories
dndEnabled
dndStartTime
dndEndTime
timezone
}
}
input NotificationPreferencesInput {
enabledChannels: [NotificationChannel!]!
enabledCategories: [NotificationCategory!]!
dndEnabled: Boolean
dndStartTime: String
dndEndTime: String
timezone: String
}
Channel-Specific Operations
Send WhatsApp Notification
mutation SendWhatsAppNotification(
$userId: Int
$username: String
$message: String!
) {
sendWhatsAppNotification(
userId: $userId
username: $username
message: $message
)
}
Send Telegram Notification
mutation SendTelegramNotification(
$userId: Int
$username: String
$message: String!
) {
sendTelegramNotification(
userId: $userId
username: $username
message: $message
)
}
Send FCM Notification
mutation SendNotificationByToken(
$token: String!
$notification: NotificationInput!
) {
sendNotificationByToken(token: $token, notification: $notification) {
status
message
}
}
input NotificationInput {
subject: String!
content: String!
}
Administrative Operations
Get Notification Stats
query GetNotificationStats {
getNotificationStats {
totalNotificationsSent
notificationsByChannel {
channel
count
successRate
}
notificationsByCategory {
category
count
}
failedNotifications
}
}