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.

19 properties
Schema

Properties

PropertyTypeModeDescriptionRequired
userUser
stored

The user who will receive this notification

Required
typestring
enum

Category of notification for filtering and display

Values: info, warning, error, success, security, system

Example: "info"

Required
categorystring
stored

Specific category for grouping similar notifications

Example: "account"

Required
titlestring
stored

Short headline that appears in notification lists

Example: "Password Changed Successfully"

Required
messagestring
stored

Full notification content with details

Required
prioritystring
enum

Urgency level determining display order and delivery method

Values: low, medium, high, urgent

Example: "high"

Optional
channelstring
enum

How the notification is delivered

Values: in_app, email, sms, push, webhook

Example: "in_app"

Optional
statusstring
enum

Current state of the notification

Values: pending, sent, delivered, read, failed, dismissed

Example: "sent"

Optional
sentAtDateTime
stored

When the notification was sent

Optional
deliveredAtDateTime
stored

When the notification reached the user

Optional
readAtDateTime
stored

When the user opened/read the notification

Optional
dismissedAtDateTime
stored

When the user dismissed without reading

Optional
expiresAtDateTime
stored

When the notification becomes irrelevant and should be hidden

Optional
actionUrlstring
stored

Link to related page or action

Optional
actionLabelstring
stored

Text for the action button

Example: "View Details"

Optional
dataobject
stored

Additional structured data for the notification

Optional
retryCountinteger
stored

Number of delivery attempts made

Optional
failureReasonstring
stored

Why the notification failed to deliver

Optional
createdAtDateTime
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"
}