GhaylStackDocumentationv1.0.2
العربيةWebsite
Platform modules

Platform modules

Notification inbox and delivery

Read the current user's inbox, update read state and trace notifications from domain events.

What the inbox represents

Notifications stores recipient-specific items and exposes them under /api/v1/notifications. Each item belongs to a user in a tenant. Listing applies the current user ID before returning records, so a caller cannot choose another recipient through the list query.

The module contains handlers for chat mentions, workflow changes, ticket SLA breaches, invoice-issued email and tenant validity email. Delivery mechanisms depend on the handler: an email event and an inbox event should not be assumed to produce the same visible result.

Load and mark notifications

Operation Route beneath /api/v1/notifications
List the inbox GET /
Count unread items GET /unread-count
Mark one item read POST /{id}/read
Mark all items read POST /read-all

The list supports UnreadOnly, Page and PageSize; its contract defaults to page 1 and 50 items. The handler clamps the size between 1 and 200 and sorts newest first. Use pagination for history and the count endpoint for the bell badge.

Viewing requires Permissions.Notifications.Inbox.View. Read-state changes require Permissions.Notifications.Inbox.MarkRead. A custom interface should apply the server's result before updating counts, and refresh after reconnection to recover missed live events.

Trace workflow and SLA notifications

The workflow handler creates a workflow.decision notification linked to /workflows/requests/{requestId}. The ticket SLA handler creates ticket.sla, links to /tickets/{ticketId} and includes the target and due time in its data.

These handlers pass the originating event ID into the notification. The shared delivery helper checks tenant context and uses a transaction and an advisory lock to avoid inserting an existing notification ID again. Once committed, it sends NotificationCreated to the recipient's SignalR user group.

Add an application notification

Define an integration event in the owning module's Contracts project. Include the tenant, intended recipient and identifiers needed to open the relevant business record. Write a Notifications handler using the existing workflow or SLA handler as a pattern, then register handlers through the module's event wiring.

Keep the notification short and let the destination page enforce its own permissions. An inbox link is a navigation aid; it must not become a substitute for authorization when the user opens a ticket or approval request. Use stable event identity when retries can revisit the same business event.

Verify and troubleshoot

Trigger a workflow decision for a test recipient, verify the inbox item and unread count, then mark it read and reload. Repeat with a different recipient and tenant to check isolation. Reprocessing the same event identity should not create a second inbox record through the shared helper.

If an item is absent, follow the originating business event, its tenant, its recipient and the handler. If it is present after reload but never appears live, inspect the authenticated SignalR connection. If the badge is wrong, compare unread count with the list's UnreadOnly filter. If an email is absent, inspect mailing delivery separately from inbox storage.

Implementation references

View MarkdownBack to top

Search documentation

Use ↑ ↓ to move, Enter to open and Esc to close.