-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New Components - nioleads #13934
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 - nioleads #13934
Changes from 3 commits
Commits
Show all changes
5 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 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,35 @@ | ||
| import nioleads from "../../nioleads.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "nioleads-find-email", | ||
| name: "Find Email", | ||
| description: "Finds a business email address using a full name and a website domain. [See the documentation](https://apidoc.nioleads.com/?_gl=1*1288vdg*_ga*MTY1NzE1MjMzOC4xNzI1OTM5Njk1*_ga_ZVT2YHDDZG*MTcyNTk0Mzk5NC4yLjAuMTcyNTk0NDAyMy4wLjAuMA..#email-finder)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| nioleads, | ||
| name: { | ||
| type: "string", | ||
| label: "Name", | ||
| description: "Full name of the person", | ||
| }, | ||
| domain: { | ||
| type: "string", | ||
| label: "Domain", | ||
| description: "The company domain name. (e.g. `example.com`)", | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.nioleads.findEmail({ | ||
| $, | ||
| data: { | ||
| name: this.name, | ||
| domain: this.domain, | ||
| }, | ||
| }); | ||
| if (response?.email) { | ||
| $.export("$summary", `Found email: ${response.email}`); | ||
| } | ||
| return response; | ||
| }, | ||
| }; | ||
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 nioleads from "../../nioleads.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "nioleads-verify-email", | ||
| name: "Verify Email", | ||
| description: "Checks the deliverability of a specified email address. [See the documentation](https://apidoc.nioleads.com/?_gl=1*1288vdg*_ga*MTY1NzE1MjMzOC4xNzI1OTM5Njk1*_ga_ZVT2YHDDZG*MTcyNTk0Mzk5NC4yLjAuMTcyNTk0NDAyMy4wLjAuMA..#email-verifier)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| nioleads, | ||
| email: { | ||
| type: "string", | ||
| label: "Email", | ||
| description: "The email address to verify", | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.nioleads.verifyEmail({ | ||
| $, | ||
| data: { | ||
| email: this.email, | ||
| }, | ||
| }); | ||
| $.export("$summary", `Verified email ${this.email}`); | ||
| return response; | ||
| }, | ||
| }; |
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,11 +1,50 @@ | ||
| import { axios } from "@pipedream/platform"; | ||
|
|
||
| export default { | ||
| type: "app", | ||
| app: "nioleads", | ||
| propDefinitions: {}, | ||
| methods: { | ||
| // this.$auth contains connected account data | ||
| authKeys() { | ||
| console.log(Object.keys(this.$auth)); | ||
| _baseUrl() { | ||
| return "https://api.nioleads.com/v1/openapi"; | ||
| }, | ||
| _makeRequest(opts = {}) { | ||
| const { | ||
| $ = this, | ||
| path, | ||
| headers, | ||
| ...otherOpts | ||
| } = opts; | ||
| return axios($, { | ||
| ...otherOpts, | ||
| url: `${this._baseUrl()}${path}`, | ||
| headers: { | ||
| ...headers, | ||
| "Authorization": `Bearer ${this.$auth.api_key}`, | ||
| "Content-Type": "application/json", | ||
| "Accept": "application/json", | ||
| }, | ||
| }); | ||
| }, | ||
| listContacts(opts = {}) { | ||
| return this._makeRequest({ | ||
| path: "/new_contacts", | ||
| ...opts, | ||
| }); | ||
| }, | ||
| verifyEmail(opts = {}) { | ||
| return this._makeRequest({ | ||
| method: "POST", | ||
| path: "/verify_email", | ||
| ...opts, | ||
| }); | ||
| }, | ||
| findEmail(opts = {}) { | ||
| return this._makeRequest({ | ||
| method: "POST", | ||
| path: "/find_email", | ||
| ...opts, | ||
| }); | ||
| }, | ||
| }, | ||
| }; | ||
| }; |
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,6 +1,6 @@ | ||
| { | ||
| "name": "@pipedream/nioleads", | ||
| "version": "0.0.1", | ||
| "version": "0.1.0", | ||
| "description": "Pipedream NioLeads Components", | ||
| "main": "nioleads.app.mjs", | ||
| "keywords": [ | ||
|
|
@@ -11,5 +11,8 @@ | |
| "author": "Pipedream <[email protected]> (https://pipedream.com/)", | ||
| "publishConfig": { | ||
| "access": "public" | ||
| }, | ||
| "dependencies": { | ||
| "@pipedream/platform": "^3.0.1" | ||
| } | ||
| } | ||
| } | ||
63 changes: 63 additions & 0 deletions
63
components/nioleads/sources/new-contact-added/new-contact-added.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,63 @@ | ||
| import nioleads from "../../nioleads.app.mjs"; | ||
| import { DEFAULT_POLLING_SOURCE_TIMER_INTERVAL } from "@pipedream/platform"; | ||
| import sampleEmit from "./test-event.mjs"; | ||
|
|
||
| export default { | ||
| key: "nioleads-new-contact-added", | ||
| name: "New Contact Added", | ||
| description: "Emit new event when a new contact is added. [See the documentation](https://apidoc.nioleads.com/?_gl=1*1288vdg*_ga*MTY1NzE1MjMzOC4xNzI1OTM5Njk1*_ga_ZVT2YHDDZG*MTcyNTk0Mzk5NC4yLjAuMTcyNTk0NDAyMy4wLjAuMA..#contacts)", | ||
| version: "0.0.1", | ||
| type: "source", | ||
| dedupe: "unique", | ||
| props: { | ||
| nioleads, | ||
| db: "$.service.db", | ||
| timer: { | ||
| type: "$.interface.timer", | ||
| default: { | ||
| intervalSeconds: DEFAULT_POLLING_SOURCE_TIMER_INTERVAL, | ||
| }, | ||
| }, | ||
| }, | ||
| hooks: { | ||
| async deploy() { | ||
| await this.processEvent(25); | ||
| }, | ||
| }, | ||
| methods: { | ||
| _getLastId() { | ||
| return this.db.get("lastId") || 0; | ||
| }, | ||
| _setLastId(lastId) { | ||
| this.db.set("lastId", lastId); | ||
| }, | ||
| generateMeta(contact) { | ||
| return { | ||
| id: contact.id, | ||
| summary: `New Contact: ${contact.name}`, | ||
| ts: Date.now(), | ||
| }; | ||
| }, | ||
| async processEvent(limit) { | ||
| const lastId = this._getLastId(); | ||
| const contacts = await this.nioleads.listContacts(); | ||
| if (!contacts?.length) { | ||
| return; | ||
| } | ||
| const newContacts = contacts.filter(({ id }) => id > lastId); | ||
| if (limit && newContacts.length > limit) { | ||
| newContacts.length = limit; | ||
| } | ||
| this._setLastId(newContacts[0].id); | ||
| newContacts.reverse().forEach((contact) => { | ||
| const meta = this.generateMeta(contact); | ||
| this.$emit(contact, meta); | ||
| }); | ||
|
|
||
| }, | ||
| }, | ||
| async run() { | ||
| await this.processEvent(); | ||
| }, | ||
| sampleEmit, | ||
| }; |
20 changes: 20 additions & 0 deletions
20
components/nioleads/sources/new-contact-added/test-event.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,20 @@ | ||
| export default { | ||
| "id": 1, | ||
| "name": "Tom ********", | ||
| "company": "All We Have Is Now", | ||
| "domain": "allwehaveisnow.co", | ||
| "job_title": "Keynote Speaker", | ||
| "email": "********@allwehaveisnow.co", | ||
| "linkedin_url": "http://www.linkedin.com/in/tomfgoodwin", | ||
| "first_name": "Tom", | ||
| "last_name": "********", | ||
| "city": "New York", | ||
| "region": "New York", | ||
| "country": "United States", | ||
| "industry": "management consulting", | ||
| "company_city": "New York", | ||
| "company_region": "New York", | ||
| "company_country": "United States", | ||
| "company_linkedin_url": "http://www.linkedin.com/company/all-we-have-is-now", | ||
| "list": "Default list" | ||
| } |
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.