diff --git a/components/all_voice_lab/all_voice_lab.app.mjs b/components/all_voice_lab/all_voice_lab.app.mjs index b36130b7d3888..aeb78641adffd 100644 --- a/components/all_voice_lab/all_voice_lab.app.mjs +++ b/components/all_voice_lab/all_voice_lab.app.mjs @@ -8,4 +8,4 @@ export default { console.log(Object.keys(this.$auth)); }, }, -}; \ No newline at end of file +}; diff --git a/components/google_cloud_document_ai/google_cloud_document_ai.app.mjs b/components/google_cloud_document_ai/google_cloud_document_ai.app.mjs index f983eee719475..ca627abd5e78f 100644 --- a/components/google_cloud_document_ai/google_cloud_document_ai.app.mjs +++ b/components/google_cloud_document_ai/google_cloud_document_ai.app.mjs @@ -8,4 +8,4 @@ export default { console.log(Object.keys(this.$auth)); }, }, -}; \ No newline at end of file +}; diff --git a/components/heylibby/heylibby.app.mjs b/components/heylibby/heylibby.app.mjs index e7c464e6320c1..2578ea65fcea3 100644 --- a/components/heylibby/heylibby.app.mjs +++ b/components/heylibby/heylibby.app.mjs @@ -8,4 +8,4 @@ export default { console.log(Object.keys(this.$auth)); }, }, -}; \ No newline at end of file +}; diff --git a/components/heyreach/heyreach.app.mjs b/components/heyreach/heyreach.app.mjs index abfd825c75916..d8790f3a9c105 100644 --- a/components/heyreach/heyreach.app.mjs +++ b/components/heyreach/heyreach.app.mjs @@ -8,4 +8,4 @@ export default { console.log(Object.keys(this.$auth)); }, }, -}; \ No newline at end of file +}; diff --git a/components/neetocal/neetocal.app.mjs b/components/neetocal/neetocal.app.mjs index 56fada3732086..3feef768e101c 100644 --- a/components/neetocal/neetocal.app.mjs +++ b/components/neetocal/neetocal.app.mjs @@ -8,4 +8,4 @@ export default { console.log(Object.keys(this.$auth)); }, }, -}; \ No newline at end of file +}; diff --git a/components/neetodesk/neetodesk.app.mjs b/components/neetodesk/neetodesk.app.mjs index c899e4fccf7be..f8e250e4e2160 100644 --- a/components/neetodesk/neetodesk.app.mjs +++ b/components/neetodesk/neetodesk.app.mjs @@ -8,4 +8,4 @@ export default { console.log(Object.keys(this.$auth)); }, }, -}; \ No newline at end of file +}; diff --git a/components/nextlead/actions/search-leads/search-leads.mjs b/components/nextlead/actions/search-leads/search-leads.mjs new file mode 100644 index 0000000000000..362a91851487b --- /dev/null +++ b/components/nextlead/actions/search-leads/search-leads.mjs @@ -0,0 +1,29 @@ +import nextlead from "../../nextlead.app.mjs"; + +export default { + key: "nextlead-search-leads", + name: "Search Leads", + description: "Search for leads by email in NextLead. [See the documentation](https://dashboard.nextlead.app/en/api-documentation#find)", + version: "0.0.1", + type: "action", + props: { + nextlead, + email: { + type: "string", + label: "Email", + description: "The email address to search for", + }, + }, + async run({ $ }) { + const response = await this.nextlead.searchLeads({ + $, + data: { + email: this.email, + }, + }); + $.export("$summary", `Found ${response.length && response[0].found + ? response.length + : 0} lead(s) for email: ${this.email}`); + return response; + }, +}; diff --git a/components/nextlead/nextlead.app.mjs b/components/nextlead/nextlead.app.mjs index 4249bb9464308..0f0e033a66299 100644 --- a/components/nextlead/nextlead.app.mjs +++ b/components/nextlead/nextlead.app.mjs @@ -1,11 +1,48 @@ +import { axios } from "@pipedream/platform"; + export default { type: "app", app: "nextlead", propDefinitions: {}, methods: { - // this.$auth contains connected account data - authKeys() { - console.log(Object.keys(this.$auth)); + _baseUrl() { + return this.$auth.api_url; + }, + _makeRequest({ + $ = this, path, ...opts + }) { + return axios($, { + url: `${this._baseUrl()}${path}`, + headers: { + Authorization: `Bearer ${this.$auth.api_key}`, + }, + ...opts, + }); + }, + searchLeads(opts = {}) { + return this._makeRequest({ + path: "/receive/contact/find-contact", + method: "POST", + ...opts, + }); + }, + getNewlyCreatedLeads(opts = {}) { + return this._makeRequest({ + path: "/polling/contact/user-created", + ...opts, + }); + }, + getNewlyUpdatedLeads(opts = {}) { + return this._makeRequest({ + path: "/polling/contact/user-edited", + ...opts, + }); + }, + getContactsAddedToList(opts = {}) { + return this._makeRequest({ + path: "/polling/email/added-to-list", + ...opts, + }); }, }, }; diff --git a/components/nextlead/package.json b/components/nextlead/package.json index 2e7e231641bc7..a5adc6c486868 100644 --- a/components/nextlead/package.json +++ b/components/nextlead/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/nextlead", - "version": "0.0.1", + "version": "0.1.0", "description": "Pipedream Nextlead Components", "main": "nextlead.app.mjs", "keywords": [ @@ -11,5 +11,8 @@ "author": "Pipedream (https://pipedream.com/)", "publishConfig": { "access": "public" + }, + "dependencies": { + "@pipedream/platform": "^3.0.3" } -} \ No newline at end of file +} diff --git a/components/nextlead/sources/common/base.mjs b/components/nextlead/sources/common/base.mjs new file mode 100644 index 0000000000000..e09ae7d0d1519 --- /dev/null +++ b/components/nextlead/sources/common/base.mjs @@ -0,0 +1,14 @@ +import nextlead from "../../nextlead.app.mjs"; +import { DEFAULT_POLLING_SOURCE_TIMER_INTERVAL } from "@pipedream/platform"; + +export default { + props: { + nextlead, + timer: { + type: "$.interface.timer", + default: { + intervalSeconds: DEFAULT_POLLING_SOURCE_TIMER_INTERVAL, + }, + }, + }, +}; diff --git a/components/nextlead/sources/new-lead-added-to-list/new-lead-added-to-list.mjs b/components/nextlead/sources/new-lead-added-to-list/new-lead-added-to-list.mjs new file mode 100644 index 0000000000000..fbbc3d0cbf565 --- /dev/null +++ b/components/nextlead/sources/new-lead-added-to-list/new-lead-added-to-list.mjs @@ -0,0 +1,29 @@ +import common from "../common/base.mjs"; +import sampleEmit from "./test-event.mjs"; + +export default { + ...common, + key: "nextlead-new-lead-added-to-list", + name: "New Lead Added to List", + description: "Emit new event when a lead is added to a list in NextLead. [See the documentation](https://dashboard.nextlead.app/en/api-documentation#addedToList)", + version: "0.0.1", + type: "source", + dedupe: "unique", + methods: { + generateMeta(lead) { + return { + id: lead.id, + summary: "Lead Added to List", + ts: Date.parse(lead.result.created_at), + }; + }, + }, + async run() { + const leads = await this.nextlead.getContactsAddedToList(); + for (const lead of leads) { + const meta = this.generateMeta(lead); + this.$emit(lead, meta); + } + }, + sampleEmit, +}; diff --git a/components/nextlead/sources/new-lead-added-to-list/test-event.mjs b/components/nextlead/sources/new-lead-added-to-list/test-event.mjs new file mode 100644 index 0000000000000..d0808f56db680 --- /dev/null +++ b/components/nextlead/sources/new-lead-added-to-list/test-event.mjs @@ -0,0 +1,16 @@ +export default { + "id": "cmay8b4jx0001ky04yb204e5b", + "result": { + "created_at": "2025-05-21T17:40:39.501Z", + "organization_id": "cmay3tgaa0002jr04l5tga7my", + "email": null, + "first_name": "Jane", + "last_name": "Doe", + "phone": null, + "address": null, + "civility": "NEUTRAL", + "status": null, + "opt_in_marketing": true, + "opt_in_newsletter": true + } + } \ No newline at end of file diff --git a/components/nextlead/sources/new-lead-created/new-lead-created.mjs b/components/nextlead/sources/new-lead-created/new-lead-created.mjs new file mode 100644 index 0000000000000..23189d1f38225 --- /dev/null +++ b/components/nextlead/sources/new-lead-created/new-lead-created.mjs @@ -0,0 +1,29 @@ +import common from "../common/base.mjs"; +import sampleEmit from "./test-event.mjs"; + +export default { + ...common, + key: "nextlead-new-lead-created", + name: "New Lead Created", + description: "Emit new event when a new lead is captured in NextLead. [See the documentation](https://dashboard.nextlead.app/en/api-documentation#created)", + version: "0.0.1", + type: "source", + dedupe: "unique", + methods: { + generateMeta(lead) { + return { + id: lead.id, + summary: "New Lead Created", + ts: Date.now(), + }; + }, + }, + async run() { + const leads = await this.nextlead.getNewlyCreatedLeads(); + for (const lead of leads) { + const meta = this.generateMeta(lead); + this.$emit(lead, meta); + } + }, + sampleEmit, +}; diff --git a/components/nextlead/sources/new-lead-created/test-event.mjs b/components/nextlead/sources/new-lead-created/test-event.mjs new file mode 100644 index 0000000000000..bcf7e15310414 --- /dev/null +++ b/components/nextlead/sources/new-lead-created/test-event.mjs @@ -0,0 +1,19 @@ +export default { + "id": "cmay7x5ou0001k10442mgpngp", + "type": "CLIENT", + "civility": "NEUTRAL", + "first_name": null, + "last_name": null, + "birth_date": null, + "sector": null, + "activity": null, + "status": null, + "conversion_status": null, + "lead_score": null, + "phone": null, + "mobile": null, + "phone_pro": null, + "email": null, + "email2": null, + "email_verified": null + } \ No newline at end of file diff --git a/components/nextlead/sources/new-lead-updated/new-lead-updated.mjs b/components/nextlead/sources/new-lead-updated/new-lead-updated.mjs new file mode 100644 index 0000000000000..3ecf75bf48ae6 --- /dev/null +++ b/components/nextlead/sources/new-lead-updated/new-lead-updated.mjs @@ -0,0 +1,29 @@ +import common from "../common/base.mjs"; +import sampleEmit from "./test-event.mjs"; + +export default { + ...common, + key: "nextlead-new-lead-updated", + name: "New Lead Updated", + description: "Emit new event when a lead is updated in NextLead. [See the documentation](https://dashboard.nextlead.app/en/api-documentation#edited)", + version: "0.0.1", + type: "source", + dedupe: "unique", + methods: { + generateMeta(lead) { + return { + id: lead.id, + summary: "Lead Updated", + ts: Date.now(), + }; + }, + }, + async run() { + const leads = await this.nextlead.getNewlyUpdatedLeads(); + for (const lead of leads) { + const meta = this.generateMeta(lead); + this.$emit(lead, meta); + } + }, + sampleEmit, +}; diff --git a/components/nextlead/sources/new-lead-updated/test-event.mjs b/components/nextlead/sources/new-lead-updated/test-event.mjs new file mode 100644 index 0000000000000..eb505e2641f41 --- /dev/null +++ b/components/nextlead/sources/new-lead-updated/test-event.mjs @@ -0,0 +1,19 @@ +export default { + "id": "cmay7zwqw000fib046wynimr1", + "type": "CLIENT", + "civility": "NEUTRAL", + "first_name": "Jane", + "last_name": "Doe", + "birth_date": null, + "sector": null, + "activity": null, + "status": null, + "conversion_status": null, + "lead_score": null, + "phone": null, + "mobile": null, + "phone_pro": null, + "email": null, + "email2": null, + "email_verified": null + } \ No newline at end of file diff --git a/components/scrapecreators/scrapecreators.app.mjs b/components/scrapecreators/scrapecreators.app.mjs index 6a78a552c873c..b4ae4ca84cff8 100644 --- a/components/scrapecreators/scrapecreators.app.mjs +++ b/components/scrapecreators/scrapecreators.app.mjs @@ -8,4 +8,4 @@ export default { console.log(Object.keys(this.$auth)); }, }, -}; \ No newline at end of file +}; diff --git a/components/test_apps_for_checking_something_009/test_apps_for_checking_something_009.app.mjs b/components/test_apps_for_checking_something_009/test_apps_for_checking_something_009.app.mjs index 972ecc24858ea..82b59bb64bd2e 100644 --- a/components/test_apps_for_checking_something_009/test_apps_for_checking_something_009.app.mjs +++ b/components/test_apps_for_checking_something_009/test_apps_for_checking_something_009.app.mjs @@ -8,4 +8,4 @@ export default { console.log(Object.keys(this.$auth)); }, }, -}; \ No newline at end of file +}; diff --git a/components/test_apps_for_checking_something_010/test_apps_for_checking_something_010.app.mjs b/components/test_apps_for_checking_something_010/test_apps_for_checking_something_010.app.mjs index 1e668bad4abff..b184643b31867 100644 --- a/components/test_apps_for_checking_something_010/test_apps_for_checking_something_010.app.mjs +++ b/components/test_apps_for_checking_something_010/test_apps_for_checking_something_010.app.mjs @@ -8,4 +8,4 @@ export default { console.log(Object.keys(this.$auth)); }, }, -}; \ No newline at end of file +}; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2098e50eddf11..04842669c8cd6 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -5445,8 +5445,7 @@ importers: specifier: ^8.3.2 version: 8.3.2 - components/google_cloud_document_ai: - specifiers: {} + components/google_cloud_document_ai: {} components/google_cloud_translate: {} @@ -8710,7 +8709,11 @@ importers: specifier: ^3.0.3 version: 3.0.3 - components/nextlead: {} + components/nextlead: + dependencies: + '@pipedream/platform': + specifier: ^3.0.3 + version: 3.0.3 components/nexudus: {} @@ -13230,11 +13233,9 @@ importers: components/test_apps_for_checking_something_006: {} - components/test_apps_for_checking_something_009: - specifiers: {} + components/test_apps_for_checking_something_009: {} - components/test_apps_for_checking_something_010: - specifiers: {} + components/test_apps_for_checking_something_010: {} components/test_apps_for_switching_appslug_009: {}