@orchestree/notifications
v1.0.0
Published
Smart notifications — AI-prioritized, digest mode, quiet hours, channel routing
Maintainers
Readme
@orchestree/notifications
Smart notifications — AI-prioritized, digest mode, quiet hours, and channel routing for Orchestree.
Installation
npm install @orchestree/notificationsQuick Start
import { NotificationsClient } from '@orchestree/notifications';
const client = new NotificationsClient({
apiKey: 'your-api-key',
});
// List unread notifications
const notifications = await client.listNotifications({ read: 'false' });
// Mark as read
await client.markRead(notifications[0].id);
// Set quiet hours
await client.setQuietHours({
enabled: true,
startTime: '22:00',
endTime: '08:00',
timezone: 'America/New_York',
allowCritical: true,
days: ['mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun'],
});
// Get daily digest
const digest = await client.getDigest({ frequency: 'daily' });API Reference
NotificationsClient
listNotifications(params)
List notifications with optional filters.
const notifications = await client.listNotifications({ priority: 'high' });getNotification(notificationId)
Get notification by ID.
const notification = await client.getNotification('notif-id');markRead(notificationId)
Mark a single notification as read.
await client.markRead('notif-id');markAllRead()
Mark all notifications as read.
await client.markAllRead();getPreferences() / updatePreferences(preferences)
Manage notification preferences.
const prefs = await client.getPreferences();
await client.updatePreferences({
aiPrioritization: true,
digestEnabled: true,
digestFrequency: 'daily',
});getDigest(params)
Get a digest summary of notifications.
const digest = await client.getDigest({ frequency: 'daily' });
console.log(digest.summary);
console.log(digest.count);setQuietHours(quietHours)
Configure quiet hours to suppress non-critical notifications.
await client.setQuietHours({
enabled: true,
startTime: '22:00',
endTime: '08:00',
timezone: 'America/New_York',
allowCritical: true,
days: ['mon', 'tue', 'wed', 'thu', 'fri'],
});subscribe(subscription) / unsubscribe(subscriptionId)
Manage notification subscriptions.
const sub = await client.subscribe({ channel: 'webhook', endpoint: 'https://example.com/hook' });
await client.unsubscribe(sub.id);License
MIT
