JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 9284
  • Score
    100M100P100Q152941F
  • License MIT

An API wrapper for the NeverBounce API

Package Exports

  • neverbounce

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (neverbounce) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

NeverBounce API NodeJS Wrapper

Build Status

This is the official NeverBounce API NodeJS wrapper. It provides helpful methods to quickly implement our API in your NodeJS applications.

Installation

To install use the following command

$ npm install neverbounce --save

Usage

To start using the wrapper sign up for an account here and get your api keys here. This wrapper utilizes ES6 Promises to handle the API calls.

To initialize the wrapper use the following snippet, substituting in your api key and api secrete key...

var NeverBounce = require('neverbounce')({
    apiKey: API_KEY,
    apiSecret: API_SECRET_KEY
});

You can now access the verify method from this object. To validate a single email use the following...

NeverBounce.single.verify(EMAIL_TO_VALIDATE).then(
    function(result) {
        // do stuff
    },
    function(error) {
        // errors will bubble up through the reject method of the promise.
        // you'll want to console.log them otherwise it'll fail silently
    }
);

The result returned in from the verification promise will be a Result object. It provides several helper methods documented below...

result.getResult(); // Numeric result code; ex: 0, 1, 2, 3, 4
result.getResultTextCode(); // Textual result code; ex: valid, invalid, disposable, catchall, unknown
result.is(0); // Returns true if result is valid
result.is([0,3,4]); // Returns true if result is valid, catchall, or unknown
result.not(1); // Returns true if result is not invalid
result.not([1,2]); // Returns true if result is not invalid or disposable