UserNotification
Manages notifications and alerts sent to users within the application. This entity handles all types of user communications including system alerts, security warnings, updates about their account, and activity notifications. Notifications can be delivered through multiple channels (in-app, email, SMS, push) and have different priority levels. They track whether a user has read or dismissed them, support action buttons for quick responses, and can expire after a certain time. This is essential for keeping users informed about important events, required actions, or changes that affect them. The system uses this to ensure users never miss critical information while avoiding notification fatigue.
Properties
| Property | Type | Mode | Description | Required |
|---|---|---|---|---|
| user | User | stored | The user who will receive this notification | Required |
| type | string | enum | Category of notification for filtering and display Values: Example: | Required |
| category | string | stored | Specific category for grouping similar notifications Example: | Required |
| title | string | stored | Short headline that appears in notification lists Example: | Required |
| message | string | stored | Full notification content with details | Required |
| priority | string | enum | Urgency level determining display order and delivery method Values: Example: | Optional |
| channel | string | enum | How the notification is delivered Values: Example: | Optional |
| status | string | enum | Current state of the notification Values: Example: | Optional |
| sentAt | DateTime | stored | When the notification was sent | Optional |
| deliveredAt | DateTime | stored | When the notification reached the user | Optional |
| readAt | DateTime | stored | When the user opened/read the notification | Optional |
| dismissedAt | DateTime | stored | When the user dismissed without reading | Optional |
| expiresAt | DateTime | stored | When the notification becomes irrelevant and should be hidden | Optional |
| actionUrl | string | stored | Link to related page or action | Optional |
| actionLabel | string | stored | Text for the action button Example: | Optional |
| data | object | stored | Additional structured data for the notification | Optional |
| retryCount | integer | stored | Number of delivery attempts made | Optional |
| failureReason | string | stored | Why the notification failed to deliver | Optional |
| createdAt | DateTime | stored | When the notification was created | Required |
Examples
Example 1
{
"@type": "UserNotification",
"type": "security",
"category": "account",
"title": "New Login from Unknown Device",
"message": "We detected a login to your account from a new device in San Francisco, CA. If this wasn't you, please secure your account immediately.",
"priority": "high",
"channel": "in_app",
"status": "read",
"sentAt": "2024-03-15T10:00:00Z",
"deliveredAt": "2024-03-15T10:00:01Z",
"readAt": "2024-03-15T10:05:00Z",
"actionUrl": "/security/recent-activity",
"actionLabel": "Review Activity",
"data": {
"deviceType": "Chrome on Windows",
"location": "San Francisco, CA",
"ipAddress": "203.0.113.42"
},
"createdAt": "2024-03-15T10:00:00Z"
}Example 2
{
"@type": "UserNotification",
"type": "info",
"category": "billing",
"title": "Your Monthly Invoice is Ready",
"message": "Your invoice for March 2024 totaling $99.99 is now available for download. Payment will be automatically processed on April 1st.",
"priority": "medium",
"channel": "email",
"status": "delivered",
"sentAt": "2024-03-25T09:00:00Z",
"deliveredAt": "2024-03-25T09:00:05Z",
"expiresAt": "2024-04-25T00:00:00Z",
"actionUrl": "/billing/invoices/2024-03",
"actionLabel": "View Invoice",
"data": {
"invoiceId": "INV-2024-03-001",
"amount": 99.99,
"dueDate": "2024-04-01"
},
"createdAt": "2024-03-25T09:00:00Z"
}