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

alertme-api-node

v0.1.0

Published

Simple package for talking to the Alertme API

Readme

Alertme API

Prerequisites

This library is for use with the Alertme notification system. Visit our github page for information on getting started.

Installation

npm install alertme-api

Create the api client object

Passing in an API key

const Alertme = require('alertme-api-node');
const client = new Alertme('YOUR_API_KEY');

Using an API key stored in an environment variable

//Create an env var as ALERTME_API_KEY
const Alertme = require('alertme-api-node');
const client = new Alertme();

Acquire a customer token

One use of this client library is to get an auth token for one of your customers, which you then pass into the Alertme UI component. It is important that the call to get the token be done on the server-side, as to not expose your API key in client-side code. The token returned is safe to expose.

Here is an example of a server-side function that retrieves a customer token:

async function getSubscriberToken(req, res) {
  try{
    // Do whatever authentication is appropriate for your customer
    if (!authenticateUser(req, res)) return;

    // Retrieve Data - using whatever ID you have for your customer
    let token = await alertmeClient.getSubscriberToken(req.user.unique_name);

    // Return
    res.status(200).json(token);
  }
  catch(error){
      res.status(500).send(error);
  }
}

getSubscriberToken returns a promise - use async/await or .then() to get access to the token.

Publish an alert

The second scenario that this API implements is publishing an alert to the Alertme service.

    alertmeClient.publishAlert("my-topic");

The code above will publish an alert to the specified topic, and everyone subscribed to that topic will receive the alert on the channel(s) (email, sms) that they indicated.

You can also provide parameters via a 2nd options argument, so that only subscribers who meet the criteria receive the alert.

    alertmeClient.publishAlert("concert-alert", {
        parameters:{"band.itemName": "Foo Fighters"}
    });

You can also pass substitution data to tailor the alert text.

    alertmeClient.publishAlert("concert-alert", {
        parameters:{"band.itemName": "Foo Fighters"},
        data: {"band": "Foo Fighters", "venue": "The Anthem", "when": "Tuesday, March 4th"}
    });

The alert text could be configured something like this:

Hey! The {{band}} are coming to {{venue}} on {{when}}.