-
Couldn't load subscription status.
- Fork 5.5k
New Components - zerobounce #14648
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
New Components - zerobounce #14648
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| import zerobounce from "../../zerobounce.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "zerobounce-ai-scoring", | ||
| name: "AI Scoring", | ||
| 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/#single_email_scoring)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| zerobounce, | ||
| email: { | ||
| type: "string", | ||
| label: "Email", | ||
| description: "The email address that you want to retrieve Scoring data for", | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.zerobounce.getReliabilityScore({ | ||
| $, | ||
| params: { | ||
| email: this.email, | ||
| }, | ||
| }); | ||
| $.export("$summary", `Successfully estimated reliability score for email: ${this.email}`); | ||
| return response; | ||
| }, | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }; | ||
128 changes: 128 additions & 0 deletions
128
components/zerobounce/actions/file-validation/file-validation.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,128 @@ | ||
| import zerobounce from "../../zerobounce.app.mjs"; | ||
| import fs from "fs"; | ||
| import FormData from "form-data"; | ||
| import path from "path"; | ||
|
|
||
| export default { | ||
| key: "zerobounce-file-validation", | ||
| name: "Validate Emails in File", | ||
| 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/)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| zerobounce, | ||
| filePath: { | ||
| type: "string", | ||
| label: "File Path", | ||
| description: "The path to a csv or txt file in the `/tmp` directory. [See the documentation on working with files](https://pipedream.com/docs/code/nodejs/working-with-files/#writing-a-file-to-tmp)", | ||
| }, | ||
| emailAddressColumn: { | ||
| type: "integer", | ||
| label: "Email Address Column", | ||
| description: "The column index of the email address in the file. Index starts from 1.", | ||
| }, | ||
| firstNameColumn: { | ||
| type: "integer", | ||
| label: "First Name Column", | ||
| description: "The column index of the first name column. Index starts from 1.", | ||
| optional: true, | ||
| }, | ||
| lastNameColumn: { | ||
| type: "integer", | ||
| label: "Last Name Column", | ||
| description: "The column index of the last name column. Index starts from 1.", | ||
| optional: true, | ||
| }, | ||
| ipAddressColumn: { | ||
| type: "integer", | ||
| label: "IP Address Column", | ||
| description: "The IP Address the email signed up from. Index starts from 1", | ||
| optional: true, | ||
| }, | ||
| hasHeaderRow: { | ||
| type: "boolean", | ||
| label: "Has Header Row", | ||
| description: "If the first row from the submitted file is a header row", | ||
| optional: true, | ||
| }, | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| removeDuplicates: { | ||
| type: "boolean", | ||
| label: "Remove Duplicates", | ||
| description: "If you want the system to remove duplicate emails. Default is `true`. Please note that if we remove more than 50% of the lines because of duplicates (parameter is true), system will return a 400 bad request error as a safety net to let you know that more than 50% of the file has been modified.", | ||
| optional: true, | ||
| }, | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| returnUrl: { | ||
| type: "string", | ||
| label: "Return URL", | ||
| description: "The URL will be used to call back when the validation is completed", | ||
| optional: true, | ||
| }, | ||
| callbackWithRerun: { | ||
| type: "boolean", | ||
| label: "Callback With Rerun", | ||
| description: "Use the `$.flow.rerun` Node.js helper to rerun the step when the validation is completed. Overrides the `rerunUrl` prop. This will increase execution time and credit usage as a result. [See the documentation](https://pipedream.com/docs/code/nodejs/rerun/#flow-rerun)", | ||
| optional: true, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| let response, summary; | ||
| const { run } = $.context; | ||
|
|
||
| if (run.runs === 1) { | ||
| let returnUrl = this.returnUrl; | ||
| if (this.callbackWithRerun) { | ||
| ({ resume_url: returnUrl } = $.flow.rerun(600000, null, 1)); | ||
| } | ||
|
|
||
| const filePath = this.filePath.includes("tmp/") | ||
| ? this.filePath | ||
| : `/tmp/${this.filePath}`; | ||
| const fileName = path.basename(filePath); | ||
| const fileContent = fs.readFileSync(filePath); | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| const formData = new FormData(); | ||
| formData.append("file", fileContent, fileName); | ||
| formData.append("email_address_column", this.emailAddressColumn); | ||
| formData.append("api_key", this.zerobounce.$auth.api_key); | ||
| if (this.firstNameColumn) { | ||
| formData.append("first_name_column", this.firstNameColumn); | ||
| } | ||
| if (this.lastNameColumn) { | ||
| formData.append("last_name_column", this.lastNameColumn); | ||
| } | ||
| if (this.ipAddressColumn) { | ||
| formData.append("ip_address_column", this.ipAddressColumn); | ||
| } | ||
| if (this.hasHeaderRow) { | ||
| formData.append("has_header_row", this.hasHeaderRow | ||
| ? "true" | ||
| : "false"); | ||
| } | ||
| if (this.removeDuplicates) { | ||
| formData.append("remove_duplicate", this.removeDuplicates | ||
| ? "true" | ||
| : "false"); | ||
| } | ||
| if (returnUrl) { | ||
| formData.append("return_url", returnUrl); | ||
| } | ||
|
|
||
| response = await this.zerobounce.validateEmailsInFile({ | ||
| $, | ||
| data: formData, | ||
| headers: { | ||
| ...formData.getHeaders(), | ||
| }, | ||
| }); | ||
| summary = "Successfully sent file for validation"; | ||
| } | ||
|
|
||
| if (run.callback_request) { | ||
| response = run.callback_request.body; | ||
| summary = "Successfully validated emails in file"; | ||
| } | ||
|
|
||
| $.export("$summary", summary); | ||
| return response; | ||
| }, | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }; | ||
64 changes: 64 additions & 0 deletions
64
components/zerobounce/actions/get-validation-results-file/get-validation-results-file.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| import zerobounce from "../../zerobounce.app.mjs"; | ||
| import fs from "fs"; | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| import { ConfigurationError } from "@pipedream/platform"; | ||
|
|
||
| export default { | ||
| key: "zerobounce-get-validation-results-file", | ||
| name: "Get Validation Results File", | ||
| description: "Downloads the validation results for a file submitted using sendfile API. [See the documentation](https://www.zerobounce.net/docs/email-validation-api-quickstart/#get_file__v2__)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| zerobounce, | ||
| fileId: { | ||
| type: "string", | ||
| label: "File ID", | ||
| description: "The file_id returned when sending the file for validation. Can be found on your Zerobounce \"Validate\" tab under Results next to each filename. Click on the ID circle.", | ||
| }, | ||
| fileName: { | ||
| type: "string", | ||
| label: "File Name", | ||
| description: "The filename to save the file as in the \"/tmp\" directory", | ||
| }, | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }, | ||
| methods: { | ||
| getResultsFile({ | ||
| $, ...opts | ||
| }) { | ||
| return this.zerobounce.getResultsFile({ | ||
| $, | ||
| params: { | ||
| file_id: this.fileId, | ||
| }, | ||
| ...opts, | ||
| }); | ||
| }, | ||
| async validateFileId({ $ }) { | ||
| try { | ||
| return await this.getResultsFile({ | ||
| $, | ||
| }); | ||
| } catch { | ||
| throw new ConfigurationError("File not found. Make sure the File ID is correct"); | ||
| } | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| if (!(await this.validateFileId({ | ||
| $, | ||
| }))) { | ||
| return; | ||
| } | ||
| const response = await this.getResultsFile({ | ||
| $, | ||
| responseType: "arraybuffer", | ||
| }); | ||
|
|
||
| const filePath = `/tmp/${this.fileName}`; | ||
| fs.writeFileSync(filePath, response); | ||
|
|
||
| $.export("$summary", `File saved to ${filePath}`); | ||
|
|
||
| return filePath; | ||
| }, | ||
| }; | ||
41 changes: 41 additions & 0 deletions
41
components/zerobounce/actions/validate-email/validate-email.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| import zerobounce from "../../zerobounce.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "zerobounce-validate-email", | ||
| name: "Validate Email", | ||
| description: "Validates a specific email. [See the documentation](https://www.zerobounce.net/docs/email-validation-api-quickstart/#validate_emails__v2__)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| zerobounce, | ||
| email: { | ||
| type: "string", | ||
| label: "Email", | ||
| description: "The email address to be validated", | ||
| }, | ||
| ipAddress: { | ||
| type: "string", | ||
| label: "IP Address", | ||
| description: "The IP Address the email signed up from", | ||
| optional: true, | ||
| }, | ||
| activityData: { | ||
| type: "boolean", | ||
| label: "Activity Data", | ||
| description: "If set to `true`, Activity Data information will be appended to the validation result", | ||
| optional: true, | ||
| }, | ||
| }, | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| async run({ $ }) { | ||
| const response = await this.zerobounce.validateEmail({ | ||
| $, | ||
| params: { | ||
| email: this.email, | ||
| ip_address: this.ipAddress || "", | ||
| activity_data: this.activityData, | ||
| }, | ||
| }); | ||
| $.export("$summary", `Successfully validated email: ${this.email}`); | ||
| return response; | ||
| }, | ||
| }; | ||
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,16 +1,20 @@ | ||
| { | ||
| "name": "@pipedream/zerobounce", | ||
| "version": "0.0.2", | ||
| "version": "0.1.0", | ||
| "description": "Pipedream ZeroBounce Components", | ||
| "main": "dist/app/zerobounce.app.mjs", | ||
| "main": "zerobounce.app.mjs", | ||
| "keywords": [ | ||
| "pipedream", | ||
| "zerobounce" | ||
| ], | ||
| "files": ["dist"], | ||
| "homepage": "https://pipedream.com/apps/zerobounce", | ||
| "author": "Pipedream <support@pipedream.com> (https://pipedream.com/)", | ||
| "publishConfig": { | ||
| "access": "public" | ||
| }, | ||
| "dependencies": { | ||
| "@pipedream/platform": "^3.0.3", | ||
| "form-data": "^4.0.1", | ||
| "path": "^0.12.7" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| import { axios } from "@pipedream/platform"; | ||
|
|
||
| export default { | ||
| type: "app", | ||
| app: "zerobounce", | ||
| methods: { | ||
| _baseUrl() { | ||
| return "https://api.zerobounce.net/v2"; | ||
| }, | ||
| _makeRequest(opts = {}) { | ||
| const { | ||
| $ = this, | ||
| path, | ||
| url, | ||
| params, | ||
| ...otherOpts | ||
| } = opts; | ||
| return axios($, { | ||
| ...otherOpts, | ||
| url: url || `${this._baseUrl()}${path}`, | ||
| params: { | ||
| ...params, | ||
| api_key: this.$auth.api_key, | ||
| }, | ||
| }); | ||
| }, | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| validateEmail(opts = {}) { | ||
| return this._makeRequest({ | ||
| path: "/validate", | ||
| ...opts, | ||
| }); | ||
| }, | ||
| getReliabilityScore(opts = {}) { | ||
| return this._makeRequest({ | ||
| path: "/scoring", | ||
| ...opts, | ||
| }); | ||
| }, | ||
| validateEmailsInFile(opts = {}) { | ||
| return this._makeRequest({ | ||
| method: "POST", | ||
| url: "https://bulkapi.zerobounce.net/v2/sendfile", | ||
| ...opts, | ||
| }); | ||
| }, | ||
| getResultsFile(opts = {}) { | ||
| return this._makeRequest({ | ||
| url: "https://bulkapi.zerobounce.net/v2/getfile", | ||
| ...opts, | ||
| }); | ||
| }, | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }, | ||
| }; | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.