-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Enhance Lusha component with new actions and properties #19531
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
72a1733
1f6f234
e8fdecc
ca66762
7fe2e9d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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
|
||||||||
| 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`); | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add defensive check and enhance summary message. The code accesses 🔎 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
Suggested change
🤖 Prompt for AI Agents |
||||||||
|
|
||||||||
| 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); | ||
| } | ||
luancazarine marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }, | ||
| }; | ||
| 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
|
||
| 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); | ||
| } | ||
| }, | ||
| }; | ||
| 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); | ||
| } | ||
luancazarine marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }, | ||
| }; | ||
Uh oh!
There was an error while loading. Please reload this page.