Skip to content

Notifications System

github-actions[bot] edited this page Sep 2, 2026 · 46 revisions

Notification System Documentation

Overview

The nChat notification system provides comprehensive, production-ready notification infrastructure with:

  • Web Push Notifications - Native browser push via Web Push API
  • Email Digests - Scheduled email summaries
  • Batch Operations - Efficient bulk notifications
  • Reminders - User reminders with snooze/recurrence
  • Per-Channel Preferences - Granular control
  • Keyword Alerts - Custom keyword notifications
  • Quiet Hours - Do-not-disturb scheduling
  • Multiple Channels - Email, Push, SMS

Quick Start

1. Generate VAPID Keys

npx web-push generate-vapid-keys

Add to .env.local:

NEXT_PUBLIC_VAPID_PUBLIC_KEY=<public-key>
VAPID_PRIVATE_KEY=<private-key>

2. Subscribe to Push

import { usePushSubscription } from '@/hooks/use-push-subscription'

const { subscribe } = usePushSubscription()
await subscribe()

3. Send Notification

await fetch('/api/notifications', {
  method: 'POST',
  body: JSON.stringify({
    type: 'mention',
    title: 'You were mentioned',
    body: '@alice mentioned you',
    userId: 'user-uuid',
  }),
})

API Endpoints

Notifications

  • GET /api/notifications - List
  • POST /api/notifications - Create
  • PUT /api/notifications - Update
  • DELETE /api/notifications - Delete

Preferences

  • GET /api/notifications/preferences
  • PUT /api/notifications/preferences

Push

  • POST /api/notifications/subscribe
  • DELETE /api/notifications/subscribe

Digest

  • POST /api/notifications/digest - Send now
  • PUT /api/notifications/digest - Settings

Batch

  • POST /api/notifications/batch - Create
  • GET /api/notifications/batch - Status

Reminders

  • GET /api/reminders
  • POST /api/reminders
  • PUT /api/reminders
  • DELETE /api/reminders

React Hooks

usePushSubscription

const { isSubscribed, subscribe } = usePushSubscription()

useNotificationPreferences

const { preferences, updatePreferences } = useNotificationPreferences()

Support


🎯 Getting Started


✨ Features

Core Features

Communication

Security & Privacy

(See πŸ” Security section below for 2FA, PIN Lock, and security audits.)

Interactive

(Search lives in πŸ“š Reference below.)

Extensibility


πŸ“– Guides

User Guides

Developer Guides

Enterprise

Backend

Deployment


βš™οΈ Configuration


πŸ“‘ API

API Documentation


πŸš€ Deployment


πŸ“š Reference

Architecture

Quick Reference


πŸ” Security


πŸ†˜ Help


ℹ️ About


πŸ”— Links


v1.0.0 β€’ 2026

Clone this wiki locally