Registry / communication / notificationapi-node-server-sdk

notificationapi-node-server-sdk

JSON →
library2.8.0jsnpmunverified

The NotificationAPI Node.js Server SDK provides a streamlined interface for integrating real-time and multi-channel notifications into server-side applications. This SDK allows developers to send various types of notifications, including in-app, email, SMS, and push notifications, by interacting with the NotificationAPI platform. Currently at version 2.8.0, the package appears to be actively maintained with frequent updates, indicated by its publishing history on npm. It abstracts the complexity of notification delivery, enabling developers to focus on application logic rather than the intricacies of different communication channels or provider APIs. The SDK ships with built-in TypeScript types, ensuring a robust development experience and improved code quality for TypeScript users. Key differentiators lie in the comprehensive notification platform it connects to, offering a centralized solution for notification management, templating, and delivery across multiple channels.

npm install notificationapi-node-server-sdk
INSTALL
IMPORT
SIG · NOTIFICATIONAPI-NO
N
notificationapi-node-server-sdk
communicationjavascriptv2.8.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

NotificationAPI
import { NotificationAPI } from 'notificationapi-node-server-sdk';
const NotificationAPI = require('notificationapi-node-server-sdk');
The SDK primarily uses ES Modules. While Node.js has CJS-ESM interop, direct `require` statements for this package can lead to `ERR_REQUIRE_ESM` errors in certain configurations, especially with TypeScript or modern build setups. Prefer ESM `import`.
NotificationAPI
import NotificationAPI from 'notificationapi-node-server-sdk';
import { NotificationApi } from 'notificationapi-node-server-sdk';
The main class is typically exported as a named export. A default import might not be available or could lead to undefined behavior if the package structure changes. Be mindful of casing for 'NotificationAPI' (PascalCase).
NotificationAPIClientConfig
import type { NotificationAPIClientConfig } from 'notificationapi-node-server-sdk';
For type-checking configuration objects without importing the runtime value, use `import type` for better tree-shaking and to avoid accidental runtime imports.

Demonstrates initializing the NotificationAPI SDK with environment variables and sending a basic welcome notification to a user with merge tags.

import { NotificationAPI } from 'notificationapi-node-server-sdk'; const CLIENT_ID = process.env.NOTIFICATIONAPI_CLIENT_ID ?? ''; const CLIENT_SECRET = process.env.NOTIFICATIONAPI_CLIENT_SECRET ?? ''; if (!CLIENT_ID || !CLIENT_SECRET) { console.error('Environment variables NOTIFICATIONAPI_CLIENT_ID and NOTIFICATIONAPI_CLIENT_SECRET must be set.'); process.exit(1); } const notificationapi = new NotificationAPI({ clientId: CLIENT_ID, clientSecret: CLIENT_SECRET, }); async function sendExampleNotification() { try { const response = await notificationapi.send({ notificationId: 'user_welcome', user: { id: 'test-user-123', email: 'test@example.com', // Additional user properties like 'name', 'phone_number' can be added }, mergeTags: { firstName: 'John', lastName: 'Doe', welcomeMessage: 'Welcome to our service!', }, }); console.log('Notification sent successfully:', response); } catch (error) { console.error('Failed to send notification:', error); } } sendExampleNotification();
Debug
Known issues
breakingFuture major versions of this SDK may drop support for older Node.js LTS versions (e.g., Node.js 16 or 18 as Node.js 20+ becomes prevalent). Always check the release notes for minimum Node.js requirements before upgrading to a new major SDK version.
fix
Ensure your Node.js runtime environment meets the minimum version specified in the SDK's `package.json` or release notes before upgrading the SDK. Consider using Node.js LTS versions for production.
affects: >=2.0.0
gotchaAPI Keys (ClientId and ClientSecret) should never be hardcoded directly into your application's source code, especially in client-side bundles. Exposure of these keys can lead to unauthorized access to your NotificationAPI account.
fix
Store API keys as environment variables (e.g., `process.env.NOTIFICATIONAPI_CLIENT_ID`) and inject them securely at runtime. For serverless functions, use secrets management services provided by your cloud provider.
affects: >=1.0.0
breakingChanges in the NotificationAPI platform's API or data models may necessitate updates to the SDK, potentially introducing breaking changes in method signatures or response structures. Always review the migration guide when upgrading major SDK versions.
fix
Consult the official NotificationAPI documentation and SDK release notes for specific migration steps when upgrading across major versions. Update your payload structures and method calls accordingly.
affects: >=1.0.0
gotchaIncorrectly formatted notification payloads (e.g., missing required fields, invalid types) will result in API errors. The SDK may perform basic validation, but robust server-side validation is still essential.
fix
Refer to the NotificationAPI documentation for exact payload schemas for each notification type. Implement thorough input validation on your backend before constructing and sending payloads via the SDK.
affects: >=1.0.0
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module ... not supported
Attempting to import the NotificationAPI SDK using CommonJS `require()` syntax in an environment configured for ES Modules, or if the SDK is ESM-only.
fix
Use ES Module `import` syntax: `import { NotificationAPI } from 'notificationapi-node-server-sdk';` ensure your `package.json` has `"type": "module"` if using ESM for your project, or configure your TypeScript/bundler appropriately.
TypeError: Cannot read properties of undefined (reading 'send')
The NotificationAPI client was not correctly initialized, or `clientId`/`clientSecret` were missing, leading to an undefined or improperly constructed object.
fix
Verify that `new NotificationAPI({ clientId, clientSecret })` is called with valid credentials and that the `notificationapi` object is available in scope before attempting to call its methods.
API Error: Invalid credentials
The provided `clientId` or `clientSecret` are incorrect, expired, or lack the necessary permissions to perform the requested operation.
fix
Double-check your `NOTIFICATIONAPI_CLIENT_ID` and `NOTIFICATIONAPI_CLIENT_SECRET` environment variables. Ensure they match the keys from your NotificationAPI dashboard and have the required permissions.
Upgrade
Version history
2.8.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
17 hits · last 30 days
node
14
OpenAI (training)
1
Resources
notificationapi-node-server-sdk — npm install notificationapi-node-server-sdk · libregistry