Add basic user notifications for new conversations
Summary
Introduce a notification system that alerts users when a conversation is added to their organization or directed to them individually.
Notifications should normally be created automatically as part of conversation creation. Provide endpoints to retrieve notifications, dismiss an individual notification, and allow Secretariat users to create generic notifications.
Data Model
Create a collection containing a notification list for each recipient user UUID:
{
"<user_uuid>": {
"notifications": [
{
"UUID": "<notification_uuid>",
"body": "ORG XYZ has sent a message.",
"links": {
"org_shortname": "",
"user_shortname": ""
},
"type": "PUBLIC_MESSAGE",
"created_at": "2026-09-21T14:00:00Z"
}
]
}
}
user_uuid identifies the recipient.
- Each notification has a unique
UUID so it can be dismissed individually.
body contains the notification text.
links identifies the relevant organization or user for navigation. Unused values may remain empty.
type accepts either PRIVATE_MESSAGE or PUBLIC_MESSAGE.
created_at supports chronological ordering.
The notification UUID and timestamp are proposed additions to the supplied structure.
Proposed Endpoints
| Method |
Endpoint |
Behavior |
| GET |
/api/notification |
Return the authenticated user’s notifications, newest first. |
| DELETE |
/api/notification/:uuid |
Dismiss one notification belonging to the authenticated user. |
| POST |
/api/notification/target/:user_uuid |
Create a generic notification for an existing user. Secretariat only. |
Retrieve Notifications
- Require authentication.
- Return only the authenticated user’s notifications.
- Return
200 with an empty notifications array when none exist.
Dismiss a Notification
- Require authentication.
- Remove the specified notification from the authenticated user’s list.
- Return
204 when successfully dismissed.
- Return
404 if the notification is absent from that user’s list.
- Dismissing a notification must not affect another user’s copy.
Create a Generic Notification
- Require authentication and the Secretariat role.
- Accept
body, links, and type.
- Generate the notification UUID and timestamp.
- Validate that the recipient exists.
- Return
201 with the created notification.
- Return
403 for non-Secretariat callers.
Automatic Notification Behavior
- For an organization recipient, create a separate notification for each eligible user in that organization.
- For an individual recipient, create a notification only for that user.
- Populate the notification body and navigation links from the conversation context.
- Apply existing conversation access rules when selecting recipients. Private conversations currently have Secretariat-only visibility; notifications must preserve that restriction.
- Create notifications through the shared conversation creation path so both direct conversation creation and conversations added through organization updates are covered.
- Persist conversation and notification writes within the same transaction so a failed operation leaves neither partially saved.
- Editing an existing conversation does not generate a new notification.
Implementation Plan
- Add the notification model, validation, and repository using existing repository patterns.
- Add authenticated retrieval and dismissal endpoints and the Secretariat-only creation endpoint.
- Add shared recipient resolution and notification creation to
ConversationRepository.createConversation().
- Document the endpoints and add integration coverage.
Acceptance Criteria
Add basic user notifications for new conversations
Summary
Introduce a notification system that alerts users when a conversation is added to their organization or directed to them individually.
Notifications should normally be created automatically as part of conversation creation. Provide endpoints to retrieve notifications, dismiss an individual notification, and allow Secretariat users to create generic notifications.
Data Model
Create a collection containing a notification list for each recipient user UUID:
{ "<user_uuid>": { "notifications": [ { "UUID": "<notification_uuid>", "body": "ORG XYZ has sent a message.", "links": { "org_shortname": "", "user_shortname": "" }, "type": "PUBLIC_MESSAGE", "created_at": "2026-09-21T14:00:00Z" } ] } }user_uuididentifies the recipient.UUIDso it can be dismissed individually.bodycontains the notification text.linksidentifies the relevant organization or user for navigation. Unused values may remain empty.typeaccepts eitherPRIVATE_MESSAGEorPUBLIC_MESSAGE.created_atsupports chronological ordering.The notification UUID and timestamp are proposed additions to the supplied structure.
Proposed Endpoints
/api/notification/api/notification/:uuid/api/notification/target/:user_uuidRetrieve Notifications
200with an empty notifications array when none exist.Dismiss a Notification
204when successfully dismissed.404if the notification is absent from that user’s list.Create a Generic Notification
body,links, andtype.201with the created notification.403for non-Secretariat callers.Automatic Notification Behavior
Implementation Plan
ConversationRepository.createConversation().Acceptance Criteria