npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

notifyon

v0.1.2

Published

NotifyOn SDK for Node.js - Send browser notifications when long-running tasks complete

Downloads

12

Readme

NotifyOn Node.js SDK

Send real-time browser and push notifications to your users when long-running agent tasks complete.

Installation

npm install notifyon
# or
yarn add notifyon
# or
pnpm add notifyon

Quick Start

import { NotifyOn } from 'notifyon';

// Initialize the client
const notifyon = new NotifyOn({
  apiKey: process.env.NOTIFYON_API_KEY
});

// That's it! Just send a notification when your agent task completes
await notifyon.send('user_123');

// Optionally, you can include a custom message
await notifyon.send('user_123', 'Your data analysis is complete');

How It Works

NotifyOn uses a progressive notification strategy that automatically handles channel selection:

  1. Browser Sound (enabled by default): Plays a pleasant notification sound when the user has your site open
  2. Push Notifications (enabled by default): Shows only when the user's tab is not visible/focused
  3. Email (coming soon): Sends only if both browser and push fail to deliver
  4. Slack (coming soon): Integration with Slack workspaces

No configuration needed! Users are automatically set up with sensible defaults when you first call send().

API Reference

new NotifyOn(config)

Creates a new NotifyOn client instance.

Parameters:

  • config.apiKey (required): Your NotifyOn API key
  • config.baseUrl (optional): Custom API endpoint (defaults to https://dashboard.notifyon.app/v1)

notifyon.send(userId, message?)

Send a notification to a user when their task completes.

Parameters:

  • userId: External user identifier
  • message (optional): Custom notification message

Returns: Promise<void>

// Simple notification
await notifyon.send('user_123');

// With custom message
await notifyon.send('user_123', 'Your report is ready for download');

notifyon.set(userId, preferences)

Optional method - Only use if you need to manually control channel preferences.

By default, browser and push are enabled automatically. Use this method only to:

  • Disable specific channels for a user
  • Give users control over their notification preferences

Parameters:

  • userId: External user identifier
  • preferences: Object containing channel preferences
    • browser: Enable/disable browser sound notifications
    • push: Enable/disable push notifications
    • email: Enable/disable email notifications (future)
    • slack: Enable/disable Slack notifications (future)

Returns: Promise<void>

// Example: User disabled push notifications in their settings
await notifyon.set('user_123', { push: false });

// Example: User wants only browser sounds
await notifyon.set('user_123', { browser: true, push: false });

Error Handling

The SDK throws NotifyOnError for API errors:

import { NotifyOn, NotifyOnError } from 'notifyon';

try {
  await notifyon.send('user_123');
} catch (error) {
  if (error instanceof NotifyOnError) {
    console.error('NotifyOn Error:', error.message);
    console.error('Status Code:', error.statusCode);
    console.error('Error Code:', error.code);
  }
}

TypeScript Support

The SDK is written in TypeScript and provides full type definitions:

import { NotifyOn, NotifyOnConfig, NotificationPreferences } from 'notifyon';

const config: NotifyOnConfig = {
  apiKey: 'your-api-key'
};

// Optional: Only if you need manual control
const preferences: NotificationPreferences = {
  browser: true,
  push: false,
  email: false,
  slack: false
};

Browser Integration

To receive notifications in the browser, include the NotifyOn browser SDK in your web application:

// In your web app
import { NotifyOn } from '@notifyon/web';

const client = new NotifyOn({
  publicKey: 'your-public-key',
  userId: 'user_123'
});

// Connect to receive notifications
await client.connect();

The browser SDK will:

  • Play a soft, pleasant sound when notifications arrive (if tab is visible)
  • Show push notifications when the tab is hidden/unfocused
  • Automatically handle the progressive notification strategy

Requirements

License

MIT