GithubHelp home page GithubHelp logo

reacherhq / reacher-js Goto Github PK

View Code? Open in Web Editor NEW
25.0 5.0 18.0 754 KB

TypeScript wrapper library over Reacher API

Home Page: https://reacher.email

License: Apache License 2.0

JavaScript 1.03% TypeScript 98.97%
email-verification email-validation email

reacher-js's Introduction



@reacherhq/api

Check if an email address exists without sending any email.

npm Github Actions Apache-2.0 Github Sponsor



What is it?

Check if an email address exists without sending any email.

@reacherhq/api is a thin TypeScript wrapper around the Reacher Email Verification API. Reacher is a 100% open-source SaaS, written in Rust. It's also free for personal use, and the API token in @reacherhq/api is optional, but without it the requests will be rate-limited to 50 per month.

Usage

Install the package:

yarn add @reacherhq/api # Or npm install @reacherhq/api

There are two ways to use the library: by sending single API requests, or by using batch verification (parallel queue).

1. Single Email Verification

import { checkSingle } from '@reacherhq/api';

checkSingle(
	{ to_email: '[email protected]' },
	{
		// Required.
		apiToken: '<YOUR_TOKEN>',
	}
).then(console.log); // Output will be the JSON described in the "JSON Output" section below.

2. Batch Email Verification

import { batchQueue } from '@reacherhq/api';

// Create a queue for email verifications.
const q = batchQueue({
	// Required.
	apiToken: '<YOUR_TOKEN>',
	// Optional, callback to call on each successful verification.
	onSuccessSingle: (result) => {
		console.log(
			`Verified email ${result.input}: the result is ${result.is_reachable}.`
		);
	},
});

// Push some data into the queue. The email verification will start as soon as
// it's in the queue. The queue has a default concurrency of 100.
q.push({ to_email: '[email protected]' });
q.push({ to_email: '[email protected]' }, { to_email: '[email protected]' });

// Perform some action when the queue is drained.
q.drain(() => {
	console.log('Finished processing all items.');
});

JSON Output

The output will be a JSON with the below format, the fields should be self-explanatory. For [email protected] (note that it is disabled by Gmail), here's the exact output:

{
	"input": "[email protected]",
	"is_reachable": "invalid",
	"misc": {
		"is_disposable": false,
		"is_role_account": false
	},
	"mx": {
		"accepts_mail": true,
		"records": [
			"alt3.gmail-smtp-in.l.google.com.",
			"gmail-smtp-in.l.google.com.",
			"alt1.gmail-smtp-in.l.google.com.",
			"alt4.gmail-smtp-in.l.google.com.",
			"alt2.gmail-smtp-in.l.google.com."
		]
	},
	"smtp": {
		"can_connect_smtp": true,
		"has_full_inbox": false,
		"is_catch_all": false,
		"is_deliverable": false,
		"is_disabled": true
	},
	"syntax": {
		"domain": "gmail.com",
		"is_valid_syntax": true,
		"username": "someone"
	}
}

You can also take a look at the OpenAPI v3 specification of this JSON object.

License

The source code is available under the Apache-2.0 license. See the LICENSE file for more info.

reacher-js's People

Contributors

amaury1093 avatar dependabot-preview[bot] avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

reacher-js's Issues

Batch Verification not working

[user@ip-10-10-1-209 examples]$ ../node_modules/.bin/ts-node csv_batch.ts
/home/user/public_html/amit/reacher-js/examples/csv_batch.ts:43
q.push(data.map((email) => ({ to_email: email }))).catch(console.error);
^
TypeError: q.push(...).catch is not a function
at Parser. (/home/user/public_html/amit/reacher-js/examples/csv_batch.ts:43:59)
at Parser.emit (events.js:314:20)
at Parser.EventEmitter.emit (domain.js:483:12)
at addChunk (_stream_readable.js:297:12)
at readableAddChunk (_stream_readable.js:272:9)
at Parser.Readable.push (_stream_readable.js:213:10)
at Parser.Transform.push (_stream_transform.js:152:32)
at Parser.__push (/home/user/public_html/amit/reacher-js/node_modules/csv-parse/lib/index.js:965:10)
at Parser.__onRecord (/home/user/public_html/amit/reacher-js/node_modules/csv-parse/lib/index.js:886:28)
at Parser.__parse (/home/user/public_html/amit/reacher-js/node_modules/csv-parse/lib/index.js:668:38)
[user@ip-10-10-1-209 examples]$

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.