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

@notiflows/client

v0.2.0

Published

Notiflows JavaScript SDK for the User API

Readme

@notiflows/client

Official JavaScript SDK for the Notiflows User API.

Installation

npm install @notiflows/client
# or
pnpm add @notiflows/client
# or
yarn add @notiflows/client

Quick Start

import { Notiflows } from '@notiflows/client'

const notiflows = new Notiflows({
  apiKey: 'pk_your_public_key',
  userId: 'user_123',
  userKey: 'jwt_token_here',
})

// Get user's feed
const feed = notiflows.feed({ channelId: 'in_app' })
const entries = await feed.getEntries()

// Mark notification as read
await feed.markAsRead('entry_id')

// Subscribe to real-time updates
feed.onDelivery = (entry) => {
  console.log('New notification:', entry)
}
await feed.subscribeToRealtimeNotifications()

// Manage preferences
const preferences = notiflows.userPreferences()
const prefs = await preferences.get()
await preferences.update({
  channel_types: {
    email: false,
  },
})

Authentication

The SDK requires three credentials:

  • apiKey - Your public API key (starts with pk_)
  • userId - The user's external ID
  • userKey - JWT token signed with your Application Signing Key

See Authentication Docs for details on generating JWT tokens.

API Reference

Notiflows

Main client class.

const notiflows = new Notiflows({
  apiKey: string,
  userId: string,
  userKey: string,
  apiUrl?: string,  // default: https://api.notiflows.com/user/v1
  wsUrl?: string,   // default: wss://api.notiflows.com/ws/v1
})

Feed

const feed = notiflows.feed({ channelId: 'in_app' })

// Fetch entries with optional filters
await feed.getEntries({
  status?: 'unseen' | 'seen' | 'unread' | 'read' | 'archived',
  notiflow?: string,    // filter by notiflow handle
  topic?: string,       // filter by topic
  archived?: boolean,   // include archived entries (default: false)
  limit?: number,
  after?: string,       // cursor for pagination
  before?: string,
})

// Feed settings (e.g. branding)
const settings = await feed.getSettings()
console.log(settings.branding_required)

// Update single entry
await feed.markAsSeen(entryId)
await feed.markAsRead(entryId)
await feed.markAsClicked(entryId)
await feed.markAsArchived(entryId)
await feed.markAsUnarchived(entryId)

// Batch update
await feed.batchMarkAsRead([entryId1, entryId2])
await feed.batchMarkAsArchived([entryId1, entryId2])
await feed.batchMarkAsUnarchived([entryId1, entryId2])

// Real-time
feed.onDelivery = (entry) => { ... }
feed.subscribeToRealtimeNotifications()
feed.stop()

Preferences

const preferences = notiflows.userPreferences()

await preferences.get()
await preferences.update({ ... })

Error Handling

The SDK provides typed errors:

import {
  BadRequestError,
  UnauthenticatedError,
  ForbiddenError,
  NotFoundError,
  RateLimitedError,
  isApiError,
} from '@notiflows/client'

try {
  await feed.getEntries()
} catch (error) {
  if (isApiError(error)) {
    console.log(error.code, error.message, error.details)
  }
}

Documentation

Full documentation is available at notiflows.com/docs/sdks/client-side/javascript.

License

MIT