Enbbox Docs

JavaScript SDK

Enbbox JavaScript SDK (@enbbox/js) — lightweight client library for sending notifications and managing subscribers from any JavaScript environment.

The @enbbox/js SDK provides a framework-agnostic client for Enbbox notifications.

Installation

npm install @enbbox/js

Initialization

import { Enbbox } from "@enbbox/js";

const enbbox = new Enbbox({
  projectId: "YOUR_PROJECT_ID",
  subscriberId: "user-123",
});

Features

Initialize Session

await enbbox.init();

Fetch Notifications

const notifications = await enbbox.notifications.list({ page: 0 });

Mark as Read

await enbbox.notifications.markAsRead(notificationId);

Mark All as Read

await enbbox.notifications.markAllAsRead();

Listen for New Notifications

enbbox.on("notification_received", (notification) => {
  console.log("New notification:", notification);
});

Get Unread Count

const count = await enbbox.notifications.unreadCount();

When to Use

Use @enbbox/js when you need direct control over the notification lifecycle without a framework. For React or Next.js projects, prefer the dedicated SDKs:

For triggering workflows from your backend, use the API Client (@enbbox/api).

On this page