@notifizz/nodejs
v1.0.0
Published
A **JavaScript/TypeScript** client for sending and tracking events with **Notifizz**. It allows you to:
Downloads
7
Readme
📦 Notifizz Client SDK
A JavaScript/TypeScript client for sending and tracking events with Notifizz.
It allows you to:
- Send events (
track) with workflows and recipients - Configure enrichment functions
- Handle authentication via
sdkSecretKeyandauthSecretKey - Send notifications directly to the Notification Center
🚀 Installation
npm install notifizz-client
# or
yarn add notifizz-client
## Initialize the client
import { NotifizzClient } from "notifizz-client";
const client = new NotifizzClient(
"AUTH_SECRET_KEY", // provided by Notifizz
"SDK_SECRET_KEY" // provided by Notifizz
);
## Track Events
await client
.track({
eventName: "user_signed_up",
sdkSecretKey: "SDK_SECRET_KEY",
properties: {
plan: "pro",
source: "landing_page",
},
})
.workflow("campaign_123", [
{ id: "user_1", email: "[email protected]" },
{ id: "user_2", email: "[email protected]" },
]);
## Generate a user token
const token = client.generateHashedToken("user_123");
## Configure enrichment functions
NotifizzClient.configureEnrich("workflow_abc", (properties) => ({
recipients: [{ id: "user_1", email: "[email protected]" }],
...properties,
}));
## Send a notification to the notification center
await client.send({
notifId: "notif_123",
properties: {
recipients: [{ id: "user_1", email: "[email protected]" }],
message: "Hello world",
},
});