Skip to content
bitzorcas
EN

Reference

Notifications module

Multi-channel notification system — in-app inbox with preference management, template-based notifications, delivery adapter ports, and CAP event publishing.

Last updated

The Notifications module provides an in-app notification inbox with multi-channel delivery abstraction, preference management, and template-based notifications.

Endpoints

EndpointMethodDescription
/api/notificationsGETPaginated inbox listing
/api/notifications/{id}/readPOSTMark as read
/api/notifications/read-allPOSTMark all as read
/api/notifications/preferencesGET/PUTUser notification preferences

Architecture

NotificationEndpoints
NotificationService
├── INotificationRepository → SqlSugarNotificationRepository
├── INotificationPreferenceStore → AllowAllNotificationPreferenceStore
├── INotificationDeliveryAdapter → NullNotificationDeliveryAdapter
└── INotificationTemplateStore → (configuration-based)

Key components

NotificationService

Central service for creating and delivering notifications:

public class NotificationService
{
// Create notification → persist to inbox + trigger delivery
public Task CreateAsync(string userId, NotificationTemplate template,
CancellationToken ct);
// Mark individual notification as read
public Task MarkReadAsync(Guid notificationId, CancellationToken ct);
// Query user's inbox
public Task<NotificationInboxPage> GetInboxAsync(string userId,
int page, int pageSize, CancellationToken ct);
}

NotificationTemplate

public class NotificationTemplate
{
public string Title { get; }
public string Body { get; }
public string Category { get; } // system, chat, ticket, billing, etc.
public Dictionary<string, string> Variables { get; }
}

NotificationPreference

public class NotificationPreference
{
public string Category { get; }
public bool InApp { get; }
public bool Email { get; }
public bool Sms { get; }
public bool Push { get; }
}

Notification entity

public class NotificationEntity : TenantSoftDeleteEntityBase
{
public string UserId { get; set; }
public string Title { get; set; }
public string Body { get; set; }
public string Category { get; set; }
public bool IsRead { get; set; }
public DateTimeOffset? ReadAt { get; set; }
}

Delivery channels

ChannelImplementationStatus
In-app inboxSqlSugarNotificationRepository✅ Implemented
EmailNullNotificationDeliveryAdapter📋 Planned
SMSN/A📋 Planned
PushN/A📋 Planned

Event integration

Notifications are triggered by integration events from other modules:

Ticket created → ticket.created event → NotificationService
Chat mention → chat.mention event → NotificationService
Billing alert → billing.overdue event → NotificationService

See also