DashboardSupportWelcome

👤 USER DOCS

Getting Started

Daily Operations

Shift Workspace & TasksPre-Shift SetupLine-Up CardsShift ReportsForms

Staff & Locations

Staff SchedulingManaging Locations

Oversight

Manager ReportsAnalyticsPre-Shift & Compliance

Incidents & Feedback

Incident ReportingAnonymous FeedbackMessages & Announcements

AI & Settings

AI ChatgearApp Settings

Administration

Dashboard & OnboardingAdmin

⚙️ DEVELOPER DOCS

Getting Started

Getting StartedDevelopmentDeployment Guide

Architecture

Architecture OverviewData FlowArchitecture Decision Records

Core Domain

Core DomainDatabase ReferenceLocations DomainAuth & RBACScheduling DomainReports DomainIncidents DomainNotifications DomainAudit Log & OptimizationDesign Audit Findings

Frontend

Frontend ArchitectureFormsLoading SkeletonsComponentsPWA & NotificationsimageScreenshots

API Reference

API Reference

Endpoints

POS Sales APIOptimization Data APISchedule Shifts APIEmployee Export APIReports APIIncidents APIAI Chat APIPush Notifications APIWebhooks APICron API

Contributing

ContributingcodeCode Examples

Security

Security & Compliance
Danvas IconDanvas
Danvas IconDanvas

Push Notifications API

Web Push subscription and sending endpoints

Danvas provides two endpoints for managing Web Push notifications: subscribing a browser/device to receive notifications and sending notifications to users.

Web Push is app-owned infrastructure. It is used by staff messages, board announcement fanout, pre-shift companion alerts, and admin-triggered test notifications. It is not the Matrix Push Gateway API and does not configure Matrix pushers on the homeserver.

VAPID Keys

Push notifications use VAPID (Voluntary Application Server Identification) for security:

# Environment variables
NEXT_PUBLIC_VAPID_PUBLIC_KEY=<public key>
VAPID_PRIVATE_KEY=<private key>

Generate keys with:

npx web-push generate-vapid-keys

Notification Display

When received, the service worker displays a native notification. The payload should include a relative app URL so notification clicks can route the user back to the relevant Danvas screen:

AI Chat API

Conversational data querying with streaming responses

Webhooks API

Lifecycle event handlers for Clerk and Svix

On this page

VAPID KeysNotification DisplayRelated Files
self.registration.showNotification(title, {
  body,
  icon: "/apple-icon.png",
  badge: "/favicon.ico",
  data: { url }
});

Related Files

FilePurpose
apps/app/src/app/api/push/subscribe/route.tsSubscribe endpoint
apps/app/src/app/api/push/send/route.tsAdmin send endpoint
apps/app/src/app/sw.tsService worker push handling
packages/notifications/push.tsGeneral server-side push helper
packages/matrix/push-handler.tsMatrix user to Clerk user push bridge

Authorization

sessionAuth
__session<token>

In: cookie

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

POST
/api/push/subscribe
POST
/api/push/send

Authorization

bearerAuth
AuthorizationBearer <token>

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

title*string
body*string
url?string
targetUserId?string
endpoint*string
keys*

Response Body

application/json

curl -X POST "https://example.com/api/push/send" \  -H "Content-Type: application/json" \  -d '{    "title": "string",    "body": "string"  }'
Empty
curl -X POST "https://example.com/api/push/subscribe" \  -H "Content-Type: application/json" \  -d '{    "endpoint": "string",    "keys": {      "p256dh": "string",      "auth": "string"    }  }'

Push endpoint URL from the browser

{
  "success": true
}
{
  "success": true,
  "sent": 0,
  "failed": 0
}

Clerk session cookie

Clerk JWT token from session

Notification title

Notification body text

Deep link URL when notification is clicked

Optional user ID to send to (admin only)