Table of Contents

Notifications — the per-user inbox

Grounded against origin/releases/7.0 (MibServer3 NotificationController/NotificationV2Controller + NotificationWorkflow + NotificationRepository, the MIB3UX_NOTIFICATION migrations, and the TSV-exporter seam).

A MIB notification is a persistent, per-user inbox record — NOT a transient toast and NOT a broadcast. It carries a message + sender + optional image/link + read-state, survives reloads, and is delivered to specific user ids. The shell shows an unread count and list; a customization sends one by calling IPublicNotificationWorkflow.Send(...). Use it to tell a user "your export is ready", "import finished with 3 errors", "this item was published".

Data model — MIB3UX_NOTIFICATION

A media type (so it's a normal MIB table), one row per recipient (201603181539250_Mib_AddNotificationTable + 202202092104270_Mib_AddNotificationFields):

Column Holds
ID / DATEINS / NAME / OWNER base cols (OWNER = the user who created it)
USER_ID the target user (nullable)
MESSAGE, SENDER_NAME, IMAGE_URL, NOTIFICATION_URL the payload (all support {DICT:Section/Key} — see building-block.i18n-dictionary)
READ bit, default 0 = unread
STORAGE_TYPE, FILE_NAME for file-backed notifications (e.g. a TSV export download) — STORAGE_TYPE picks Disk vs a signed cloud URL

Send one from a customization

Inject IPublicNotificationWorkflow and call Send — it inserts one row per user id (MibServer3 · …/Workflow.Mvc/Notification/NotificationWorkflow.cs:54-65 → NotificationRepository.cs:42-54):

// IPublicNotificationWorkflow (…/Model/Workflow/IPublicNotificationWorkflow.cs:5-7)
await _notifications.Send(
    senderName: "{DICT:MYAGENT/AGENTNAME}",     // {DICT:} tokens allowed
    message:    "Your export is ready",
    url:        "/download/123",                 // relative; opened when the user clicks the notification
    userIds:    new[] { targetUserId },          // one row inserted per id — targeted, never broadcast
    imageUrl:   "");
// overload: Send(NotificationRequest { SenderName, Message, NotificationUrl, UserIds, ImageUrl }, ct)

There is no "all users" / broadcast option — you pass explicit ids. (CANNOT-CONFIRM any admin UI for hand-authoring a notification in 7.0; the grounded senders are backend seams like the TSV exporter, MibServer3 · MediaiBox.Cms.TsvExporter.Core/Services/Notifications/NotificationService.cs:28-40.)

How the shell consumes it (polling + ETag)

The React shell polls GET /api/v2/notifications (NotificationV2Controller.cs:33-53), which returns NotificationV2ViewData { int TotalUnread; NotificationV2ViewItem[] Notifications; int? NextId } — keyset-paged via limit + startFrom, NextId is the cursor. The response is ETag-cached: the controller SHA1s the JSON body and sets ETag + Cache-Control: private,no-cache,must-revalidate; a matching If-None-Match returns 304 (no payload), so idle polling is cheap. Writes:

Endpoint Verb Role
/api/v2/notifications GET list (unread count + page); 304 when unchanged
/api/v2/notifications PUT mark ids read — empty array = mark ALL read
/api/v2/notifications/url/{id} GET resolve the target url (signs it if cloud-stored)

(/api/v1/notification is the legacy predecessor — GET list / GET /notificationUrl/{id} / PATCH /{id}.)

Use cases

  • Async job done — export/import/publish finishes → notify the initiating user with a result + download link.
  • Fan-out to a set of users — pass several ids (e.g. everyone in a role) → one inbox row each.
  • File hand-off — set STORAGE_TYPE/FILE_NAME so the notification's url resolves to a (possibly signed) download.

Gotchas (grounded)

  1. Targeted only, one row per user — no broadcast; a 10-user notify writes 10 rows. Read-state is per-row.
  2. Read-state is per-notification, not per-device — mark-read on the web reflects everywhere on next poll.
  3. {DICT:} in message/sender — localize via dictionary tokens (building-block.i18n-dictionary), don't hardcode.
  4. File-backed → STORAGE_TYPE matters — a non-Disk storage type makes …/url/{id} mint a signed URL; get it wrong and the download 403s.
  5. No visible retention/delete-UI in 7.0 (CANNOT-CONFIRM) — rows persist; a cleanup job is the customization's job.
  6. PublicNotification = the public API surface (external callers via IPublicNotificationWorkflow), not a separate broadcast type (CANNOT-CONFIRM any separate public-notification store/controller).

Discover

mib get building-block.notifications · mib get recipe.send-notification · localize the text: mib get building-block.i18n-dictionary.