Skip to content

Commit 92687ba

Browse files
committed
init
1 parent 4b53f1b commit 92687ba

File tree

6 files changed

+115
-16
lines changed

6 files changed

+115
-16
lines changed

components/zerobounce/.gitignore

Lines changed: 0 additions & 3 deletions
This file was deleted.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import zerobounce from "../../zerobounce.app.mjs";
2+
3+
export default {
4+
key: "zerobounce-ai-scoring",
5+
name: "AI Scoring",
6+
description: "Estimates a reliability score based on ZeroBounce's AI for the provided email. [See the documentation](https://www.zerobounce.net/docs/ai-scoring-api/)",
7+
version: "0.0.{{ts}}",
8+
type: "action",
9+
props: {
10+
zerobounce,
11+
email: zerobounce.propDefinitions.email,
12+
},
13+
async run({ $ }) {
14+
const response = await this.zerobounce.getReliabilityScore(this.email);
15+
$.export("$summary", `Successfully estimated reliability score for email: ${this.email}`);
16+
return response;
17+
},
18+
};
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import zerobounce from "../../zerobounce.app.mjs";
2+
3+
export default {
4+
key: "zerobounce-file-validation",
5+
name: "Validate Emails in File",
6+
description: "Performs email validation on all the addresses contained in a provided file. [See the documentation](https://www.zerobounce.net/docs/email-validation-api-quickstart/)",
7+
version: "0.0.{{ts}}",
8+
type: "action",
9+
props: {
10+
zerobounce,
11+
file: zerobounce.propDefinitions.file,
12+
},
13+
async run({ $ }) {
14+
const response = await this.zerobounce.validateEmailsInFile(this.file);
15+
$.export("$summary", "Successfully validated emails in file");
16+
return response;
17+
},
18+
};
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import zerobounce from "../../zerobounce.app.mjs";
2+
3+
export default {
4+
key: "zerobounce-validate-email",
5+
name: "Validate Email",
6+
description: "Validates a specific email. [See the documentation](https://www.zerobounce.net/docs/email-validation-api-quickstart/)",
7+
version: "0.0.{{ts}}",
8+
type: "action",
9+
props: {
10+
zerobounce,
11+
email: zerobounce.propDefinitions.email,
12+
},
13+
async run({ $ }) {
14+
const response = await this.zerobounce.validateEmail(this.email);
15+
$.export("$summary", `Successfully validated email: ${this.email}`);
16+
return response;
17+
},
18+
};

components/zerobounce/app/zerobounce.app.ts

Lines changed: 0 additions & 13 deletions
This file was deleted.
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
import { axios } from "@pipedream/platform";
2+
3+
export default {
4+
type: "app",
5+
app: "zerobounce",
6+
propDefinitions: {
7+
email: {
8+
type: "string",
9+
label: "Email",
10+
description: "The email address to be validated",
11+
},
12+
file: {
13+
type: "string",
14+
label: "File",
15+
description: "The file that contains email addresses to be validated",
16+
},
17+
},
18+
methods: {
19+
_baseUrl() {
20+
return "https://api.zerobounce.net/v2";
21+
},
22+
async _makeRequest(opts = {}) {
23+
const {
24+
$ = this,
25+
method = "GET",
26+
path,
27+
headers,
28+
...otherOpts
29+
} = opts;
30+
return axios($, {
31+
...otherOpts,
32+
method,
33+
url: this._baseUrl() + path,
34+
headers: {
35+
...headers,
36+
"user-agent": "@PipedreamHQ/pipedream v0.1",
37+
"Authorization": `Bearer ${this.$auth.oauth_access_token}`,
38+
},
39+
});
40+
},
41+
async validateEmail(email) {
42+
return this._makeRequest({
43+
path: `/validate?email=${email}`,
44+
});
45+
},
46+
async validateEmailsInFile(file) {
47+
return this._makeRequest({
48+
method: "POST",
49+
path: "/sendfile",
50+
data: {
51+
file: file,
52+
},
53+
});
54+
},
55+
async getReliabilityScore(email) {
56+
return this._makeRequest({
57+
path: `/score?email=${email}`,
58+
});
59+
},
60+
},
61+
};

0 commit comments

Comments
 (0)