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

enrich-api

v2.0.1

Published

Enrich API Node.

Downloads

10

Readme

enrich-api-node

Test and Build Build and Release NPM Downloads

The Enrich API NodeJS wrapper. Enrich, Search and Verify data from your NodeJS services.

Copyright 2017 Crisp IM SAS. See LICENSE for copying information.

Usage

Install the library:

npm install enrich-api --save

Then, import it:

var Enrich = require("enrich-api").Enrich;

Construct a new authenticated Enrich client with your user_id and secret_key tokens.

var client = new Enrich("ui_xxxxxx", "sk_xxxxxx");

Then, consume the client eg. to enrich an email address:

client.Enrich.Person({
  email : "[email protected]"
})
  .then(function(data) {
    console.info("Enriched email:", data);
  })
  .catch(function(error) {
    console.error("Failed enriching email:", error);
  });

This library uses Promise for asynchronous response handling. If your NodeJS version is recent enough and has support for native promises, then the library will use native promises. Otherwise, it will fallback on a non-native implementation of promises.

Authentication

To authenticate against the API, get your tokens (user_id and secret_key).

Then, pass those tokens once when you instanciate the Enrich client as following:

// Make sure to replace 'user_id' and 'secret_key' with your tokens
var client = new Enrich("user_id", "secret_key");

Data Discovery

When Enrich doesn't know about a given data point, eg. an email that was never enriched before, it launches a discovery. Discoveries can take a few seconds, and sometimes more than 10 seconds.

This library implements a retry logic with a timeout if the discovery takes too long, or if the item wasn't found.

Thus, you can expect some requests, especially the Enrich requests, to take more time than expected. This is normal, and is not a performance issue on your side, or on our side. Under the hood, when you request a data point (eg. enrich a person given an email) that doesn't yet exist in our databases, the Enrich API returns the HTTP response 201 Created. Then, this library will poll the enrich resource for results, with intervals of a few seconds. The API will return 404 Not Found as the discovery is still processing and no result is yet known at this point. Once a result is found, the API will reply with 200 OK and return discovered data. If the discovery fails and no data can be aggregated for this email, the library aborts the retry after some time (less than 20 seconds), and returns a not_found error.

If a requested data point is already known by the Enrich API, it will be immediately returned, which won't induce any delay.

Resource Methods

This library implements all methods the Enrich API provides. See the API docs for a reference of available methods, as well as how returned data is formatted.

Verify API

Validate an Email

client.Verify.ValidateEmail({
  email : "[email protected]"
});

Enrich API

Enrich a Person

client.Enrich.Person({
  email : "[email protected]"
});

Enrich a Company

client.Enrich.Company({
  domain : "crisp.chat"
});

Enrich a Network

client.Enrich.Network({
  ip : "178.62.89.169"
});