Notification System
Stay informed with in-app notifications, push notifications, email alerts, and real-time updates via Server-Sent Events.
Overview
Testify's notification system ensures that users never miss important updates. The system delivers notifications through four channels: in-app notifications (accessible via the bell icon), web push notifications (even when the browser is in the background), email notifications, and real-time Server-Sent Events (SSE) for instant updates. Teachers and administrators can send custom notifications to individual students, entire classes, or sections.
Users can configure their notification preferences to control which channels they receive notifications on.
How It Works
Receiving Notifications
In-App Notifications
- A bell icon in the navigation bar shows your unread notification count.
- Click the bell to open the Notification Center.
- View all your notifications with:
- Title and message.
- Associated exam details (if applicable).
- Timestamp.
- Read/unread status.
- Click a notification to mark it as read and navigate to the relevant page.
Push Notifications
- When you first log in, the app requests permission to send push notifications.
- If granted, your device token is registered with the server.
- Push notifications arrive even when you are not actively using Testify.
- Supported on web browsers that support the Push API.
Email Notifications
Certain events automatically trigger email notifications:
- Exam invitations and reminders.
- Certificate generation.
- Referral confirmations.
- Password reset requests.
- Account verification.
Real-Time SSE Updates
The platform maintains a persistent SSE connection for instant updates:
- When a new notification is created for you, it is pushed to your browser immediately.
- The SSE connection sends a heartbeat every 30 seconds to stay alive.
- Multiple browser tabs are supported -- each tab maintains its own connection.
- If the connection drops, the client automatically reconnects.
Sending Notifications (Teachers/Admins)
Teachers, managers, and administrators can send custom notifications:
- Navigate to Send Notification from the admin or teacher dashboard.
- Fill in the notification details:
- Title (required) -- a short headline for the notification.
- Message (required) -- the detailed notification content.
- Select the target audience:
- Specific students -- choose individual student IDs.
- By class -- select one or more classes to reach all students in those classes.
- By section -- select specific sections within classes.
- All students -- if no specific targets are chosen, the notification goes to all students in the sender's organization.
- Optionally associate the notification with a specific exam.
- Click Send.
The system:
- Creates in-app notification records for each target student.
- Sends push notifications to all target students with registered devices.
- Optionally sends email notifications based on user preferences.
- Broadcasts via SSE for instant delivery to connected clients.
Managing Notifications
Marking as Read
- Click a notification to mark it as read.
- Use Mark All as Read to clear all unread notifications at once.
- Specific notifications can be marked as read by ID.
Unread Count
The bell icon badge shows the count of unread notifications. This count updates in real time via SSE.
Notification Preferences
Users can configure which notification channels they want to receive:
- Go to Notification Preferences in settings.
- Toggle preferences for different notification types:
- Exam reminders.
- Results and certificates.
- Announcements.
- System updates.
- Choose channels per type: in-app, push, email.
- Save preferences.
The notification preference service checks these settings before delivering notifications through each channel.
Key Features
Four Delivery Channels
| Channel | Description | Requires |
|---|---|---|
| In-App | Bell icon with notification list | Login |
| Push | Browser push notifications | Permission grant + device registration |
| Email to registered address | Valid email on account | |
| SSE | Real-time streaming updates | Active browser session |
Device Token Management
The push notification system manages device tokens:
- Tokens are registered per user when push permission is granted.
- Supports multiple devices per user (desktop, mobile).
- Platform and device type are tracked (android, ios, web).
- Tokens are upserted -- if a token already exists, it is reassigned to the current user.
Targeting Options
| Target | How It Works |
|---|---|
| Individual students | Specify student IDs directly |
| By section | Expands to all students in the selected sections |
| By class | Expands to all students in the selected classes |
| All organization | Falls back to all students in the sender's org if no specific targets |
Targets are deduplicated before sending, so a student in multiple selected sections receives only one notification.
SSE Architecture
The SSE system:
- Maintains a
Mapof connected clients keyed by user ID. - Each user can have multiple connections (multiple tabs).
- Sends an initial
connectedevent when a client subscribes. - Sends
heartbeatevents every 30 seconds. - Cleans up connections when clients disconnect.
- Broadcasts notifications via the
broadcastNotificationfunction.
Exam Notifications
Notifications related to exams include additional context:
- Exam title, start time, and duration.
- These details are joined from the
online_examstable when fetching notifications. - Students see exam-specific notifications with relevant action links.
Tips and Best Practices
- Enable push notifications to receive alerts even when not actively using the platform.
- Check notification preferences to ensure you are receiving notifications on your preferred channels.
- Mark notifications as read regularly to keep the unread count meaningful.
- Teachers should target notifications precisely -- use class or section targeting rather than broadcasting to all students when the message is only relevant to a subset.
- Include exam context when sending notifications about exams -- this adds helpful links and details to the notification.
- Do not send too many notifications -- notification fatigue reduces their effectiveness.
For Administrators
- Monitor notification delivery rates to ensure push tokens are valid.
- Review notification preferences to understand channel adoption.
- Use the SSE system for time-sensitive announcements that need instant delivery.
- The notification system respects multi-tenant isolation -- notifications only reach users within the sender's organization.
Related Features
- Online Exams -- exam events trigger automatic notifications.
- Certificates -- certificate generation triggers notifications.
- Classroom -- class and section membership drives notification targeting.