Skip to main content

Notifications

Real-time · Alerts · Preferences

Notification Management

The notification system provides real-time communication through a comprehensive workflow that includes notification creation, delivery tracking, preference management, and user interaction. Built with Laravel Echo for real-time updates and featuring a drawer-based interface for seamless user experience.

Real-time delivery

Instant notifications via WebSocket connections.

Preference controls

User-specific notification type management.

Multi-type support

Todos, assignments, reminders, and system alerts.

Key Features

Core notification capabilities.

🔔

Real-time Notifications

WebSocket-based instant delivery via Laravel Echo.

📱

Drawer Interface

Slide-out notification panel with tabs and actions.

⚙️

Preference Management

User-specific notification type controls.

📊

Read/Unread Status

Track notification status with bulk actions.

�️

Delete Management

Individual or bulk notification deletion.

🔄

Auto-refresh

Automatic updates on new notifications.

Notification Workflow

Complete notification lifecycle.

1️⃣

Event Trigger

System events (todo assignment, completion, due dates) trigger notification creation in Laravel backend.

2️⃣

Database Storage

Notifications stored in database_notifications table with user association and metadata.

3️⃣

Real-time Broadcast

Laravel Echo broadcasts notifications to private channels: company-user.[userId].

4️⃣

Frontend Reception

React hook useCompanyNotifications receives and processes notifications in real-time.

5️⃣

UI Update

Notification drawer updates with badge count, new items, and automatic refresh.

6️⃣

User Interaction

Users can mark as read, delete, or manage preferences through the interface.

Notification Types

Supported notification categories.

Todo Assigned

When a todo is assigned to a user by another team member.

🎉

Todo Completed

When a todo task is marked as completed by assignee.

Due Date Reminder

Automated reminders for approaching todo due dates.

📢

System Alerts

General system notifications and announcements.

Notifications Management Overview

Visual guide to notification management features.

This video demonstrates the complete notification workflow including real-time delivery, drawer interface, preference management, and notification interactions like marking as read and deletion.

API Endpoints

Available notification API routes.

MethodEndpointDescription
GET/api/company/notificationsGet all notifications with pagination
GET/api/company/notifications/unreadGet unread notifications only
GET/api/company/notifications/unread-countGet unread notifications count
PATCH/api/company/notifications/[id]/readMark specific notification as read
PATCH/api/company/notifications/read-allMark all notifications as read
DELETE/api/company/notifications/[id]Delete specific notification
DELETE/api/company/notificationsDelete all notifications
GET/api/company/notification-preferencesGet user notification preferences
PUT/api/company/notification-preferencesUpdate notification preferences

Frontend Components

Key React components and hooks.

ComponentPurposeKey Features
NotificationsDrawerMain notification UI componentSlide-out panel, tabs, badge count, bulk actions
useCompanyNotificationsCustom React hookReal-time updates, API calls, state management
AccountNotificationsSettings page componentPreference management, form controls
NotificationItemIndividual notification displayRead/unread status, actions, formatting

Data Structure

Notification data format and fields.

FieldTypeDescription
idstringUnique notification identifier
typestringNotification type (todo_assigned, todo_completed, etc.)
titlestringFormatted notification message (HTML)
isUnReadbooleanRead/unread status
createdAtstringCreation timestamp
metaobjectAdditional metadata (todoId, navigationPath)

Best Practices

Notification management guidelines.

PracticeRecommendation
Real-time ConnectionMaintain stable WebSocket connection for instant updates
Preference ManagementAllow users to control notification types per their needs
Performance OptimizationUse pagination for large notification datasets
Error HandlingImplement graceful fallback for connection failures
Data PrivacyEnsure notifications respect user privacy settings

Troubleshooting

Common issues and solutions.

IssueFix
Notifications not appearingCheck WebSocket connection and user authentication
Real-time updates not workingVerify Laravel Echo configuration and channel subscription
Preferences not savingCheck API endpoints and user permissions
Badge count not updatingEnsure unread count API is called after notification changes
Drawer not openingCheck component state management and event handlers