Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import finalscout from "../../finalscout.app.mjs";
import { parseObject } from "../../common/utils.mjs";

export default {
key: "finalscout-find-email-linkedin",
name: "Find Email from LinkedIn",
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)",
version: "0.0.1",
type: "action",
props: {
finalscout,
url: {
type: "string",
label: "LinkedIn Profile URL",
description: "The URL of the LinkedIn profile.",
},
tags: {
propDefinition: [
finalscout,
"tags",
],
},
metadata: {
propDefinition: [
finalscout,
"metadata",
],
},
enablePersonalEmail: {
type: "boolean",
label: "Enable Personal Email",
description: "Whether to find personal emails (e.g. [email protected]) when a professional email address is not found",
optional: true,
},
enableGenericEmail: {
type: "boolean",
label: "Enable Generic Email",
description: "Whether to find generic emails (e.g. [email protected]) when a professional email address is not found",
optional: true,
},
webhookUrl: {
propDefinition: [
finalscout,
"webhookUrl",
],
},
},
async run({ $ }) {
const response = await this.finalscout.findEmailViaLinkedIn({
$,
data: {
person: {
linkedin_url: this.url,
},
tags: this.tags,
metadata: parseObject(this.metadata),
enable_personal_email: this.enablePersonalEmail,
enable_generic_email: this.enableGenericEmail,
webhook_url: this.webhookUrl,
},
});
$.export("$summary", "Successfully requested email for LinkedIn profile.");
return response;
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import finalscout from "../../finalscout.app.mjs";
import { parseObject } from "../../common/utils.mjs";

export default {
key: "finalscout-find-email-news-article",
name: "Find Email from News Article",
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)",
version: "0.0.1",
type: "action",
props: {
finalscout,
url: {
type: "string",
label: "News Article URL",
description: "The URL of the news article.",
},
tags: {
propDefinition: [
finalscout,
"tags",
],
},
metadata: {
propDefinition: [
finalscout,
"metadata",
],
},
webhookUrl: {
propDefinition: [
finalscout,
"webhookUrl",
],
},
},
async run({ $ }) {
const response = await this.finalscout.findEmailViaNewsArticle({
$,
data: {
person: {
article_url: this.url,
},
tags: this.tags,
metadata: parseObject(this.metadata),
webhook_url: this.webhookUrl,
},
});
$.export("$summary", "Successfully requested email for news article.");
return response;
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import finalscout from "../../finalscout.app.mjs";
import { parseObject } from "../../common/utils.mjs";

export default {
key: "finalscout-find-email-professional",
name: "Find Email from Professional",
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)",
version: "0.0.1",
type: "action",
props: {
finalscout,
fullName: {
type: "string",
label: "Full Name",
description: "The full name of the contact",
},
domain: {
type: "string",
label: "Company Domain",
description: "The company domain for the contact",
},
deepVerify: {
type: "boolean",
label: "Deep Verify",
description: "Whether to perform a deep verification of the email address",
optional: true,
},
tags: {
propDefinition: [
finalscout,
"tags",
],
},
metadata: {
propDefinition: [
finalscout,
"metadata",
],
},
webhookUrl: {
propDefinition: [
finalscout,
"webhookUrl",
],
},
},
async run({ $ }) {
const response = await this.finalscout.findEmailProfessional({
$,
data: {
person: {
full_name: this.fullName,
domain: this.domain,
deep_verify: this.deepVerify,
},
tags: this.tags,
metadata: parseObject(this.metadata),
webhook_url: this.webhookUrl,
},
});
$.export("$summary", "Successfully requested email for professional.");
return response;
},
};
27 changes: 27 additions & 0 deletions components/finalscout/actions/get-single-task/get-single-task.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import finalscout from "../../finalscout.app.mjs";

export default {
key: "finalscout-get-single-task",
name: "Get Single Task",
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)",
version: "0.0.1",
type: "action",
props: {
finalscout,
id: {
type: "string",
label: "Task ID",
description: "The ID of the task to get the status for",
},
},
async run({ $ }) {
const response = await this.finalscout.getSingleTask({
$,
params: {
id: this.id,
},
});
$.export("$summary", `Successfully retrieved status for task with ID: ${this.id}`);
return response;
},
};
25 changes: 25 additions & 0 deletions components/finalscout/common/utils.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
export const parseObject = (obj) => {
if (!obj) {
return undefined;
}
if (typeof obj === "string") {
try {
return JSON.parse(obj);
} catch (e) {
return undefined;
}
}
if (Array.isArray(obj)) {
return obj.map(parseObject);
}
if (typeof obj === "object") {
return Object.fromEntries(Object.entries(obj).map(([
key,
value,
]) => [
key,
parseObject(value),
]));
}
return obj;
};
66 changes: 62 additions & 4 deletions components/finalscout/finalscout.app.mjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,69 @@
import { axios } from "@pipedream/platform";

export default {
type: "app",
app: "finalscout",
propDefinitions: {},
propDefinitions: {
tags: {
type: "string[]",
label: "Tags",
description: "Use tags to organize your contacts in FinalScout web app",
optional: true,
},
webhookUrl: {
type: "string",
label: "Webhook URL",
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",
optional: true,
},
metadata: {
type: "object",
label: "Metadata",
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.",
optional: true,
},
},
methods: {
// this.$auth contains connected account data
authKeys() {
console.log(Object.keys(this.$auth));
_baseUrl() {
return "https://api.finalscout.com/v1";
},
_makeRequest({
$ = this, path, ...opts
}) {
return axios($, {
url: `${this._baseUrl()}${path}`,
headers: {
Authorization: this.$auth.api_key,
},
...opts,
});
},
findEmailViaLinkedIn(opts = {}) {
return this._makeRequest({
method: "POST",
path: "/find/linkedin/single",
...opts,
});
},
findEmailViaNewsArticle(opts = {}) {
return this._makeRequest({
method: "POST",
path: "/find/author/single",
...opts,
});
},
findEmailProfessional(opts = {}) {
return this._makeRequest({
method: "POST",
path: "/find/professional/single",
...opts,
});
},
getSingleTask(opts = {}) {
return this._makeRequest({
path: "/find/single/status",
...opts,
});
},
},
};
7 changes: 5 additions & 2 deletions components/finalscout/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/finalscout",
"version": "0.0.1",
"version": "0.1.0",
"description": "Pipedream FinalScout Components",
"main": "finalscout.app.mjs",
"keywords": [
Expand All @@ -11,5 +11,8 @@
"author": "Pipedream <[email protected]> (https://pipedream.com/)",
"publishConfig": {
"access": "public"
},
"dependencies": {
"@pipedream/platform": "^3.1.0"
}
}
}
Loading
Loading