Skip to main content

NotificationHubClient

Exported from @sumitshresht/notificationhub-sdk. Construct it once via NotificationHubClient.Builder (implemented with TypeScript namespace merging over the class) and reuse the instance.

NotificationHubClient.Builder

MethodDescription
apiKey(apiKey: string)Sets the API key. Required.
apiSecret(apiSecret: string)Sets the API secret used for HMAC signing. Required.
baseUrl(baseUrl: string)Overrides the default endpoint. Throws if the URL is http:// and not localhost. Trailing slash is stripped.
build()Returns a NotificationHubClient. Throws if apiKey or apiSecret is empty/whitespace.
const client = new NotificationHubClient.Builder()
.apiKey('your-api-key')
.apiSecret('your-api-secret')
.baseUrl('your-base-url') // optional
.build();

Default base URL: (production endpoint) — the SDK uses NotificationHub's production endpoint by default. You only need to set baseUrl(...) if you want to point at a different environment.

Sub-client accessors

MethodReturns
notifications()NotificationApiClient
templates()TemplateApiClient
analytics()AnalyticsApiClient
projects()ProjectApiClient
providers()ProviderApiClient

Throws

ErrorWhen
ErrorapiKey/apiSecret missing at build(), or a non-HTTPS non-localhost baseUrl is set.