@ayush0x44/notifystack
v1.0.4
Published
The official Node.js SDK for NotifyStack — a scalable, production-ready notification SaaS platform.
Maintainers
Readme
📦 @ayush0x44/notifystack
The official Node.js SDK for NotifyStack — a scalable, production-grade notification SaaS platform.
🚀 Installation
npm install @ayush0x44/notifystack🔥 Features
- Zero-Config: Automatically points to the production
api.notifystack.shopdomain. - Smart Retries: Automatic exponential backoff for failed requests.
- Idempotency: Native support for
x-idempotency-keyto prevent duplicate sends. - Multi-Channel: Full support for Email, SMS, and Push notifications from a single client.
- Health Checks: Built-in methods to verify API connectivity.
🛠️ Usage
⚙️ 1. Initialization
const { NotifySDK } = require("@ayush0x44/notifystack");
// Create your client (Zero-Config: no baseUrl required!)
const sdk = new NotifySDK("ntf_live_xxxx_your_api_key");🎯 2. Event-Based Notification (Recommended)
Map your backend events to visual templates created in the NotifyStack Dashboard.
await sdk.track("USER_WELCOME", {
email: "[email protected]",
name: "Ayush",
plan: "Pro"
});✉️ 3. Direct Email
Send raw email content without a template.
await sdk.send({
to: "[email protected]",
subject: "Security Alert",
body: "Wait! Was this you logging in?"
});📱 4. Direct SMS
Send SMS via Twilio (requires configuration in your NotifyStack dashboard).
await sdk.sendSms({
to: "+1234567890",
body: "Your verification code is: 123456"
});🏥 5. Health Check
Verify your connection to the NotifyStack cloud.
const status = await sdk.health();
console.log(status.ok); // true🛡️ Error Handling
NotifyStack uses a custom error class for precise debugging.
const { NotifyError } = require("@ayush0x44/notifystack");
try {
await sdk.send({ ... });
} catch (e) {
if (e instanceof NotifyError) {
console.error(`Status ${e.status}:`, e.message);
}
}🔗 Resources
- Live Dashboard: notifystack.shop
- API Documentation: notifystack.shop/docs
MIT © Ayush
