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

telerivet

v1.8.5

Published

Telerivet API client for Node.js

Readme

Node.js client library for Telerivet REST API

http://telerivet.com/api

Overview

This library makes it easy to integrate your Node.js application with Telerivet. You can use it to:

  • send SMS messages via an Android phone or SMS gateway service
  • update contact information in Telerivet (e.g. from a signup form on your own website)
  • add or remove contacts from groups
  • export your message/contact data from Telerivet into your own systems
  • schedule messages to be sent at a later time
  • control automated services
  • much more

All API methods are fully documented at https://telerivet.com/api/rest/node , as well as in the comments of the JS source files. To learn what functionality is available, start with lib/{telerivet.js,project.js,apicursor.js}.

System Requirements

Node.js 0.8 or higher

Installation

npm install telerivet

API Overview

First, import the telerivet module and create a telerivet.API instance with your API key as a parameter:

var telerivet = require('telerivet');
var tr = new telerivet.API(API_KEY);

In order to access most API methods, you first need to get a Project object:

var project = tr.initProjectById(PROJECT_ID);

When calling initProjectById (and other init____ById methods) a "lazy" object is returned immediately, without making an API call to retrieve the data for that object (e.g. project.name).

To retrieve the data you can call getProjectById instead:

tr.getProjectById(PROJECT_ID, function(err, project) {
    if (err) throw err;
    console.log(project.name);
});

Alternatively you can call load(callback) after calling initProjectById:

var project = tr.initProjectById(PROJECT_ID);
project.load(function(err, project) {
    if (err) throw err;
    console.log(project.name);
});

All methods that make an API request require a final callback parameter:

project.sendMessage({
    to_number: '555-0001', 
    content: 'Hello world!'
}, function(err, message) {
    if (err) throw err;
    console.log(message);
});

The APICursor class makes it easy to interact with API resources that return a pageable list of entities (messages, contacts, etc.).

var cursor = project.queryMessages().limit(20);
cursor.each(function(err, message) {
    if (err) throw err;
    if (message)
    {
        console.log(message.content);
    }
});

Example Usage

var telerivet = require('telerivet');

var API_KEY = 'YOUR_API_KEY';  // from https://telerivet.com/api/keys
var PROJECT_ID = 'YOUR_PROJECT_ID'; 

var tr = new telerivet.API(API_KEY);

var project = tr.initProjectById(PROJECT_ID); 

// send message

project.sendMessage({
    to_number: '555-0001', 
    content: 'Hello world!'
}, function(err, message) {
    if (err) throw err;
    console.log(message);
});

// import contact and add to group

project.getOrCreateContact({
    name: 'John Smith',
    phone_number: '555-0001',
    vars: {
        birthdate: '1981-03-04',
        network: 'Vodacom'
    }
}, function(err, contact) {
    if (err) throw err;
    
    project.getOrCreateGroup('Subscribers', function(err, group) {
        if (err) throw err;
        
        contact.addToGroup(group, function(err) {
            if (err) throw err;
        });
    });
});

// query contact information

var namePrefix = 'John';
var cursor = project.queryContacts({
    name: {prefix: namePrefix},
    sort: 'name'    
}).limit(20);

cursor.count(function(err, count) {
    if (err) throw err;
    
    console.log(count + " contacts matching " + namePrefix + ":");        
    
    cursor.each(function(err, contact) {
        if (err) throw err;
        
        if (contact != null)
        {
            console.log(contact.name + " " + contact.phone_number + " " + contact.vars.birthdate);
        }
    });        
});