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 🙏

© 2024 – Pkg Stats / Ryan Hefner

assemble-numbers-client

v1.3.0

Published

A client for the Assemble Numbers API

Downloads

37

Readme

Assemble Numbers Client

For P2P texting and calling applications, it’s useful to lookup information about a phone number before you text or call it, since it lets you know whether the number is reachable by the desired method.

Under most circumstances, it will save you money – suppose

  • sending texts costs $0.0075 per segment
  • 50% of your numbers are landlines (a reasonable assumption when working with voter file data)
  • it costs $0.0025 to look up a number
  • you are going to text 100,000 people

With prior validation of numbers, it will cost you:

(50,000 * .0025) + (50,000 * (.0025 + .0075)) = 625

Without prior validation, it will cost:

100,000 * .0075 = 750

Savings!

However, you are probably going to text the same contacts over and over again – without validating, you may end up re-texting landlines, if you are not meticulously tracking and handling response codes from the SMS service.

Assemble Numbers is a small service in Beta for looking up and storing carrier information about cell phone numbers. It provides an asynchronous, batch-based API for requesting information about large amounts of numbers at a time.

To get an API key, head to https://airtable.com/shruW0ZhyOSw3KzIw.

Usage

Fetching data from Assemble Numbers is done via batched requests. You create a request, add numbers to the request, close the request, and then await its completion.

If using batch requests and the Assemble service, lookups can run as fast as 500 numbers/second.

Batch Requests

// ES Module style
import NumbersClient from 'assemble-numbers-client';

const options = {
  apiKey: 'YOUR_ASSEMBLE_NUMBERS_API_KEY'
};

const numbersClient = new NumbersClient(options);

async function filterNumbersForType(phoneNumbers: string[], type: string) {
  const request = await numbersClient.lookup.createRequest();

  // addPhoneNumbers to request accepts a maximum of 500 numbers
  // at a time
  // you can put up to 500,000 numbers in a single request
  await request.addPhoneNumbers(phoneNumbers);

  await request.close();

  await request.waitUntilDone({
    onProgressUpdate: percentComplete => {
      console.log(`Completed ${percentComplete}`);
    }
  });

  return await request.mobiles.eachPage({
    pageSize: n,
    onPage: async (numbers, pageNumber) => {
      // all of these numbers are mobiles
      // do something with them!
    }
  });

  // other methods on a finished request include:
  // request.landlines.each();
  // request.others.each();
}

Full Documentation

Full documentation is available here.

Additional Details

Additional Carrier Info

When we look up a number, we not only get information about the phone type (mobile, landline, or VOIP (other)), but we also learn the carrier and some other data.

Although at the moment (beginning of July), the Assemble API only exposes the phone type, we will be incorporating additional information into the API soon, and you will be able to access all of that information for numbers you have already looked up without additional charges.

If you need that information now, please get in touch via email at [email protected].

Can This Also Do _?

If you are interested in a different or expanded use case for Assemble LRN, we’re likely interested!

Examples include:

  • A version of this library in a different programming language (Python, Ruby, etc.)
  • A service that would use this library to clean and annotate the numbers in my CRM

Contact [email protected] with inquiries!