Skip to main content

Node.js SDK

Written in TypeScript with full type definitions exported from the package root.

Module structure

src/
├── NotificationHubClient.ts // Entry point — build with NotificationHubClient.Builder
├── auth/
│ └── HmacSigner.ts // Signs every request (see Authentication)
├── clients/
│ ├── BaseApiClient.ts // Shared fetch + signing + error mapping
│ ├── NotificationApiClient.ts
│ ├── TemplateApiClient.ts
│ ├── ProjectApiClient.ts
│ ├── ProviderApiClient.ts
│ └── AnalyticsApiClient.ts
├── models/
│ ├── NotificationRequest.ts // + NotificationRequestBuilder
│ ├── TemplateRequest.ts // + TemplateRequestBuilder
│ └── Enums.ts // ChannelType, ProjectStatus
├── exception/
│ └── NotificationHubError.ts // + Auth/Validation/RateLimit/Server subclasses
└── index.ts // Public exports

Requirements

  • Node.js 18+BaseApiClient uses the global fetch API, available natively from Node 18 onward
  • TypeScript 4.5+ recommended for the exported types (optional if you're using plain JavaScript)

Entry point

Everything starts from NotificationHubClient, built via its namespaced Builder:

import { NotificationHubClient } from '@sumitshresht/notificationhub-sdk';

const client = new NotificationHubClient.Builder()
.apiKey('your-api-key')
.apiSecret('your-api-secret')
.build();

client.notifications();
client.templates();
client.projects();
client.providers();
client.analytics();

Continue to: