Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/reacherhq/reacher-js
TypeScript wrapper library over Reacher API
https://github.com/reacherhq/reacher-js
email email-validation email-verification
Last synced: 5 days ago
JSON representation
TypeScript wrapper library over Reacher API
- Host: GitHub
- URL: https://github.com/reacherhq/reacher-js
- Owner: reacherhq
- License: apache-2.0
- Created: 2020-06-14T11:27:33.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-12-08T16:12:20.000Z (11 months ago)
- Last Synced: 2024-10-31T13:03:35.178Z (13 days ago)
- Topics: email, email-validation, email-verification
- Language: TypeScript
- Homepage: https://reacher.email
- Size: 736 KB
- Stars: 25
- Watchers: 5
- Forks: 18
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
@reacherhq/api
Check if an email address exists without sending any email.
## 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](https://reacher.email). 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:
```bash
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
```typescript
import { checkSingle } from '@reacherhq/api';checkSingle(
{ to_email: '[email protected]' },
{
// Required.
apiToken: '',
}
).then(console.log); // Output will be the JSON described in the "JSON Output" section below.
```### 2. Batch Email Verification
```typescript
import { batchQueue } from '@reacherhq/api';// Create a queue for email verifications.
const q = batchQueue({
// Required.
apiToken: '',
// 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:
```json
{
"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](https://help.reacher.email/rest-api-documentation) of this JSON object.
## License
The source code is available under the Apache-2.0 license. See the [LICENSE](./LICENSE) file for more info.