Skip to content
Open
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
2 changes: 1 addition & 1 deletion components/lusha/actions/company-enrich/company-enrich.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "lusha-company-enrich",
name: "Enrich Companies",
description: "Enriches company information based on provided company IDs. [See the documentation](https://docs.lusha.com/apis/openapi/company-search-and-enrich/enrichprospectingcompanies)",
version: "0.0.5",
version: "0.0.6",
annotations: {
destructiveHint: false,
openWorldHint: true,
Expand Down
2 changes: 1 addition & 1 deletion components/lusha/actions/company-search/company-search.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "lusha-company-search",
name: "Search Companies",
description: "Search for companies using various filters. [See the documentation](https://docs.lusha.com/apis/openapi/company-search-and-enrich/searchprospectingcompanies)",
version: "0.0.4",
version: "0.0.5",
annotations: {
destructiveHint: false,
openWorldHint: true,
Expand Down
2 changes: 1 addition & 1 deletion components/lusha/actions/contact-enrich/contact-enrich.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "lusha-contact-enrich",
name: "Enrich Contacts",
description: "Enriches contacts based on provided IDs. [See the documentation](https://docs.lusha.com/apis/openapi/contact-search-and-enrich/enrichprospectingcontacts)",
version: "0.0.4",
version: "0.0.5",
annotations: {
destructiveHint: false,
openWorldHint: true,
Expand Down
2 changes: 1 addition & 1 deletion components/lusha/actions/contact-search/contact-search.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "lusha-contact-search",
name: "Search Contacts",
description: "Search for contacts using various filters. [See the documentation](https://docs.lusha.com/apis/openapi/contact-search-and-enrich/searchprospectingcontacts)",
version: "0.0.4",
version: "0.0.5",
annotations: {
destructiveHint: false,
openWorldHint: true,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import { ConfigurationError } from "@pipedream/platform";
import { parseObject } from "../../common/utils.mjs";
import lusha from "../../lusha.app.mjs";

export default {
key: "lusha-get-company-recommendations",
name: "Get Company Recommendations",
description: "Get company recommendations based on other companies. Use requestId to get more results from a previous search. [See the documentation](https://docs.lusha.com/apis/openapi/company-recommendations/getcompanyrecommendations)",
version: "0.0.1",
annotations: {
destructiveHint: false,
openWorldHint: true,
readOnlyHint: true,
},
type: "action",
props: {
lusha,
requestId: {
type: "string",
label: "Request ID",
description: "Request ID for getting more results",
optional: true,
},
companies: {
type: "string[]",
label: "Companies",
description: "List of company objects to retrieve recommendations for. Example: [{ \"companyId\": \"123321\" }]. [See the documentation](https://docs.lusha.com/apis/openapi/company-recommendations/getcompanyrecommendations) for more information.",
},
exclude: {
type: "string[]",
label: "Exclude",
description: "List of company objects to exclude from the recommendations. Example: [{ \"companyId\": \"123321\" }]. [See the documentation](https://docs.lusha.com/apis/openapi/company-recommendations/getcompanyrecommendations) for more information.",
},
limit: {
type: "integer",
label: "Limit",
description: "The maximum number of results to return.",
min: 5,
max: 25,
default: 25,
},
},
async run({ $ }) {
try {
const response = await this.lusha.getCompanyRecommendations({
$,
params: {
companies: parseObject(this.companies),
exclude: parseObject(this.exclude),
limit: this.limit,
requestId: this.requestId,
},
});
$.export("$summary", `Successfully retrieved ${response.count} company recommendations`);

return response;
} catch ({ response }) {
throw new ConfigurationError(response?.data?.message);
}
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import { ConfigurationError } from "@pipedream/platform";
import { parseObject } from "../../common/utils.mjs";
import lusha from "../../lusha.app.mjs";

export default {
key: "lusha-get-company-signals",
name: "Get Company Signals By IDs",
description: "Retrieve signals data for a list of company IDs. This endpoint allows you to get recent activities and signals for up to 100 companies per request. [See the documentation](https://docs.lusha.com/apis/openapi/signals/getcompanysignalsbyid)",
version: "0.0.1",
annotations: {
destructiveHint: false,
openWorldHint: true,
readOnlyHint: true,
},
type: "action",
props: {
lusha,
info: {

Check warning on line 18 in components/lusha/actions/get-company-signals/get-company-signals.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop info must have a description. See https://pipedream.com/docs/components/guidelines/#props

Check warning on line 18 in components/lusha/actions/get-company-signals/get-company-signals.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop info must have a label. See https://pipedream.com/docs/components/guidelines/#props
type: "alert",
alertType: "info",
content: "* Returns signals from the last 6 months by default\
\n* Use `startDate` to customize the timeframe",
},
companyIds: {
propDefinition: [
lusha,
"companyIds",
],
description: "List of company IDs to retrieve signals for",
},
signals: {
propDefinition: [
lusha,
"companySignals",
],
},
startDate: {
propDefinition: [
lusha,
"startDate",
],
},
},
async run({ $ }) {
try {
const response = await this.lusha.getCompanySignalsById({
$,
params: {
companyIds: parseObject(this.companyIds),
signals: this.signals,
startDate: this.startDate,
},
});
$.export("$summary", `Successfully retrieved ${Object.keys(response.companies).length} company signals`);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Add defensive check and enhance summary message.

The code accesses response.companies without verifying it exists, which could cause a runtime error if the API returns an unexpected structure. Additionally, a past review comment suggests adding more information about the response in the summary.

🔎 Apply this diff to add a defensive check and enhance the summary:
-      $.export("$summary", `Successfully retrieved ${Object.keys(response.companies).length} company signals`);
+      const companyCount = response?.companies ? Object.keys(response.companies).length : 0;
+      $.export("$summary", `Successfully retrieved signals for ${companyCount} ${companyCount === 1 ? 'company' : 'companies'}`);

Based on learnings, ensure the summary message is correctly formatted and informative. As per past review comments, add more info about the response in the summary.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
$.export("$summary", `Successfully retrieved ${Object.keys(response.companies).length} company signals`);
const companyCount = response?.companies ? Object.keys(response.companies).length : 0;
$.export("$summary", `Successfully retrieved signals for ${companyCount} ${companyCount === 1 ? 'company' : 'companies'}`);
🤖 Prompt for AI Agents
In components/lusha/actions/get-company-signals/get-company-signals.mjs around
line 54, the code assumes response.companies exists and builds the summary
directly from it; add a defensive guard to compute companiesCount safely (e.g.,
const companies = response && response.companies ? response.companies : {};
const count = Object.keys(companies).length) and then update the summary to
include that count plus a small, safe bit of response context (for example
response.status or response.meta or a short JSON.stringify of a limited response
field) so the message becomes informative but not verbose; ensure you handle
missing fields gracefully and avoid dumping the entire response.


return response;
} catch ({ response }) {
throw new ConfigurationError(response?.data?.message);
}
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import { ConfigurationError } from "@pipedream/platform";
import { parseObject } from "../../common/utils.mjs";
import lusha from "../../lusha.app.mjs";

export default {
key: "lusha-get-contact-recommendations",
name: "Get Contact Recommendations",
description: "Fetch recommended contacts by supplying the contact's IDs, enabling Lusha to return similar profiles aligned by job title, seniority, and company context. Use requestId to get more results from a previous search. [See the documentation](https://docs.lusha.com/apis/openapi/contact-recommendations/getcontactrecommendations)",
version: "0.0.1",
annotations: {
destructiveHint: false,
openWorldHint: true,
readOnlyHint: true,
},
type: "action",
props: {
lusha,
requestId: {
type: "string",
label: "Request ID",
description: "Request ID for getting more results",
optional: true,
},
contacts: {
type: "string[]",
label: "Contacts",
description: "List of contact objects to retrieve recommendations for. Example: [{ \"personId\": \"123321\", \"companyId\": \"456789\" }]. [See the documentation](https://docs.lusha.com/apis/openapi/contact-recommendations/getcontactrecommendations) for more information.",
},
exclude: {
type: "string[]",
label: "Exclude",
description: "List of contact objects to exclude from the recommendations. Example: [{ \"personId\": \"123321\", \"companyId\": \"456789\" }]. [See the documentation](https://docs.lusha.com/apis/openapi/contact-recommendations/getcontactrecommendations) for more information.",
},
limit: {
type: "integer",
label: "Limit",
description: "The maximum number of results to return.",
min: 5,
max: 25,
default: 25,
},
},
async run({ $ }) {
try {
const response = await this.lusha.getContactRecommendations({
$,
params: {
contacts: parseObject(this.contacts),
exclude: parseObject(this.exclude),
limit: this.limit,
requestId: this.requestId,
},
});
$.export("$summary", `Successfully retrieved ${response.count} contact recommendations`);

return response;
} catch ({ response }) {
throw new ConfigurationError(response?.data?.message);
}
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import { ConfigurationError } from "@pipedream/platform";
import { parseObject } from "../../common/utils.mjs";
import lusha from "../../lusha.app.mjs";

export default {
key: "lusha-get-contact-signals",
name: "Get Contact Signals By IDs",
description: "Retrieve signals data for a list of contact IDs. This endpoint allows you to get recent activities and signals for up to 100 contacts per request. [See the documentation](https://docs.lusha.com/apis/openapi/signals/getcontactsignalsbyid)",
version: "0.0.1",
annotations: {
destructiveHint: false,
openWorldHint: true,
readOnlyHint: true,
},
type: "action",
props: {
lusha,
info: {

Check warning on line 18 in components/lusha/actions/get-contact-signals/get-contact-signals.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop info must have a description. See https://pipedream.com/docs/components/guidelines/#props

Check warning on line 18 in components/lusha/actions/get-contact-signals/get-contact-signals.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Component prop info must have a label. See https://pipedream.com/docs/components/guidelines/#props
type: "alert",
alertType: "info",
content: `* Returns signals from the last 6 months by default\
\n* Use \`startDate\` to customize the timeframe\
\n* Each signal type requested counts towards credit usage
`,
},
contactIds: {
propDefinition: [
lusha,
"contactIds",
],
description: "List of contact IDs to retrieve signals for",
},
signals: {
propDefinition: [
lusha,
"signals",
],
},
startDate: {
propDefinition: [
lusha,
"startDate",
],
},
},
async run({ $ }) {
try {
const response = await this.lusha.getContactSignalsById({
$,
params: {
contactIds: parseObject(this.contactIds),
signals: this.signals,
startDate: this.startDate,
},
});
$.export("$summary", `Successfully retrieved ${Object.keys(response.contacts).length} contact signals`);

return response;
} catch ({ response }) {
throw new ConfigurationError(response?.data?.message);
}
},
};
40 changes: 40 additions & 0 deletions components/lusha/actions/get-signal-options/get-signal-options.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { ConfigurationError } from "@pipedream/platform";
import lusha from "../../lusha.app.mjs";

export default {
key: "lusha-get-signal-options",
name: "Get Signal Options",
description: "Retrieve available signal options for a specific entity type (contact or company). This endpoint returns the list of signal types you can filter by when enriching contacts or companies. [See the documentation](https://docs.lusha.com/apis/openapi/signal-filters/getsignaloptions)",
version: "0.0.1",
annotations: {
destructiveHint: false,
openWorldHint: true,
readOnlyHint: true,
},
type: "action",
props: {
lusha,
objectType: {
type: "string",
label: "Object Type",
description: "The type of object to get signal options for.",
options: [
"contact",
"company",
],
},
},
async run({ $ }) {
try {
const response = await this.lusha.getSignalOptions({
$,
objectType: this.objectType,
});
$.export("$summary", `Successfully retrieved signal options for ${this.objectType}`);

return response;
} catch ({ response }) {
throw new ConfigurationError(response?.data?.message);
}
},
};
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import lusha from "../../lusha.app.mjs";
import { parseObject } from "../../common/utils.mjs";
import lusha from "../../lusha.app.mjs";

export default {
key: "lusha-search-and-enrich-companies",
name: "Search and Enrich Companies",
description: "Search for companies and enrich them. [See the documentation](https://docs.lusha.com/apis/openapi/company-search-and-enrich)",
version: "0.0.3",
version: "0.0.4",
annotations: {
destructiveHint: false,
openWorldHint: true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import lusha from "../../lusha.app.mjs";
import { parseObject } from "../../common/utils.mjs";
import lusha from "../../lusha.app.mjs";

export default {
key: "lusha-search-and-enrich-contacts",
name: "Search and Enrich Contacts",
description: "Search for contacts and enrich them. [See the documentation](https://docs.lusha.com/apis/openapi/contact-search-and-enrich)",
version: "0.0.3",
version: "0.0.4",
annotations: {
destructiveHint: false,
openWorldHint: true,
Expand Down
Loading
Loading