Skip to main content

Get dashboard notifications

GET 

/company/dashboard

Returns a summary of unread notifications and the latest notifications for the authenticated user.

Use Cases:

  • Display an unread notification counter in the UI
  • List recent notifications in the user panel
  • Synchronize notification status between devices
  • Update notification status in real-time
  • Integration with enterprise monitoring systems

Typical Flow:

  1. The client calls this endpoint when loading the dashboard or when it detects changes
  2. The server validates the JWT token and obtains the company ID
  3. Queries for unread notifications and the last 10 notifications
  4. Returns the count of unread notifications and the list of notifications
  5. The client updates the UI showing the counter and the list

Considerations:

  • Notifications are sorted by creation date in descending order
  • The maximum limit of notifications returned is 10
  • Only notifications from the user's company are included
  • The endpoint is cacheable for 60 seconds for optimization

Implementation Example:

// Example frontend call
async function fetchDashboardNotifications() {
const response = await fetch('/company/notifications/dashboard', {
headers: {
'Authorization': `Bearer ${userToken}`
}
});
const data = await response.json();
updateNotificationBadge(data.unreadCount);
renderNotificationsList(data.lastNotifications);
}

Responses

Successful operation