From 89ea57104537ed9cbe0d7aeb2f0881e044c09d06 Mon Sep 17 00:00:00 2001 From: Michelle Bergeron Date: Mon, 14 Jul 2025 15:02:33 -0400 Subject: [PATCH 1/2] new components --- .../enrich-business/enrich-business.mjs | 35 +++++ .../enrich-prospect/enrich-prospect.mjs | 35 +++++ .../fetch-businesses/fetch-businesses.mjs | 85 +++++++++++ .../fetch-prospects/fetch-prospects.mjs | 99 ++++++++++++ .../match-business-id/match-business-id.mjs | 37 +++++ .../match-prospect-id/match-prospect-id.mjs | 31 ++++ components/explorium/common/constants.mjs | 142 ++++++++++++++++++ components/explorium/explorium.app.mjs | 126 +++++++++++++++- components/explorium/package.json | 7 +- components/explorium/sources/common/base.mjs | 65 ++++++++ .../new-business-event/new-business-event.mjs | 39 +++++ .../sources/new-business-event/test-event.mjs | 14 ++ .../new-prospect-event/new-prospect-event.mjs | 39 +++++ .../sources/new-prospect-event/test-event.mjs | 10 ++ 14 files changed, 757 insertions(+), 7 deletions(-) create mode 100644 components/explorium/actions/enrich-business/enrich-business.mjs create mode 100644 components/explorium/actions/enrich-prospect/enrich-prospect.mjs create mode 100644 components/explorium/actions/fetch-businesses/fetch-businesses.mjs create mode 100644 components/explorium/actions/fetch-prospects/fetch-prospects.mjs create mode 100644 components/explorium/actions/match-business-id/match-business-id.mjs create mode 100644 components/explorium/actions/match-prospect-id/match-prospect-id.mjs create mode 100644 components/explorium/common/constants.mjs create mode 100644 components/explorium/sources/common/base.mjs create mode 100644 components/explorium/sources/new-business-event/new-business-event.mjs create mode 100644 components/explorium/sources/new-business-event/test-event.mjs create mode 100644 components/explorium/sources/new-prospect-event/new-prospect-event.mjs create mode 100644 components/explorium/sources/new-prospect-event/test-event.mjs diff --git a/components/explorium/actions/enrich-business/enrich-business.mjs b/components/explorium/actions/enrich-business/enrich-business.mjs new file mode 100644 index 0000000000000..bc209ac776811 --- /dev/null +++ b/components/explorium/actions/enrich-business/enrich-business.mjs @@ -0,0 +1,35 @@ +import explorium from "../../explorium.app.mjs"; +import constants from "../../common/constants.mjs"; + +export default { + key: "explorium-enrich-business", + name: "Enrich Business", + description: "Enrich business data with comprehensive insights for lead generation, risk assessment, and business intelligence. [See the documentation](https://developers.explorium.ai/reference/businesses_enrichments)", + version: "0.0.1", + type: "action", + props: { + explorium, + type: { + type: "string", + label: "Enrichment Type", + description: "The type of enrichment to perform", + options: constants.BUSINESS_ENRICHMENT_TYPES, + }, + businessId: { + type: "string", + label: "Business ID", + description: "The ID of the business to enrich", + }, + }, + async run({ $ }) { + const { data } = await this.explorium.enrichBusiness({ + $, + type: this.type, + data: { + business_id: this.businessId, + }, + }); + $.export("$summary", `Enriched business ${this.businessId} with ${this.type}`); + return data; + }, +}; diff --git a/components/explorium/actions/enrich-prospect/enrich-prospect.mjs b/components/explorium/actions/enrich-prospect/enrich-prospect.mjs new file mode 100644 index 0000000000000..b1d12e6f82c2f --- /dev/null +++ b/components/explorium/actions/enrich-prospect/enrich-prospect.mjs @@ -0,0 +1,35 @@ +import explorium from "../../explorium.app.mjs"; +import constants from "../../common/constants.mjs"; + +export default { + key: "explorium-enrich-prospect", + name: "Enrich Prospect", + description: "Enrich prospect records with comprehensive professional and contact information to enhance outreach and engagement strategies. [See the documentation](https://developers.explorium.ai/reference/prospects_enrichments)", + version: "0.0.1", + type: "action", + props: { + explorium, + type: { + type: "string", + label: "Enrichment Type", + description: "The type of enrichment to perform", + options: constants.PROSPECT_ENRICHMENT_TYPES, + }, + prospectId: { + type: "string", + label: "Prospect ID", + description: "The ID of the prospect to enrich", + }, + }, + async run({ $ }) { + const { data } = await this.explorium.enrichProspect({ + $, + type: this.type, + data: { + prospect_id: this.prospectId, + }, + }); + $.export("$summary", `Enriched prospect ${this.prospectId} with ${this.type}`); + return data; + }, +}; diff --git a/components/explorium/actions/fetch-businesses/fetch-businesses.mjs b/components/explorium/actions/fetch-businesses/fetch-businesses.mjs new file mode 100644 index 0000000000000..16cb17265b4d6 --- /dev/null +++ b/components/explorium/actions/fetch-businesses/fetch-businesses.mjs @@ -0,0 +1,85 @@ +import explorium from "../../explorium.app.mjs"; + +export default { + key: "explorium-fetch-businesses", + name: "Fetch Businesses", + description: "Fetches business records using filters. [See the documentation](https://developers.explorium.ai/reference/list_businesses)", + version: "0.0.1", + type: "action", + props: { + explorium, + name: { + propDefinition: [ + explorium, + "name", + ], + }, + country: { + propDefinition: [ + explorium, + "country", + ], + }, + size: { + propDefinition: [ + explorium, + "size", + ], + }, + revenue: { + propDefinition: [ + explorium, + "revenue", + ], + }, + websiteKeywords: { + type: "string[]", + label: "Website Keywords", + description: "Filter by website keywords", + optional: true, + }, + }, + async run({ $ }) { + const { data } = await this.explorium.fetchBusinesses({ + $, + data: { + mode: "full", + size: 100, + page_size: 100, + filters: { + company_name: this.name + ? { + values: [ + this.name, + ], + } + : undefined, + country_code: this.country + ? { + values: [ + this.country, + ], + } + : undefined, + company_size: this.size + ? { + values: this.size, + } + : undefined, + company_revenue: this.revenue + ? { + values: this.revenue, + } + : undefined, + website_keywords: this.websiteKeywords + ? { + values: this.websiteKeywords, + } + : undefined, + }, + }, + }); + $.export("$summary", `Fetched ${data.length} businesses`); + return data; + }, +}; diff --git a/components/explorium/actions/fetch-prospects/fetch-prospects.mjs b/components/explorium/actions/fetch-prospects/fetch-prospects.mjs new file mode 100644 index 0000000000000..5a4bfc667de6c --- /dev/null +++ b/components/explorium/actions/fetch-prospects/fetch-prospects.mjs @@ -0,0 +1,99 @@ +import explorium from "../../explorium.app.mjs"; +import constants from "../../common/constants.mjs"; + +export default { + key: "explorium-fetch-prospects", + name: "Fetch Prospects", + description: "Fetches prospect records using filters. [See the documentation](https://developers.explorium.ai/reference/fetch_prospects)", + version: "0.0.1", + type: "action", + props: { + explorium, + name: { + propDefinition: [ + explorium, + "name", + ], + }, + country: { + propDefinition: [ + explorium, + "country", + ], + }, + size: { + propDefinition: [ + explorium, + "size", + ], + }, + revenue: { + propDefinition: [ + explorium, + "revenue", + ], + }, + jobLevel: { + type: "string[]", + label: "Job Level", + description: "Filter by job level", + options: constants.PROSPECT_JOB_LEVELS, + optional: true, + }, + jobDepartment: { + type: "string[]", + label: "Job Department", + description: "Filter by job department", + options: constants.PROSPECT_JOB_DEPARTMENTS, + optional: true, + }, + }, + async run({ $ }) { + const { data } = await this.explorium.fetchProspects({ + $, + data: { + mode: "full", + size: 100, + page_size: 100, + filters: { + company_name: this.name + ? { + values: [ + this.name, + ], + } + : undefined, + country_code: this.country + ? { + values: [ + this.country, + ], + } + : undefined, + company_size: this.size + ? { + values: this.size, + } + : undefined, + company_revenue: this.revenue + ? { + values: this.revenue, + } + : undefined, + job_level: this.jobLevel + ? { + values: this.jobLevel, + } + : undefined, + job_department: this.jobDepartment + ? { + values: this.jobDepartment, + } + : undefined, + }, + }, + }); + $.export("$summary", `Fetched ${data.length} prospects`); + return data; + }, +}; diff --git a/components/explorium/actions/match-business-id/match-business-id.mjs b/components/explorium/actions/match-business-id/match-business-id.mjs new file mode 100644 index 0000000000000..a9e4778e1659a --- /dev/null +++ b/components/explorium/actions/match-business-id/match-business-id.mjs @@ -0,0 +1,37 @@ +import explorium from "../../explorium.app.mjs"; + +export default { + key: "explorium-match-business-id", + name: "Match Business ID", + description: "Match a businesse to its unique identifier using business name and domain. [See the documentation](https://developers.explorium.ai/reference/match_businesses)", + version: "0.0.1", + type: "action", + props: { + explorium, + name: { + type: "string", + label: "Business Name", + description: "The name of the business to match", + }, + domain: { + type: "string", + label: "Domain", + description: "The domain of the business to match", + }, + }, + async run({ $ }) { + const response = await this.explorium.matchBusinessId({ + $, + data: { + businesses_to_match: [ + { + name: this.name, + domain: this.domain, + }, + ], + }, + }); + $.export("$summary", `Matched business ID for ${this.name} (${this.domain})`); + return response; + }, +}; diff --git a/components/explorium/actions/match-prospect-id/match-prospect-id.mjs b/components/explorium/actions/match-prospect-id/match-prospect-id.mjs new file mode 100644 index 0000000000000..47ee1c61b58be --- /dev/null +++ b/components/explorium/actions/match-prospect-id/match-prospect-id.mjs @@ -0,0 +1,31 @@ +import explorium from "../../explorium.app.mjs"; + +export default { + key: "explorium-match-prospect-id", + name: "Match Prospect ID", + description: "Match individual prospects to unique identifiers using email addresses. [See the documentation](https://developers.explorium.ai/reference/match_prospects-1)", + version: "0.0.1", + type: "action", + props: { + explorium, + email: { + type: "string", + label: "Email", + description: "The email address of the prospect to match", + }, + }, + async run({ $ }) { + const response = await this.explorium.matchProspectId({ + $, + data: { + prospects_to_match: [ + { + email: this.email, + }, + ], + }, + }); + $.export("$summary", `Matched prospect ID for ${this.email}`); + return response; + }, +}; diff --git a/components/explorium/common/constants.mjs b/components/explorium/common/constants.mjs new file mode 100644 index 0000000000000..b65fc31ac44c8 --- /dev/null +++ b/components/explorium/common/constants.mjs @@ -0,0 +1,142 @@ +const COMPANY_SIZE_RANGES = [ + "1-10", + "11-50", + "51-200", + "201-500", + "501-1000", + "1001-5000", + "5001-10000", + "10001+", +]; + +const COMPANY_REVENUE_RANGES = [ + "0-500K", + "500K-1M", + "1M-5M", + "5M-10M", + "10M-25M", + "25M-75M", + "75M-200M", + "200M-500M", + "500M-1B", + "1B-10B", + "10B-100B", + "100B-1T", + "1T-10T", + "10T+", +]; + +const PROSPECT_JOB_LEVELS = [ + "owner", + "cxo", + "vp", + "director", + "senior", + "manager", + "partner", + "non-managerial", + "entry", + "training", + "unpaid", + "unknown", +]; + +const PROSPECT_JOB_DEPARTMENTS = [ + "Real estate", + "Customer service", + "Trades", + "Unknown", + "Public relations", + "Legal", + "Operations", + "Media", + "Sales", + "Marketing", + "Finance", + "Engineering", + "Education", + "General", + "Health", + "Design", + "Human resources", +]; + +const BUSINESS_ENRICHMENT_TYPES = [ + "firmographics", + "technographics", + "linkedin_posts", + "company_ratings_by_employees", + "company_website_keywords", + "financial_indicators", + "funding_and_acquisition", + "pc_business_challenges_10k", + "pc_competitive_landscape_10k", + "pc_strategy_10k", + "website_changes", + "workforce_trends", +]; + +const PROSPECT_ENRICHMENT_TYPES = [ + "contacts_information", + "linkedin_posts", + "profiles", +]; + +const BUSINESS_EVENT_TYPES = [ + "ipo_announcement", + "new_funding_round", + "new_investment", + "new_product", + "new_office", + "closing_office", + "new_partnership", + "increase_in_engineering_department", + "increase_in_sales_department", + "increase_in_marketing_department", + "increase_in_operations_department", + "increase_in_customer_service_department", + "increase_in_all_departments", + "decrease_in_engineering_department", + "decrease_in_sales_department", + "decrease_in_marketing_department", + "decrease_in_operations_department", + "decrease_in_customer_service_department", + "decrease_in_all_departments", + "employee_joined_company", + "hiring_in_creative_department", + "hiring_in_education_department", + "hiring_in_engineering_department", + "hiring_in_finance_department", + "hiring_in_health_department", + "hiring_in_human_resources_department", + "hiring_in_legal_department", + "hiring_in_marketing_department", + "hiring_in_operations_department", + "hiring_in_professional_service_department", + "hiring_in_sales_department", + "hiring_in_support_department", + "hiring_in_trade_department", + "hiring_in_unknown_department", + "company_award", + "outages_and_security_breaches", + "cost_cutting", + "merger_and_acquisitions", + "lawsuits_and_legal_issues", +]; + +const PROSPECT_EVENT_TYPES = [ + "prospect_changed_role", + "prospect_changed_company", + "prospect_job_start_anniversary", +]; + +export default { + COMPANY_SIZE_RANGES, + COMPANY_REVENUE_RANGES, + PROSPECT_JOB_LEVELS, + PROSPECT_JOB_DEPARTMENTS, + BUSINESS_ENRICHMENT_TYPES, + PROSPECT_ENRICHMENT_TYPES, + BUSINESS_EVENT_TYPES, + PROSPECT_EVENT_TYPES, +}; diff --git a/components/explorium/explorium.app.mjs b/components/explorium/explorium.app.mjs index 92fbaf841eea0..903a777796f1e 100644 --- a/components/explorium/explorium.app.mjs +++ b/components/explorium/explorium.app.mjs @@ -1,11 +1,127 @@ +import { axios } from "@pipedream/platform"; +import constants from "./common/constants.mjs"; + export default { type: "app", app: "explorium", - propDefinitions: {}, + propDefinitions: { + name: { + type: "string", + label: "Business Name", + description: "Filter by company name", + optional: true, + }, + country: { + type: "string", + label: "Country", + description: "A two-letter country code (ISO Alpha-2 format)", + optional: true, + }, + size: { + type: "string[]", + label: "Size", + description: "Filter by company size range", + options: constants.COMPANY_SIZE_RANGES, + optional: true, + }, + revenue: { + type: "string[]", + label: "Revenue", + description: "Filter by company revenue range", + options: constants.COMPANY_REVENUE_RANGES, + optional: true, + }, + }, methods: { - // this.$auth contains connected account data - authKeys() { - console.log(Object.keys(this.$auth)); + _baseUrl() { + return "https://api.explorium.ai/v1"; + }, + _makeRequest({ + $ = this, path, ...opts + }) { + return axios($, { + url: `${this._baseUrl()}${path}`, + headers: { + api_key: this.$auth.api_key, + }, + ...opts, + }); + }, + createWebhook(opts = {}) { + return this._makeRequest({ + path: "/webhooks", + method: "POST", + ...opts, + }); + }, + deleteWebhook({ + partnerId, ...opts + }) { + return this._makeRequest({ + path: `/webhooks/${partnerId}`, + method: "DELETE", + ...opts, + }); + }, + enrollBusinesses(opts = {}) { + return this._makeRequest({ + path: "/businesses/events/enrollments", + method: "POST", + ...opts, + }); + }, + enrollProspects(opts = {}) { + return this._makeRequest({ + path: "/prospects/enrollments", + method: "POST", + ...opts, + }); + }, + matchBusinessId(opts = {}) { + return this._makeRequest({ + path: "/businesses/match", + method: "POST", + ...opts, + }); + }, + matchProspectId(opts = {}) { + return this._makeRequest({ + path: "/prospects/match", + method: "POST", + ...opts, + }); + }, + fetchBusinesses(opts = {}) { + return this._makeRequest({ + path: "/businesses", + method: "POST", + ...opts, + }); + }, + fetchProspects(opts = {}) { + return this._makeRequest({ + path: "/prospects", + method: "POST", + ...opts, + }); + }, + enrichBusiness({ + type, ...opts + }) { + return this._makeRequest({ + path: `/businesses/${type}/enrich`, + method: "POST", + ...opts, + }); + }, + enrichProspect({ + type, ...opts + }) { + return this._makeRequest({ + path: `/prospects/${type}/enrich`, + method: "POST", + ...opts, + }); }, }, -}; \ No newline at end of file +}; diff --git a/components/explorium/package.json b/components/explorium/package.json index 12e7b447210b6..d070282138f41 100644 --- a/components/explorium/package.json +++ b/components/explorium/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/explorium", - "version": "0.0.1", + "version": "0.1.0", "description": "Pipedream Explorium Components", "main": "explorium.app.mjs", "keywords": [ @@ -11,5 +11,8 @@ "author": "Pipedream (https://pipedream.com/)", "publishConfig": { "access": "public" + }, + "dependencies": { + "@pipedream/platform": "^3.1.0" } -} \ No newline at end of file +} diff --git a/components/explorium/sources/common/base.mjs b/components/explorium/sources/common/base.mjs new file mode 100644 index 0000000000000..e0495dc8ab219 --- /dev/null +++ b/components/explorium/sources/common/base.mjs @@ -0,0 +1,65 @@ +import explorium from "../../explorium.app.mjs"; +import { ConfigurationError } from "@pipedream/platform"; + +export default { + props: { + explorium, + http: "$.interface.http", + partnerId: { + type: "string", + label: "Partner ID", + description: "The ID of the partner to use for webhooks", + }, + enrollmentKey: { + type: "string", + label: "Enrollment Key", + description: "A custom identifier you provide to categorize this set of enrollments", + }, + }, + hooks: { + async activate() { + await this.explorium.createWebhook({ + data: { + partner_id: this.partnerId, + webhook_url: this.http.endpoint, + }, + }); + const data = { + enrollment_key: this.enrollmentKey, + event_types: this.eventTypes, + }; + if (this.businessIds) { + await this.explorium.enrollBusinesses({ + data: { + ...data, + business_ids: this.businessIds, + }, + }); + } else if (this.prospectIds) { + await this.explorium.enrollProspects({ + data: { + ...data, + prospect_ids: this.prospectIds, + }, + }); + } + }, + async deactivate() { + await this.explorium.deleteWebhook({ + partnerId: this.partnerId, + }); + }, + }, + methods: { + generateMeta() { + throw new ConfigurationError("generateMeta must be implemented"); + }, + }, + async run({ body }) { + if (!body) { + return; + } + const meta = this.generateMeta(body); + this.emitEvent(body, meta); + }, +}; diff --git a/components/explorium/sources/new-business-event/new-business-event.mjs b/components/explorium/sources/new-business-event/new-business-event.mjs new file mode 100644 index 0000000000000..d64422f341d7c --- /dev/null +++ b/components/explorium/sources/new-business-event/new-business-event.mjs @@ -0,0 +1,39 @@ +import common from "../common/base.mjs"; +import constants from "../../common/constants.mjs"; +import sampleEmit from "./test-event.mjs"; + +export default { + ...common, + key: "explorium-new-business-event", + name: "New Business Event (Instant)", + description: "Emit new event when a business update occurs. [See the documentation](https://developers.explorium.ai/reference/webhooks)", + version: "0.0.1", + type: "source", + dedupe: "unique", + props: { + ...common.props, + eventTypes: { + type: "string[]", + label: "Event Types", + description: "The types of events to enroll in", + options: constants.BUSINESS_EVENT_TYPES, + }, + businessIds: { + type: "string[]", + label: "Business IDs", + description: "The IDs of the businesses to enroll in the event", + optional: true, + }, + }, + methods: { + ...common.methods, + generateMeta(body) { + return { + id: body.event_id, + summary: `New ${body.event_type} event for business ${body.entity_id}`, + ts: Date.now(), + }; + }, + }, + sampleEmit, +}; diff --git a/components/explorium/sources/new-business-event/test-event.mjs b/components/explorium/sources/new-business-event/test-event.mjs new file mode 100644 index 0000000000000..529b1b17313c3 --- /dev/null +++ b/components/explorium/sources/new-business-event/test-event.mjs @@ -0,0 +1,14 @@ +export default { + "tenant_id": "con_NJEwX2IUhNNbaRDC", + "partner_id": "ExpTest", + "event_id": "event_id_for_company_updates-12345", + "event_type": "new_product", + "entity_id": "340c8040bd50cbab9c7df718bbe51cc9", + "entity_type": "business", + "data": { + "link": "https://www.linkedin.com/posts/explorium-ai_ai-gtm-exploriumagentsource-activity-7310662960643768320-osau", + "product_name": "AgentSource", + "product_description": "Explorium launches AgentSource, a powerful B2B data API suite designed to fuel AI-driven go-to-market strategies" + }, + "enrollment_key": "company_updates_demo" +} \ No newline at end of file diff --git a/components/explorium/sources/new-prospect-event/new-prospect-event.mjs b/components/explorium/sources/new-prospect-event/new-prospect-event.mjs new file mode 100644 index 0000000000000..704fedfeab850 --- /dev/null +++ b/components/explorium/sources/new-prospect-event/new-prospect-event.mjs @@ -0,0 +1,39 @@ +import common from "../common/base.mjs"; +import constants from "../../common/constants.mjs"; +import sampleEmit from "./test-event.mjs"; + +export default { + ...common, + key: "explorium-new-prospect-event", + name: "New Prospect Event (Instant)", + description: "Emit new event when a prospect update occurs. [See the documentation](https://developers.explorium.ai/reference/webhooks)", + version: "0.0.1", + type: "source", + dedupe: "unique", + props: { + ...common.props, + eventTypes: { + type: "string[]", + label: "Event Types", + description: "The types of events to enroll in", + options: constants.PROSPECT_EVENT_TYPES, + }, + prospectIds: { + type: "string[]", + label: "Prospect IDs", + description: "The IDs of the prospects to enroll in the event", + optional: true, + }, + }, + methods: { + ...common.methods, + generateMeta(body) { + return { + id: body.event_id, + summary: `New ${body.event_type} event for prospect ${body.entity_id}`, + ts: Date.now(), + }; + }, + }, + sampleEmit, +}; diff --git a/components/explorium/sources/new-prospect-event/test-event.mjs b/components/explorium/sources/new-prospect-event/test-event.mjs new file mode 100644 index 0000000000000..7238fd6c713a8 --- /dev/null +++ b/components/explorium/sources/new-prospect-event/test-event.mjs @@ -0,0 +1,10 @@ +export default { + "tenant_id": "con_NJEwX2IUhNNbaRDC", + "partner_id": "ExpTest", + "event_id": "event_id_for_prospect_updates-12345", + "event_type": "", + "entity_id": "340c8040bd50cbab9c7df718bbe51cc9", + "entity_type": "prospect", + "data": {}, + "enrollment_key": "prospect_updates_demo" +} \ No newline at end of file From 8b5e451a1147ef1064e079016b09132ea3bf6c9e Mon Sep 17 00:00:00 2001 From: Michelle Bergeron Date: Mon, 14 Jul 2025 15:03:34 -0400 Subject: [PATCH 2/2] pnpm-lock.yaml --- pnpm-lock.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 08c76506dfce3..9a04b5f9c3740 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -4447,7 +4447,11 @@ importers: specifier: ^6.11.0 version: 6.13.1 - components/explorium: {} + components/explorium: + dependencies: + '@pipedream/platform': + specifier: ^3.1.0 + version: 3.1.0 components/expofp: dependencies: