Integrate a site
Integrate a site
- Your backend, after its own sign-in, calls
POST /v1/subscriber-tokenswith the secret key and your user id, and gives the token to the browser. - Serve a one-line
sw.jsfrom your origin:importScripts('/sw-core.js'). - In the browser:
import { createClient } from '@notification-service/sdk';
const ns = createClient({ apiBase, publishableKey, getToken });
await ns.subscribe(); // call straight from a click handler
await ns.completeProfile({ timezone });
await ns.createEnrolment({ topicId, slots: [{ day: 1, time: '07:00' }], timezone, endDate: '2026-12-31' });
- Load messages with
POST /v1/topics/:id/items:importusing the secret key.