Skip to content

Commit 75ff31f

Browse files
authored
Merging pull request #17014
* [Components] prospeo #16975 Actions - Find Email - Find Mobile Number - Extract Data - Domain Search - Verify Email * pnpm update
1 parent 0184878 commit 75ff31f

File tree

9 files changed

+316
-8
lines changed

9 files changed

+316
-8
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import { ConfigurationError } from "@pipedream/platform";
2+
import prospeo from "../../prospeo.app.mjs";
3+
4+
export default {
5+
name: "Extract Data",
6+
version: "0.0.1",
7+
key: "prospeo-extract-data",
8+
description: "Extract data from any LinkedIn profile in real-time, as well as all the data from the company page, and also find a valid verified email from the lead. [See the documentation](https://prospeo.io/api/social-url-enrichment)",
9+
type: "action",
10+
props: {
11+
prospeo,
12+
linkedinUrl: {
13+
type: "string",
14+
label: "LinkedIn URL",
15+
description: "The LinkedIn profile URL.This endpoint is only compatible with public LinkedIn URL, and will not work with special IDs starting in `ACw..`, or `ACo...`",
16+
},
17+
profileOnly: {
18+
type: "boolean",
19+
label: "Profile Only",
20+
description: "If true, only the profile data will be returned. If false, the company data will also be returned.",
21+
optional: true,
22+
},
23+
},
24+
async run({ $ }) {
25+
try {
26+
const response = await this.prospeo.extractData({
27+
$,
28+
data: {
29+
url: this.linkedinUrl,
30+
profile_only: this.profileOnly,
31+
},
32+
});
33+
34+
$.export("$summary", `Successfully extracted data for **${this.linkedinUrl}**`);
35+
36+
return response;
37+
} catch ({ response }) {
38+
if (response.data.message === "NO_RESULT") {
39+
$.export("$summary", `No data found for **${this.linkedinUrl}**`);
40+
return {};
41+
} else {
42+
throw new ConfigurationError(response.data.message);
43+
}
44+
}
45+
},
46+
};
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import { ConfigurationError } from "@pipedream/platform";
2+
import prospeo from "../../prospeo.app.mjs";
3+
4+
export default {
5+
name: "Find Email",
6+
version: "0.0.1",
7+
key: "prospeo-find-email",
8+
description: "Find an email address. [See the documentation](https://prospeo.io/api/email-finder)",
9+
type: "action",
10+
props: {
11+
prospeo,
12+
fullName: {
13+
type: "string",
14+
label: "Full Name",
15+
description: "The person's full name. Prospeo advises you to submit the first and last name for higher accuracy.",
16+
},
17+
company: {
18+
type: "string",
19+
label: "Company Domain/Name",
20+
description: "The company domain, website, or name. Using a domain or website is recommended for better accuracy. If submitting a company name, it needs to be between 3 to 75 characters.",
21+
},
22+
},
23+
async run({ $ }) {
24+
try {
25+
const response = await this.prospeo.findEmail({
26+
$,
27+
data: {
28+
company: this.company,
29+
full_name: this.fullName,
30+
},
31+
});
32+
33+
$.export("$summary", `Successfully found email for **${this.fullName}** at **${this.company}**`);
34+
35+
return response;
36+
} catch ({ response }) {
37+
if (response.data.message === "NO_RESULT") {
38+
$.export("$summary", `No results found for **${this.fullName}** at ${this.company}`);
39+
return {};
40+
} else {
41+
throw new ConfigurationError(response.data);
42+
}
43+
}
44+
},
45+
};
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import { ConfigurationError } from "@pipedream/platform";
2+
import prospeo from "../../prospeo.app.mjs";
3+
4+
export default {
5+
name: "Find Mobile Number",
6+
version: "0.0.1",
7+
key: "prospeo-find-mobile-number",
8+
description: "Discover mobile numbers associated with a LinkedIn profile URL. [See the documentation](https://prospeo.io/api/mobile-finder)",
9+
type: "action",
10+
props: {
11+
prospeo,
12+
linkedinUrl: {
13+
type: "string",
14+
label: "LinkedIn URL",
15+
description: "The LinkedIn profile URL.This endpoint is only compatible with public LinkedIn URL, and will not work with special IDs starting in `ACw..`, or `ACo...`",
16+
},
17+
},
18+
async run({ $ }) {
19+
try {
20+
const response = await this.prospeo.findMobile({
21+
$,
22+
data: {
23+
url: this.linkedinUrl,
24+
},
25+
});
26+
27+
$.export("$summary", `Successfully found mobile number for **${this.linkedinUrl}**`);
28+
29+
return response;
30+
} catch ({ response }) {
31+
if (response.data.message === "NO_RESULT") {
32+
$.export("$summary", `No results found for **${this.linkedinUrl}**`);
33+
return {};
34+
} else {
35+
throw new ConfigurationError(response.data.message);
36+
}
37+
}
38+
},
39+
};
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
import { ConfigurationError } from "@pipedream/platform";
2+
import { EMAIL_TYPE_OPTIONS } from "../../common/constants.mjs";
3+
import prospeo from "../../prospeo.app.mjs";
4+
5+
export default {
6+
name: "Search Domain",
7+
version: "0.0.1",
8+
key: "prospeo-search-domain",
9+
description: "Discover email addresses associated with a domain name, website, or company name. [See the documentation](https://prospeo.io/api/domain-search)",
10+
type: "action",
11+
props: {
12+
prospeo,
13+
company: {
14+
type: "string",
15+
label: "Company Domain/Name",
16+
description: "The company domain, website, or name. Using a domain or website is recommended for better accuracy. If submitting a company name, it needs to be between 3 to 75 characters.",
17+
},
18+
limit: {
19+
type: "integer",
20+
label: "Limit",
21+
description: "How many emails you need. The default value is `50`. You will be charged 1 credit every 50 emails. For example, 35 emails will be charged 1 credit while 65 emails will be charged 2 credits.",
22+
optional: true,
23+
},
24+
emailType: {
25+
type: "string",
26+
label: "Email Type",
27+
description: "Indicates what type of email you want to get. `generic` refers to role-based emails such as `[email protected]`, while `professional` are emails of people working at the company.",
28+
options: EMAIL_TYPE_OPTIONS,
29+
optional: true,
30+
},
31+
companyEnrichment: {
32+
type: "boolean",
33+
label: "Company Enrichment",
34+
description: "Indicates if you want the company details in the response. It is `false` by default. Turning it to `true` might slow-down the response time as we gather the company details.",
35+
},
36+
},
37+
async run({ $ }) {
38+
try {
39+
const response = await this.prospeo.searchDomain({
40+
$,
41+
data: {
42+
company: this.company,
43+
limit: this.limit,
44+
email_type: this.emailType,
45+
enrich_company: this.companyEnrichment,
46+
},
47+
});
48+
49+
$.export("$summary", `Successfully searched domain: ${this.company}`);
50+
51+
return response;
52+
} catch ({ response }) {
53+
if (response.data.message === "NO_RESULT") {
54+
$.export("$summary", `No results found for **${this.company}**`);
55+
return {};
56+
} else {
57+
throw new ConfigurationError(response.data.message);
58+
}
59+
}
60+
},
61+
};
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import { ConfigurationError } from "@pipedream/platform";
2+
import prospeo from "../../prospeo.app.mjs";
3+
4+
export default {
5+
name: "Verify Email",
6+
version: "0.0.1",
7+
key: "prospeo-verify-email",
8+
description: "Verify the validity of an email address. [See the documentation](https://prospeo.io/api/email-verifier)",
9+
type: "action",
10+
props: {
11+
prospeo,
12+
email: {
13+
type: "string",
14+
label: "Email",
15+
description: "The email address to verify",
16+
optional: true,
17+
},
18+
emailAnonId: {
19+
type: "string",
20+
label: "Email Anon ID",
21+
description: "The ID of the email obtained from the `Search Domain` action.",
22+
optional: true,
23+
},
24+
},
25+
async run({ $ }) {
26+
if (!this.email && !this.emailAnonId) {
27+
throw new ConfigurationError("Either email or emailAnonId is required");
28+
}
29+
try {
30+
const response = await this.prospeo.verifyEmail({
31+
$,
32+
data: {
33+
email: this.email,
34+
email_anon_id: this.emailAnonId,
35+
},
36+
});
37+
38+
$.export("$summary", `Successfully verified: ${this.email || this.emailAnonId}`);
39+
40+
return response;
41+
} catch ({ response }) {
42+
if (response.data.message === "NO_RESULT") {
43+
$.export("$summary", `No results found for **${this.email || this.emailAnonId}**`);
44+
return {};
45+
} else {
46+
throw new ConfigurationError(response.data.message);
47+
}
48+
}
49+
},
50+
};
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
export const EMAIL_TYPE_OPTIONS = [
2+
{
3+
label: "Generic",
4+
value: "generic",
5+
},
6+
{
7+
label: "Professional",
8+
value: "professional",
9+
},
10+
];

components/prospeo/package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/prospeo",
3-
"version": "0.0.1",
3+
"version": "0.1.0",
44
"description": "Pipedream Prospeo Components",
55
"main": "prospeo.app.mjs",
66
"keywords": [
@@ -9,7 +9,10 @@
99
],
1010
"homepage": "https://pipedream.com/apps/prospeo",
1111
"author": "Pipedream <[email protected]> (https://pipedream.com/)",
12+
"dependencies": {
13+
"@pipedream/platform": "^3.0.3"
14+
},
1215
"publishConfig": {
1316
"access": "public"
1417
}
15-
}
18+
}

components/prospeo/prospeo.app.mjs

Lines changed: 55 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,61 @@
1+
import { axios } from "@pipedream/platform";
2+
13
export default {
24
type: "app",
35
app: "prospeo",
4-
propDefinitions: {},
56
methods: {
6-
// this.$auth contains connected account data
7-
authKeys() {
8-
console.log(Object.keys(this.$auth));
7+
_baseUrl() {
8+
return "https://api.prospeo.io";
9+
},
10+
_headers() {
11+
return {
12+
"x-key": `${this.$auth.api_key}`,
13+
"Content-Type": "application/json",
14+
};
15+
},
16+
_makeRequest({
17+
$ = this, path, ...opts
18+
}) {
19+
return axios($, {
20+
url: this._baseUrl() + path,
21+
headers: this._headers(),
22+
...opts,
23+
});
24+
},
25+
findEmail(args = {}) {
26+
return this._makeRequest({
27+
method: "POST",
28+
path: "/email-finder",
29+
...args,
30+
});
31+
},
32+
findMobile(args = {}) {
33+
return this._makeRequest({
34+
method: "POST",
35+
path: "/mobile-finder",
36+
...args,
37+
});
38+
},
39+
extractData(args = {}) {
40+
return this._makeRequest({
41+
method: "POST",
42+
path: "/social-url-enrichment",
43+
...args,
44+
});
45+
},
46+
searchDomain(args = {}) {
47+
return this._makeRequest({
48+
method: "POST",
49+
path: "/domain-search",
50+
...args,
51+
});
52+
},
53+
verifyEmail(args = {}) {
54+
return this._makeRequest({
55+
method: "POST",
56+
path: "/email-verifier",
57+
...args,
58+
});
959
},
1060
},
11-
};
61+
};

pnpm-lock.yaml

Lines changed: 5 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)