diff --git a/components/exact_mails/actions/common/base.mjs b/components/exact_mails/actions/common/base.mjs new file mode 100644 index 0000000000000..1341d77f619bb --- /dev/null +++ b/components/exact_mails/actions/common/base.mjs @@ -0,0 +1,17 @@ +import exactMails from "../../exact_mails.app.mjs"; + +export default { + props: { + exactMails, + }, + async run({ $ }) { + const fn = this.getFn(); + const response = await fn({ + $, + data: this.getData(), + }); + + $.export("$summary", response.message); + return response; + }, +}; diff --git a/components/exact_mails/actions/search-company-email/search-company-email.mjs b/components/exact_mails/actions/search-company-email/search-company-email.mjs new file mode 100644 index 0000000000000..820a70301c859 --- /dev/null +++ b/components/exact_mails/actions/search-company-email/search-company-email.mjs @@ -0,0 +1,28 @@ +import base from "../common/base.mjs"; + +export default { + ...base, + key: "exact_mails-search-company-email", + name: "Search Company Email", + description: "Search for company email in Exact Mails. [See the documentation](https://dashboard.exactmails.com/documentation)", + version: "0.0.1", + type: "action", + props: { + ...base.props, + companyDomain: { + type: "string", + label: "Company Domain", + description: "The company domain of the company to search for.", + }, + }, + methods: { + getFn() { + return this.exactMails.searchCompanyEmail; + }, + getData() { + return { + company_domain: this.companyDomain, + }; + }, + }, +}; diff --git a/components/exact_mails/actions/search-decision-maker-email/search-decision-maker-email.mjs b/components/exact_mails/actions/search-decision-maker-email/search-decision-maker-email.mjs new file mode 100644 index 0000000000000..7d038eeb36b9a --- /dev/null +++ b/components/exact_mails/actions/search-decision-maker-email/search-decision-maker-email.mjs @@ -0,0 +1,35 @@ +import base from "../common/base.mjs"; + +export default { + ...base, + key: "exact_mails-search-decision-maker-email", + name: "Search Decision Maker Email", + description: "Search for decision maker email in Exact Mails. [See the documentation](https://dashboard.exactmails.com/documentation)", + version: "0.0.1", + type: "action", + props: { + ...base.props, + companyDomain: { + type: "string", + label: "Company Domain", + description: "The company domain of the decision maker to search for.", + }, + role: { + type: "string", + label: "Role", + description: "The role of the decision maker to search for.", + optional: true, + }, + }, + methods: { + getFn() { + return this.exactMails.searchDecisionMakerEmail; + }, + getData() { + return { + company_domain: this.companyDomain, + role: this.role, + }; + }, + }, +}; diff --git a/components/exact_mails/actions/search-linkedin-email/search-linkedin-email.mjs b/components/exact_mails/actions/search-linkedin-email/search-linkedin-email.mjs new file mode 100644 index 0000000000000..549d81544c430 --- /dev/null +++ b/components/exact_mails/actions/search-linkedin-email/search-linkedin-email.mjs @@ -0,0 +1,28 @@ +import base from "../common/base.mjs"; + +export default { + ...base, + key: "exact_mails-search-linkedin-email", + name: "Search LinkedIn Email", + description: "Search for linkedin email in Exact Mails. [See the documentation](https://dashboard.exactmails.com/documentation)", + version: "0.0.1", + type: "action", + props: { + ...base.props, + linkedin: { + type: "string", + label: "LinkedIn Profile", + description: "The linkedin profile of the person to search for.", + }, + }, + methods: { + getFn() { + return this.exactMails.searchLinkedinEmail; + }, + getData() { + return { + linkedin_url: this.linkedin, + }; + }, + }, +}; diff --git a/components/exact_mails/actions/search-person-email/search-person-email.mjs b/components/exact_mails/actions/search-person-email/search-person-email.mjs new file mode 100644 index 0000000000000..b8feaa88db060 --- /dev/null +++ b/components/exact_mails/actions/search-person-email/search-person-email.mjs @@ -0,0 +1,35 @@ +import base from "../common/base.mjs"; + +export default { + ...base, + key: "exact_mails-search-person-email", + name: "Search Person Email", + description: "Search for person email in Exact Mails. [See the documentation](https://dashboard.exactmails.com/documentation)", + version: "0.0.1", + type: "action", + props: { + ...base.props, + username: { + type: "string", + label: "Username", + description: "The username of the person to search for.", + }, + domain: { + type: "string", + label: "Domain", + description: "The domain of the person to search for.", + optional: true, + }, + }, + methods: { + getFn() { + return this.exactMails.searchPersonEmails; + }, + getData() { + return { + username: this.username, + domain: this.domain, + }; + }, + }, +}; diff --git a/components/exact_mails/exact_mails.app.mjs b/components/exact_mails/exact_mails.app.mjs index d62c77a842734..97832bdb71e65 100644 --- a/components/exact_mails/exact_mails.app.mjs +++ b/components/exact_mails/exact_mails.app.mjs @@ -1,11 +1,55 @@ +import { axios } from "@pipedream/platform"; + export default { type: "app", app: "exact_mails", propDefinitions: {}, methods: { - // this.$auth contains connected account data - authKeys() { - console.log(Object.keys(this.$auth)); + _baseUrl() { + return "https://api.exactmails.com/api/v1/email"; + }, + _auth() { + return { + username: `${this.$auth.username}`, + password: `${this.$auth.api_key}`, + }; + }, + _makeRequest({ + $ = this, path, ...opts + }) { + return axios($, { + url: this._baseUrl() + path, + auth: this._auth(), + ...opts, + }); + }, + searchPersonEmails(opts = {}) { + return this._makeRequest({ + method: "POST", + path: "/find-person-email", + ...opts, + }); + }, + searchDecisionMakerEmail(opts = {}) { + return this._makeRequest({ + method: "POST", + path: "/find-decision-maker-email", + ...opts, + }); + }, + searchLinkedinEmail(opts = {}) { + return this._makeRequest({ + method: "POST", + path: "/find-linkedin-email", + ...opts, + }); + }, + searchCompanyEmail(opts = {}) { + return this._makeRequest({ + method: "POST", + path: "/find-company-emails", + ...opts, + }); }, }, }; diff --git a/components/exact_mails/package.json b/components/exact_mails/package.json index de8eea3fe7925..f99bb97c413ce 100644 --- a/components/exact_mails/package.json +++ b/components/exact_mails/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/exact_mails", - "version": "0.0.1", + "version": "0.1.0", "description": "Pipedream Exact Mails Components", "main": "exact_mails.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/pnpm-lock.yaml b/pnpm-lock.yaml index 0e8944ef32c6e..0fd4c95fc45b4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -4073,8 +4073,7 @@ importers: specifier: ^1.5.1 version: 1.6.6 - components/dynamic_content_snippet: - specifiers: {} + components/dynamic_content_snippet: {} components/dynamics_365_business_central_api: dependencies: @@ -4479,7 +4478,11 @@ importers: specifier: ^1.4.1 version: 1.6.6 - components/exact_mails: {} + components/exact_mails: + dependencies: + '@pipedream/platform': + specifier: ^3.1.0 + version: 3.1.0 components/exhibitday: dependencies: