amz-notifications-client
v1.0.4
Published
Client library for Amazoniko Notifications Center (emails, push, WhatsApp).
Readme
amz-notifications-client
A small client library for Amazoniko Notifications Center (emails, push, WhatsApp). Ships CommonJS with TypeScript types.
Install
- Local development: npm run build && npm link
- In consuming project (once): npm link amz-notifications-client
Alternatively, pack and install locally:
- npm run pack
- Copy the generated .tgz to the destination project
- npm install
Usage
import { EmailsClient, PushClient, WhatsappClient, type ParamsMail, type ParamsPush, type WhatsAppMessageTemplate } from "amz-notifications-client";
const endpoint = "https://api.example.com"; const apiKey = "";
// Emails const emails = EmailsClient.getInstance(endpoint, apiKey); await emails.sendEmail({ to: "[email protected]", subject: "Hello", html: "Hi" } satisfies ParamsMail);
// Push const push = PushClient.getInstance(endpoint, apiKey); await push.sendPush({ token: "token", payload: { title: "t", body: "b", channelId: "default", data: {} } } satisfies ParamsPush);
// WhatsApp const whatsapp = WhatsappClient.getInstance(endpoint, apiKey); await whatsapp.sendWhatsapp({ /* WhatsAppMessageTemplate */ } as WhatsAppMessageTemplate);
Notes on structure
- Public API is exposed via src/index.ts and compiled to dist/index.js with types at dist/index.d.ts.
- Clients are singletons with getInstance(endpoint, apiKey).
- Types are exported for better DX.
