@enbbox/js
v1.1.0
Published
Enbbox JavaScript SDK for Inbox notifications
Maintainers
Readme
@enbbox/js
The core JavaScript SDK for Enbbox — drop-in notification inbox for your app.
Installation
npm install @enbbox/jsQuick Start
import { Enbbox } from "@enbbox/js";
const enbbox = new Enbbox({
projectId: "YOUR_PROJECT_ID",
subscriberId: "USER_ID",
subscriberHash: "HMAC_HASH", // optional, for production
});
// Initialize the session
await enbbox.init();
// Listen for new notifications
enbbox.on("notifications.notification_received", (notification) => {
console.log("New notification:", notification);
});
// Get notifications
const notifications = await enbbox.notifications.list();
// Get unread count
const counts = await enbbox.notifications.count();API
Enbbox(options)
| Option | Type | Required | Description |
| ---------------- | -------- | -------- | ---------------------------- |
| projectId | string | ✅ | Your Enbbox project ID |
| subscriberId | string | ✅ | Unique subscriber identifier |
| subscriberHash | string | | HMAC hash for secure mode |
| apiUrl | string | | Custom API URL |
Modules
enbbox.notifications— List, read, archive notificationsenbbox.preferences— Manage notification preferencesenbbox.on(event, handler)— Listen for real-time events
Events
| Event | Description |
| ------------------------------------- | --------------------------------- |
| session.initialized | Session connected |
| notifications.notification_received | New notification received via SSE |
| notifications.unread_count_changed | Unread count updated |
License
MIT
