✦Spectra SDK Docs

Agent doc: Notification JS SDK

Package

Purpose

Notification JS SDK presents email verification and push device registration as notification experiences, even if the server producer is Delivery Platform.

API tree

Notification JS SDK
├─ setup
│  ├─ new SpectraNotificationClient(config)
│  └─ createSpectraNotificationClient(config)
├─ email
│  ├─ sendEmailCode(options)
│  └─ verifyEmailCode(options)
└─ push
   └─ registerForPush(options)

Public setup inputs

Secret Key exposure in browser/mobile SDK requires an explicit consuming-project architecture decision. Project Secret Keys are bound to test or live, shown once, and do not expire by date.

Required auth object and token boundary

Agent integration order

1. Verify Auth SDK login, getSession(), and getAccessToken() first.

2. Create SpectraNotificationClient with projectId, environment, and auth.

3. Implement email code request with sendEmailCode().

4. Implement email code verification with verifyEmailCode().

5. Add push registration structure with registerForPush() only when the app has APNs/FCM provider tokens from the platform runtime.

6. Keep real device push delivery as a separate provider E2E gate.

Public operations

templateId and templateVersion are advanced optional inputs for teams that already operate managed templates. Do not make a consuming app create a template for the first verification flow.

Consumer example

import { SpectraNotificationClient } from "@spectra-platform/notification-sdk";

const notification = new SpectraNotificationClient({
  projectId,
  environment: "test",
  auth,
});

const challenge = await notification.sendEmailCode({
  email,
  subject: "Your sign-in code",
  text: "Your code is {{code}}.",
});

await notification.verifyEmailCode({
  verificationId: challenge.verificationId,
  code,
});

Current caveats

Escalate to Platform CS when