Skip to main content

Overview

Notification Settings API allows administrators to configure their notification delivery preferences, including per-category email and web notification toggles. Settings are stored per admin and control which notifications trigger email delivery via Resend. All functions require authentication. Location: convex/admins/notificationSettings.ts

Get Notification Settings

Returns the current admin’s notification settings, or null if no settings have been initialized yet. No parameters required.
Returns null if settings have not been initialized. Call initializeDefaultSettings to create default settings for a new admin.

Update Notification Settings

Updates notification settings for the current admin. All fields are optional and only provided fields are updated. If no settings record exists, one is created with sensible defaults for any omitted fields.
emailEnabled
boolean
Master toggle for email notifications
webEnabled
boolean
Master toggle for web/in-app notifications
emailPreferences
object
Per-category email notification toggles
webPreferences
object
Per-category web notification toggles
emailAddress
string
Email address for notification delivery

Initialize Default Settings

Creates default notification settings for a new admin. All notification categories are enabled by default for both email and web channels. If settings already exist for the admin, returns the existing settings ID without modification.
emailAddress
string
required
Email address to use for notification delivery
This is idempotent — calling it when settings already exist returns the existing record ID. Call this when an admin first logs in to ensure they have notification settings configured.

Send Test Notification

Sends a test notification to verify that the email delivery pipeline is working. Creates an in-app notification (visible in the notification bell) and schedules a test email to the admin’s configured email address. No parameters required.
Possible failure responses:
The test notification is created with type order_issue and priority low. Email delivery is handled asynchronously via Resend.