Notification Center widget
The Notification Center is Notifizz’s in-app notification widget — a bell icon with an unread badge and a dropdown list of notifications. It ships in three SDKs (React, Angular, Vanilla JS) that all wrap the same underlying widget and expose the same capabilities through framework-idiomatic APIs.TL;DR
- One widget, three SDKs. Pick the package that matches your frontend stack —
@notifizz/react,@notifizz/angular, or@notifizz/vanilla. The wire format and capabilities are identical. - Real-time via real-time stream. New messages stream into the widget over the real-time SDK — no SSE, no polling.
- Three auth modes.
firebase,backendToken, andnone(dev-only). A fourth,PubliclySignedJwt, is configured server-side via the dashboard. - Programmatic control. Every SDK exposes
open(),close(),toggle(), and a state observable so you can drive the widget from outside its default bell. - Custom bell — replace the default UI with your own component while Notifizz keeps managing data.
Widget lifecycle
Every SDK follows the same lifecycle:- Load — the SDK injects the Notifizz widget script (
/v1/widget.jsfromwidget.notifizz.com) into the page. - Authenticate — the widget signs the user in based on your
authTypeconfiguration. - Ready — the widget signals it’s ready (
notifizz:readywindow event), and theisReadystate flips totrue. - Active — the widget keeps the notification list current via real-time stream and emits
notifizz:stateevents on every change. - Destroy (optional) — the widget is removed from the DOM and all listeners are cleaned up.
Real-time updates use the real-time stream listener — the widget subscribes to the user’s notification document and the backend delivers new messages to the inbox. The dashboard activity log uses SSE for a different purpose — don’t confuse the two.
Positioning and styling
Control where the bell appears with theposition option:
| Value | Description |
|---|---|
top-right | Upper-right corner of the viewport |
top-left | Upper-left corner of the viewport |
bottom-right | Lower-right corner of the viewport |
bottom-left | Lower-left corner of the viewport |
bellStyles and notificationCenterStyles:
State model
All SDKs expose the sameNotifizzState object:
| Property | Type | Description |
|---|---|---|
isReady | boolean | true once the widget has loaded and authenticated. |
isOpen | boolean | true when the notification center dropdown is open. |
unreadCount | number | Current number of unread notifications. |
lastUpdated | number | Timestamp (ms) of the last state change. |
hasError | boolean? | true if the widget encountered an error (auth, network, …). |
errorCode | string? | Error identifier when hasError is true. |
How to read state
- React
- Angular
- Vanilla JS
Programmatic control
All SDKs let you drive the widget from outside its default bell:| Method | Description |
|---|---|
open() | Opens the notification center. |
close() | Closes the notification center. |
toggle() | Toggles the notification center open or closed. |
Custom bell
Every SDK supports replacing the default bell with your own UI element:- React —
renderBellprop with a render function that receivesNotifizzBellContext. - Angular — content projection via
<ng-content>with the#customBellIcontemplate reference. - Vanilla JS —
setBellElement(element)attaches click handling and keeps adata-unreadattribute in sync.
Default URLs
| Option | Default value |
|---|---|
serverUrl | https://widget.notifizz.com |
apiUrl | https://eu.api.notifizz.com/v1 |
widgetPath | /v1/widget.js |
Authentication options
All frontend SDKs accept the same authentication fields:| Option | Type | Required | Description |
|---|---|---|---|
apiKey | string | yes | Your Front API Key from the dashboard. |
authType | 'firebase' | 'backendToken' | 'none' | yes | Authentication strategy. |
token | string | for firebase, backendToken | Auth token from your backend. |
userId | string | for backendToken, none | The user’s unique identifier. |
userEmail | string | for backendToken, none | The user’s email address. |
PubliclySignedJwt, is configured server-side via the dashboard notificationCenterSetup dev-task and reaches the widget without an SDK shorthand. See authentication overview for the full picture.
FAQ
Which SDK should I pick?
Which SDK should I pick?
The one that matches your frontend stack:
@notifizz/react for React, @notifizz/angular for Angular standalone components, @notifizz/vanilla for any other setup (plain JS, Vue, Svelte, server-rendered pages with islands, …). They wrap the same widget — the only differences are framework idioms.The widget loads but the bell stays empty (`isReady: true`, `unreadCount: 0`).
The widget loads but the bell stays empty (`isReady: true`, `unreadCount: 0`).
Three things to check in order: (1)
userId matches the recipient identifier the campaign emits — most “empty bell” cases are auth working but userId mismatch; (2) the campaign actually fired (look at delivery history in the dashboard); (3) the user has an existing inbox recordument — first-ever load lazily creates it, so emit one event before opening the widget.`isReady` never flips to `true`.
`isReady` never flips to `true`.
Auth failed. Check the browser console — the widget logs the auth error. Common causes: stale
token (regenerate from your backend), wrong authType (e.g. passing a Firebase token in backendToken mode), or expired Front API Key. Inspect state.hasError / state.errorCode for a typed signal.Can I read unread count without rendering the default bell?
Can I read unread count without rendering the default bell?
Yes — that’s the headless mode. In React, wrap your tree in
NotifizzProvider and call useNotifizz() from anywhere. In Angular, inject NotifizzService and subscribe to state$. In Vanilla, call createNotifizz(...), then mount() or setBellElement() and read getState() / subscribe via onStateChange().What happens if I call `open()` before `notifizz:ready`?
What happens if I call `open()` before `notifizz:ready`?
The command is dropped silently. Always wait for
state.isReady === true before driving the widget programmatically. The React/Angular/Vanilla APIs already guard against this — the bell context exposes isReady precisely so your UI can stay disabled until the widget is live.Multiple users on the same browser — how do I switch?
Multiple users on the same browser — how do I switch?
Call
destroy() on the current instance, then mount a new one with the new userId + token. The widget caches real-time state per session — without a clean destroy, the new mount will briefly show the previous user’s notifications.See also
React SDK
Full API reference for
@notifizz/react.Angular SDK
Full API reference for
@notifizz/angular.Vanilla JS SDK
Full API reference for
@notifizz/vanilla.Authentication overview
Pick the right widget auth mode.