Novu is an open-source notification infrastructure with a single API for email, SMS, push, in-app, and chat notifications. Write once, deliver anywhere.
Setup
npm install @novu/node
Send Multi-Channel Notification
import { Novu } from '@novu/node';
const novu = new Novu('your-api-key');
await novu.trigger('welcome-flow', {
to: {
subscriberId: 'user-123',
email: 'alice@example.com',
phone: '+1234567890'
},
payload: {
name: 'Alice',
planName: 'Pro'
}
});
// This single call sends email + SMS + push + in-app based on your workflow
Define Workflows
// In Novu dashboard or via API
// welcome-flow:
// Step 1: In-App notification (instant)
// Step 2: Email (if not read in 1 hour)
// Step 3: SMS (if not read in 24 hours)
// Step 4: Push notification (final attempt)
In-App Notification Center
import { NovuProvider, PopoverNotificationCenter } from '@novu/notification-center';
function App() {
return (
<NovuProvider subscriberId="user-123" applicationIdentifier="your-app-id">
<PopoverNotificationCenter>
{({ unseenCount }) => (
<button>Notifications ({unseenCount})</button>
)}
</PopoverNotificationCenter>
</NovuProvider>
);
}
Subscriber Management
// Create subscriber
await novu.subscribers.identify('user-123', {
email: 'alice@example.com',
firstName: 'Alice',
phone: '+1234567890'
});
// Update preferences
await novu.subscribers.updatePreference('user-123', 'weekly-digest', {
channel: { email: true, sms: false }
});
REST API
# Trigger notification
curl -X POST https://api.novu.co/v1/events/trigger \
-H "Authorization: ApiKey your-key" \
-d '{"name":"welcome","to":{"subscriberId":"user-123"},"payload":{"name":"Alice"}}'
Why This Matters
- One API, all channels: Email, SMS, push, in-app, chat
- Smart routing: Fallback channels if primary unread
- Preference management: Users control their notifications
- Open source: Self-host or use cloud
Need custom notification systems or multi-channel messaging? I build developer tools. Check out my web scraping actors on Apify or reach out at spinov001@gmail.com for custom solutions.
Top comments (0)