๐Ÿ””
NotiFlow

Multi-channel notification delivery for modern SaaS applications

npm v2.4.1 MIT License TypeScript 100% test coverage

Table of Contents

Overview Installation Features Quick Start Supported Channels Configuration API Reference Contributing

๐Ÿ“‹Overview

NotiFlow is a unified notification SDK that lets you send alerts via email, SMS, push, Slack, and webhooks from a single, consistent API. No more juggling five different SDKs for five different channels.

Built for Node.js and TypeScript, NotiFlow handles retries, templating, batching, and delivery tracking out of the box โ€” so you can focus on building, not plumbing.

๐Ÿ“ฆInstallation

bash
# npm
npm install notiflow

# yarn
yarn add notiflow

# pnpm
pnpm add notiflow

โœจFeatures

๐Ÿ“ฌ

Multi-channel

Email, SMS, Push, Slack, and Webhooks from one unified API.

๐Ÿ”

Auto Retry

Configurable retry logic with exponential backoff on failed deliveries.

๐ŸŽจ

Templating

Handlebars-compatible templates with variable injection support.

๐Ÿ“Š

Delivery Tracking

Track sent, delivered, opened, and failed statuses per notification.

๐Ÿš€Quick Start

TypeScript
import { NotiFlow } from 'notiflow';

const notify = new NotiFlow({
  email: { provider: 'sendgrid', apiKey: process.env.SG_API_KEY },
  sms:   { provider: 'twilio',   sid: process.env.TW_SID, token: process.env.TW_TOKEN }
});

// Send an email
await notify.send({
  channel: 'email',
  to: '[email protected]',
  subject: 'Your order shipped!',
  template: 'order-shipped',
  data: { orderId: 'ORD-9921', estimatedDelivery: 'Mar 15' }
});

// Send an SMS
await notify.send({
  channel: 'sms',
  to: '+2348012345678',
  message: 'Your OTP is 482910. Valid for 5 minutes.'
});

๐Ÿ“กSupported Channels

ChannelProvider OptionsTemplatingDelivery Tracking
๐Ÿ“ง EmailSendGrid, Mailgun, SESโœ“โœ“
๐Ÿ“ฑ SMSTwilio, Vonage, Termiiโœ“โœ“
๐Ÿ”” PushFCM, APNsโœ“โœ“
๐Ÿ’ฌ SlackSlack Webhooksโœ“โ€”
๐ŸŒ WebhookAny HTTP endpointโ€”โœ“

โš™๏ธConfiguration

OptionTypeDescription
emailoptionalobjectEmail provider config. Required to send emails.
smsoptionalobjectSMS provider config. Required to send SMS.
retriesoptionalnumberMax retry attempts on failure. Default: 3.
retryDelayoptionalnumberBase delay in ms between retries. Default: 1000.
templateDiroptionalstringPath to your templates folder. Default: ./templates.
onDeliveryoptionalfunctionCallback fired on each delivery event.

โš ๏ธ At least one channel (email, sms, push, etc.) must be configured. Calling notify.send() for an unconfigured channel throws a ChannelNotConfiguredError.

๐Ÿ“–API Reference

notify.send( options )

Sends a notification on the specified channel. Returns a delivery receipt object.

Return value
{
  id: "ntf_7x9abc",
  channel: "email",
  status: "delivered",
  sentAt: "2025-03-06T10:00:00Z",
  attempts: 1
}

notify.batch( notifications[] )

Send multiple notifications in a single call. Processes in parallel with configurable concurrency.

TypeScript
const results = await notify.batch([
  { channel: 'email', to: '[email protected]', subject: 'Hi A', message: 'Hello!' },
  { channel: 'sms',   to: '+2348011111111',            message: 'Your code: 1234' },
]);
// Returns array of delivery receipts

๐ŸคContributing

Contributions are welcome! Please fork the repository, create a feature branch, and open a pull request. Make sure all tests pass before submitting.

bash
git clone https://github.com/your-org/notiflow.git
cd notiflow
npm install
npm test        # Run test suite
npm run build   # Build TypeScript