Skip to content

Commit dd4d761

Browse files
authored
New Components - finalscout (#17222)
* new components * pnpm-lock.yaml * update
1 parent b386b1e commit dd4d761

File tree

8 files changed

+312
-23
lines changed

8 files changed

+312
-23
lines changed
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
import finalscout from "../../finalscout.app.mjs";
2+
import { parseObject } from "../../common/utils.mjs";
3+
4+
export default {
5+
key: "finalscout-find-email-linkedin",
6+
name: "Find Email from LinkedIn",
7+
description: "Finds an email address from a LinkedIn profile URL. [See the documentation](https://finalscout.com/public/doc/api.html#tag/Single-Find/paths/~1v1~1find~1linkedin~1single/post)",
8+
version: "0.0.1",
9+
type: "action",
10+
props: {
11+
finalscout,
12+
url: {
13+
type: "string",
14+
label: "LinkedIn Profile URL",
15+
description: "The URL of the LinkedIn profile.",
16+
},
17+
tags: {
18+
propDefinition: [
19+
finalscout,
20+
"tags",
21+
],
22+
},
23+
metadata: {
24+
propDefinition: [
25+
finalscout,
26+
"metadata",
27+
],
28+
},
29+
enablePersonalEmail: {
30+
type: "boolean",
31+
label: "Enable Personal Email",
32+
description: "Whether to find personal emails (e.g. [email protected]) when a professional email address is not found",
33+
optional: true,
34+
},
35+
enableGenericEmail: {
36+
type: "boolean",
37+
label: "Enable Generic Email",
38+
description: "Whether to find generic emails (e.g. [email protected]) when a professional email address is not found",
39+
optional: true,
40+
},
41+
webhookUrl: {
42+
propDefinition: [
43+
finalscout,
44+
"webhookUrl",
45+
],
46+
},
47+
},
48+
async run({ $ }) {
49+
const response = await this.finalscout.findEmailViaLinkedIn({
50+
$,
51+
data: {
52+
person: {
53+
linkedin_url: this.url,
54+
},
55+
tags: this.tags,
56+
metadata: parseObject(this.metadata),
57+
enable_personal_email: this.enablePersonalEmail,
58+
enable_generic_email: this.enableGenericEmail,
59+
webhook_url: this.webhookUrl,
60+
},
61+
});
62+
$.export("$summary", "Successfully requested email for LinkedIn profile.");
63+
return response;
64+
},
65+
};
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import finalscout from "../../finalscout.app.mjs";
2+
import { parseObject } from "../../common/utils.mjs";
3+
4+
export default {
5+
key: "finalscout-find-email-news-article",
6+
name: "Find Email from News Article",
7+
description: "Finds an email address from a news article URL. [See the documentation](https://finalscout.com/public/doc/api.html#tag/Single-Find/paths/~1v1~1find~1author~1single/post)",
8+
version: "0.0.1",
9+
type: "action",
10+
props: {
11+
finalscout,
12+
url: {
13+
type: "string",
14+
label: "News Article URL",
15+
description: "The URL of the news article.",
16+
},
17+
tags: {
18+
propDefinition: [
19+
finalscout,
20+
"tags",
21+
],
22+
},
23+
metadata: {
24+
propDefinition: [
25+
finalscout,
26+
"metadata",
27+
],
28+
},
29+
webhookUrl: {
30+
propDefinition: [
31+
finalscout,
32+
"webhookUrl",
33+
],
34+
},
35+
},
36+
async run({ $ }) {
37+
const response = await this.finalscout.findEmailViaNewsArticle({
38+
$,
39+
data: {
40+
person: {
41+
article_url: this.url,
42+
},
43+
tags: this.tags,
44+
metadata: parseObject(this.metadata),
45+
webhook_url: this.webhookUrl,
46+
},
47+
});
48+
$.export("$summary", "Successfully requested email for news article.");
49+
return response;
50+
},
51+
};
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import finalscout from "../../finalscout.app.mjs";
2+
import { parseObject } from "../../common/utils.mjs";
3+
4+
export default {
5+
key: "finalscout-find-email-professional",
6+
name: "Find Email from Professional",
7+
description: "Finds an email address from a person's name and company/domain. [See the documentation](https://finalscout.com/public/doc/api.html#tag/Single-Find/operation/email_finder_v1_person_email_finder_post)",
8+
version: "0.0.1",
9+
type: "action",
10+
props: {
11+
finalscout,
12+
fullName: {
13+
type: "string",
14+
label: "Full Name",
15+
description: "The full name of the contact",
16+
},
17+
domain: {
18+
type: "string",
19+
label: "Company Domain",
20+
description: "The company domain for the contact",
21+
},
22+
deepVerify: {
23+
type: "boolean",
24+
label: "Deep Verify",
25+
description: "Whether to perform a deep verification of the email address",
26+
optional: true,
27+
},
28+
tags: {
29+
propDefinition: [
30+
finalscout,
31+
"tags",
32+
],
33+
},
34+
metadata: {
35+
propDefinition: [
36+
finalscout,
37+
"metadata",
38+
],
39+
},
40+
webhookUrl: {
41+
propDefinition: [
42+
finalscout,
43+
"webhookUrl",
44+
],
45+
},
46+
},
47+
async run({ $ }) {
48+
const response = await this.finalscout.findEmailProfessional({
49+
$,
50+
data: {
51+
person: {
52+
full_name: this.fullName,
53+
domain: this.domain,
54+
deep_verify: this.deepVerify,
55+
},
56+
tags: this.tags,
57+
metadata: parseObject(this.metadata),
58+
webhook_url: this.webhookUrl,
59+
},
60+
});
61+
$.export("$summary", "Successfully requested email for professional.");
62+
return response;
63+
},
64+
};
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import finalscout from "../../finalscout.app.mjs";
2+
3+
export default {
4+
key: "finalscout-get-single-task",
5+
name: "Get Single Task",
6+
description: "Get the task status for any Single Find task. [See the documentation](https://finalscout.com/public/doc/api.html#tag/Single-Find/paths/~1v1~1find~1single~1status/get)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
finalscout,
11+
id: {
12+
type: "string",
13+
label: "Task ID",
14+
description: "The ID of the task to get the status for",
15+
},
16+
},
17+
async run({ $ }) {
18+
const response = await this.finalscout.getSingleTask({
19+
$,
20+
params: {
21+
id: this.id,
22+
},
23+
});
24+
$.export("$summary", `Successfully retrieved status for task with ID: ${this.id}`);
25+
return response;
26+
},
27+
};
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
export const parseObject = (obj) => {
2+
if (!obj) {
3+
return undefined;
4+
}
5+
if (typeof obj === "string") {
6+
try {
7+
return JSON.parse(obj);
8+
} catch (e) {
9+
return undefined;
10+
}
11+
}
12+
if (Array.isArray(obj)) {
13+
return obj.map(parseObject);
14+
}
15+
if (typeof obj === "object") {
16+
return Object.fromEntries(Object.entries(obj).map(([
17+
key,
18+
value,
19+
]) => [
20+
key,
21+
parseObject(value),
22+
]));
23+
}
24+
return obj;
25+
};
Lines changed: 62 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,69 @@
1+
import { axios } from "@pipedream/platform";
2+
13
export default {
24
type: "app",
35
app: "finalscout",
4-
propDefinitions: {},
6+
propDefinitions: {
7+
tags: {
8+
type: "string[]",
9+
label: "Tags",
10+
description: "Use tags to organize your contacts in FinalScout web app",
11+
optional: true,
12+
},
13+
webhookUrl: {
14+
type: "string",
15+
label: "Webhook URL",
16+
description: "A URL to receive the webhook event for this task. A webhook event will be sent to the URL when the task is completed, regardless of whether an email is found or not",
17+
optional: true,
18+
},
19+
metadata: {
20+
type: "object",
21+
label: "Metadata",
22+
description: "Use this param to send custom meta data (like contact id) associated with the contact. The custom data will be returned in the response and webhook event.",
23+
optional: true,
24+
},
25+
},
526
methods: {
6-
// this.$auth contains connected account data
7-
authKeys() {
8-
console.log(Object.keys(this.$auth));
27+
_baseUrl() {
28+
return "https://api.finalscout.com/v1";
29+
},
30+
_makeRequest({
31+
$ = this, path, ...opts
32+
}) {
33+
return axios($, {
34+
url: `${this._baseUrl()}${path}`,
35+
headers: {
36+
Authorization: this.$auth.api_key,
37+
},
38+
...opts,
39+
});
40+
},
41+
findEmailViaLinkedIn(opts = {}) {
42+
return this._makeRequest({
43+
method: "POST",
44+
path: "/find/linkedin/single",
45+
...opts,
46+
});
47+
},
48+
findEmailViaNewsArticle(opts = {}) {
49+
return this._makeRequest({
50+
method: "POST",
51+
path: "/find/author/single",
52+
...opts,
53+
});
54+
},
55+
findEmailProfessional(opts = {}) {
56+
return this._makeRequest({
57+
method: "POST",
58+
path: "/find/professional/single",
59+
...opts,
60+
});
61+
},
62+
getSingleTask(opts = {}) {
63+
return this._makeRequest({
64+
path: "/find/single/status",
65+
...opts,
66+
});
967
},
1068
},
1169
};

components/finalscout/package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/finalscout",
3-
"version": "0.0.1",
3+
"version": "0.1.0",
44
"description": "Pipedream FinalScout Components",
55
"main": "finalscout.app.mjs",
66
"keywords": [
@@ -11,5 +11,8 @@
1111
"author": "Pipedream <[email protected]> (https://pipedream.com/)",
1212
"publishConfig": {
1313
"access": "public"
14+
},
15+
"dependencies": {
16+
"@pipedream/platform": "^3.1.0"
1417
}
15-
}
18+
}

0 commit comments

Comments
 (0)