link,[object Object]
Skip to content

Notifications ​

Purpose: Document realtime and polling notification patterns, timeline event management, and template system. Audience: Product, Developer Prerequisites: Authenticated user; Supabase Realtime enabled.

Global Realtime Hook ​

  • Critical-only channel with tight filters per user.
  • See src/hooks/useGlobalRealtimeNotifications.ts:24-45 — subscriptions INSERT for user, UPDATE for user.
  • See :65-76 — new seller offers trigger email via emailService after fetching listing and seller profile.
  • See :108-118 — listing status changes to active trigger seller email via send-email function.

Admin Polling ​

  • Non-critical admin notifications use periodic polling to reduce realtime load.
  • See src/hooks/useAdminPollingNotifications.ts:40-81 — pending listings batch processing.
  • See :86-99 — new reports; :165-175 — new active subscriptions.

Template Management System ​

Location: /admin/templates

Template Categories ​

  1. Email Templates - Authentication, business, and marketing emails
  2. In-App Notifications - Real-time notifications from database
  3. Edge Functions - Server-side email templates
  4. Database Templates - Email templates stored in database
  5. Timeline Events - Deal lifecycle event notifications

Key Features ​

  • Inline Editing: All templates support inline editing below tables (no modals)
  • Multilingual Support: EN/RO content with fallback indicators
  • Role-Based Management: Timeline events support different messages per role
  • Testing & Preview: Built-in preview and test functionality
  • Consolidated Management: Single interface for all communication templates

Timeline Event Management ​

Event Types: offer_sent, offer_accepted, nda_signed, loi_signed, apa_signed_buyer, apa_signed_seller, assets_delivered, dd_started, dd_completed, dispute_opened, payout_released, deal_completed

Configuration:

  • Role-Based: Separate messages for Buyer, Seller, Admin roles
  • Channel Control: Toggle email and app notifications independently
  • Message Customization: Multilingual content with variable substitution
  • Centralized Storage: Configuration stored in app_settings.timeline_notifications

Edge Functions:

  • dispatch-timeline-event - Generic dispatcher for deal timeline events
  • seller-deliver-assets - Replaces old RPC for asset delivery

Tables ​

  • public.notifications, public.notification_settings — user notification storage
  • public.admin_notification_types — in-app notification templates
  • public.app_settings — timeline event configuration (JSON)
  • Admin signals come from listings, reports, subscriptions and email functions

UX ​

  • Toasters for confirmation; emails for high-signal events (new offers, approvals)
  • Inline editing with auto-focus and scroll-to-section
  • Fallback indicators for multilingual content
  • Real-time preview and test functionality

Next Steps ​

  • See docs/operations/monitoring.md to observe notification health
  • See docs/features/messaging.md for conversation notifications
  • See docs/admin/guide.md for template management details