Notification channels
Real-time (Socket.io)
Instant in-app notifications delivered over a persistent WebSocket connection while your dashboard is open. No polling required.
Push (Firebase)
Firebase Cloud Messaging push notifications sent to your registered device even when the dashboard is closed.
Notification types
Notifications are created at two points in the post lifecycle:Post created
Post created
Fired immediately after
POST /api/posts succeeds. The message reflects the initial status:“Your post was created successfully and is now pending.”Or for a scheduled post:
“Your post was created successfully and is now scheduled.”Notification type:
successPost published on a platform
Post published on a platform
Fired by the
PostWorker after each platform successfully accepts the post:“Your post has been successfully posted on bluesky”The notification includes a link to the live post URL (
platformPostUrl) and the first media item’s image as a preview.Notification type: successPost delivery failed
Post delivery failed
When a platform permanently rejects a post (after exhausting retries), the worker records a
failed platform status. You can view the error reason from the post detail page and trigger a retry from /history.Notification type: error (implicit via platform status)Notification data model
Each notification document stores:| Field | Type | Description |
|---|---|---|
userId | ObjectId | The user this notification belongs to. |
message | string | Human-readable notification text. |
type | string | success, error, info, or warning. |
reference.type | string | The referenced entity type (e.g. post). |
reference.id | string | The referenced entity’s ID. |
reference.model | string | The Mongoose model name (e.g. Post). |
options.image | string | Optional preview image URL. |
options.link | string | Optional deep link (e.g. /history). |
read | boolean | Whether the user has seen this notification. |
createdAt | Date | Timestamp managed by Mongoose timestamps. |
Notification center
The bell icon in the dashboard header opens the Notification Center, which shows a reverse-chronological list of your recent notifications with unread indicators.View notifications
Click the bell icon to open the notification drawer. Unread notifications are highlighted. The list is paginated — the default page size is 20.
Mark as read
Click a single notification to mark it as read. This calls
PATCH /api/notifications/:id/read and updates the read field to true.Notification API
Fetch notifications
GET /api/notifications
Returns a paginated list of notifications for the authenticated user, ordered most-recent first.
200 response
Mark a notification as read
PATCH /api/notifications/:id/read
Mark all notifications as read
PATCH /api/notifications/read-all
WebSocket connection (Socket.io)
Hayon uses Socket.io for real-time delivery. The frontend connects to the Socket.io server on page load and joins a room scoped to the authenticated user’s ID.Connecting to the notification socket
The socket connection is authenticated using the same JWT used for REST API calls. Unauthenticated connections are rejected by the server.
Firebase push notifications
Firebase Cloud Messaging delivers notifications to your device when the dashboard is not open. To receive push notifications:Grant browser permission
The dashboard requests notification permission from your browser on first load. Accept the prompt to enable push delivery.
FCM token is registered
After permission is granted, Firebase generates a device-specific FCM token. The dashboard sends this token to the backend to associate it with your account.
FCM push notifications require HTTPS in production. During local development, push delivery is typically disabled. Use the in-app notification center to verify notifications during development.
Managing notification preferences
Notification preferences are managed from the Settings page at/settings. From there you can:
- Enable or disable push notifications for your device.
- Revoke FCM token registration to stop receiving push notifications on a specific device.
- Review recent notification history in the notification center.
