← Back to Push docs

Push Notifications Docs

Push Notifications Setup

A production setup separates browser registration from backend sending. Public values live in the frontend; private API keys stay on the server.

Push notifications setupWeb Push setupDNZ Notifications setup

Setup flow

Create a workspace and API key in the dashboard. Generate or upload VAPID keys. Register a service worker in your website. Ask notification permission after a user action. Register the subscription with `/v1/subscribers/register`.

Send notifications from your backend with `/v1/send`. Use `recipientId` as the stable target so the same user can have multiple devices.

await fetch("/v1/send", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "X-API-Key": process.env.DNZ_NOTIFICATIONS_API_KEY
  },
  body: JSON.stringify({
    recipientId: "user_123",
    channel: "push",
    title: "Welcome",
    body: "Notifications are now enabled."
  })
});

Related content