@goldlabelapps/notify
v3.2.0
Published
Channel-neutral notification contracts and dispatching for Goldlabel applications.
Downloads
71
Readme
Notify
@goldlabelapps/notify
A channel-neutral notification contract and dispatcher for Goldlabel applications.
The package does not depend on a vendor SDK. Integrations provide an adapter for
one of the supported channels: email, whatsapp, slack, pwa-push,
firebase, sms, in-app, or webhook.
import {
NotificationDispatcher,
type NotificationProvider,
} from "@goldlabelapps/notify";
const emailProvider: NotificationProvider = {
channel: "email",
async send(request) {
// Call the email service here.
return {
channel: request.channel,
acceptedAt: new Date().toISOString(),
};
},
};
const notifications = new NotificationDispatcher([emailProvider]);
await notifications.send({
channel: "email",
to: "[email protected]",
subject: "Welcome",
body: "Thanks for signing up.",
});Provider adapters are responsible for authentication, retries, vendor-specific
payloads, delivery status webhooks, and translating provider responses into a
NotificationResult.
Development
pnpm buildcompiles the package todist/.pnpm type-checkruns TypeScript without emitting files.
