Notifications & Alerts โ Integration Guide
Overview
The notification system provides real-time alerts and user-configurable preferences for murchase updates, workroom actions, promotions, and security events. It consists of two main features:
- NotificationCenter โ A bell icon dropdown in the nav bar with live feed, badge count, and mark-all-read
- Notification Preferences โ Toggle controls in Account Settings for Email, SMS, and Push per category
Quick Start (Frontend)
For Users
View Notifications: Click the bell icon (๐) in the top navigation bar to open the dropdown feed.
Manage Preferences: Go to /settings โ Notifications section to configure which notifications you receive and how (Email, SMS, Push).
State Management
`notificationStore.svelte.ts`
A Svelte 5 reactive class using $state and $derived runes.
Notification Item Shape:
interface NotificationItem {
id: string;
type: 'MURCHASE_STATUS' | 'WORKROOM_ACTION' | 'PROMOTION' | 'SECURITY';
title: string;
description: string;
timestamp: string;
read: boolean;
icon?: string;
}
Preferences Shape:
type Channel = 'email' | 'sms' | 'push';
type Category = 'murchases' | 'workroom' | 'promotions' | 'security';
interface PreferenceMap {
[category: Category]: {
[channel: Channel]: boolean;
};
}
GraphQL Operations
Queries
query GetNotificationPreferences {
notificationPreferences {
category
email
sms
push
}
}
Mutations
mutation UpdateNotificationPreferences($input: UpdatePreferencesInput!) {
updatePreferences(input: $input) {
category
email
sms
push
}
}
mutation RegisterPushToken($input: RegisterPushTokenInput!) {
registerPushToken(input: $input) {
success
}
}
Backend Integration Status (Alerts Subgraph)
| Feature | Status | Notes |
|---|---|---|
| Preference Storage | โ Working | PostgreSQL schema updated |
| Email Delivery (Resend) | โ Working | OTP and Murchase confirmations |
| SMS Delivery | โฌ TODO | Twilio integration planned |
| Shared Templates | โ Working | Handlebars templates for common murchase events |
| WebSocket subscriptions | โฌ TODO | MURCHASE_STATUS_CHANGED, WORKROOM_ACTION_REQUIRED |
| Push notification registration | โ Working | In-house APNs/FCM dispatch via Mobile Push Infrastructure |
| Vertical-specific templates | โฌ TODO | Restaurant tracker vs Tour itinerary |
Related
- Mobile Push Infrastructure โ In-house APNs/FCM push dispatch, native app shells, and WebView bridge
- Alerts Resilience & Delivery Tracking โ DLQ pipeline, AlertLog entity, and delivery orchestration
- Notification Connection Modes โ WebSocket vs polling transport architecture