-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Pipedrive - Add Lead #16769
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
Pipedrive - Add Lead #16769
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎ |
WalkthroughThis update introduces a new "Add Lead" action for Pipedrive, along with supporting methods and property definitions for lead labels and lead creation in the Pipedrive app component. Additionally, it increments version numbers across multiple existing actions and sources, and updates the package version in Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant AddLeadAction
participant PipedriveApp
participant PipedriveAPI
User->>AddLeadAction: Provide lead details (title, personId/orgId, etc.)
AddLeadAction->>AddLeadAction: Validate input (personId or orgId required)
AddLeadAction->>PipedriveApp: Call addLead with mapped parameters
PipedriveApp->>PipedriveAPI: POST /leads (with parameters)
PipedriveAPI-->>PipedriveApp: Return created lead data
PipedriveApp-->>AddLeadAction: Return API response
AddLeadAction-->>User: Export summary and return result
Assessment against linked issues
Suggested labels
Suggested reviewers
Poem
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
components/pipedrive/actions/add-activity/add-activity.mjsOops! Something went wrong! :( ESLint: 8.57.1 Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs components/pipedrive/actions/add-deal/add-deal.mjsOops! Something went wrong! :( ESLint: 8.57.1 Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs components/pipedrive/actions/add-note/add-note.mjsOops! Something went wrong! :( ESLint: 8.57.1 Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs
Note ⚡️ AI Code Reviews for VS Code, Cursor, WindsurfCodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback. Note ⚡️ Faster reviews with cachingCodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 30th. To opt out, configure ✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
components/pipedrive/actions/add-lead/add-lead.mjs (2)
1-107: Consider adding error handling for the API call.While the action handles validation errors, it doesn't have specific error handling for the API call. Consider adding try/catch to handle potential API errors gracefully.
async run({ $ }) { if (!this.organizationId && !this.personId) { throw new ConfigurationError("Either organizationId or personId is required"); } - const response = await this.pipedrive.addLead({ - title: this.title, - person_id: this.personId, - organization_id: this.organizationId, - owner_id: this.ownerId, - label_ids: this.leadLabelIds, - value: parseObject(this.value), - expected_close_date: this.expectedCloseDate, - visible_to: this.visibleTo, - was_seen: this.wasSeen, - }); + try { + const response = await this.pipedrive.addLead({ + title: this.title, + person_id: this.personId, + organization_id: this.organizationId, + owner_id: this.ownerId, + label_ids: this.leadLabelIds, + value: parseObject(this.value), + expected_close_date: this.expectedCloseDate, + visible_to: this.visibleTo, + was_seen: this.wasSeen, + }); + $.export("$summary", `Successfully created lead: ${response.data?.title || response.data?.id}`); + return response; + } catch (error) { + $.export("$summary", `Failed to create lead: ${error.message}`); + throw error; + } - $.export("$summary", `Successfully created lead: ${response.data?.title || response.data?.id}`); - return response; },
51-56: Consider adding date format validation.The expectedCloseDate prop accepts a string in ISO 8601 format (YYYY-MM-DD), but there's no validation to ensure the provided date matches this format. Consider adding validation to prevent errors when calling the API.
async run({ $ }) { if (!this.organizationId && !this.personId) { throw new ConfigurationError("Either organizationId or personId is required"); } + // Validate date format if provided + if (this.expectedCloseDate && !/^\d{4}-\d{2}-\d{2}$/.test(this.expectedCloseDate)) { + throw new ConfigurationError("Expected close date must be in ISO 8601 format: YYYY-MM-DD"); + } + const response = await this.pipedrive.addLead({ // ...existing parameters }); // ...rest of the method },
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (14)
components/pipedrive/actions/add-activity/add-activity.mjs(1 hunks)components/pipedrive/actions/add-deal/add-deal.mjs(1 hunks)components/pipedrive/actions/add-lead/add-lead.mjs(1 hunks)components/pipedrive/actions/add-note/add-note.mjs(1 hunks)components/pipedrive/actions/add-organization/add-organization.mjs(1 hunks)components/pipedrive/actions/add-person/add-person.mjs(1 hunks)components/pipedrive/actions/search-persons/search-persons.mjs(1 hunks)components/pipedrive/actions/update-deal/update-deal.mjs(1 hunks)components/pipedrive/package.json(1 hunks)components/pipedrive/pipedrive.app.mjs(3 hunks)components/pipedrive/sources/new-deal-instant/new-deal-instant.mjs(1 hunks)components/pipedrive/sources/new-person-instant/new-person-instant.mjs(1 hunks)components/pipedrive/sources/updated-deal-instant/updated-deal-instant.mjs(1 hunks)components/pipedrive/sources/updated-person-instant/updated-person-instant.mjs(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (4)
- GitHub Check: Verify TypeScript components
- GitHub Check: pnpm publish
- GitHub Check: Lint Code Base
- GitHub Check: Publish TypeScript components
🔇 Additional comments (21)
components/pipedrive/package.json (1)
3-3: Version update looks appropriate.The version bump from 0.3.13 to 0.4.0 follows semantic versioning correctly, as adding new lead functionality represents a minor feature addition while maintaining backward compatibility.
components/pipedrive/pipedrive.app.mjs (3)
281-296: LGTM: Lead label property definition follows consistent patterns.The new
leadLabelIdsproperty definition is well structured with appropriate type, label, description, and the options method follows the established pattern for dynamic property options.
342-345: LGTM: API method for fetching lead labels.The
getLeadLabelsmethod follows the same pattern as other API methods in the file, maintaining consistency in the codebase.
376-381: LGTM: API method for adding leads.The
addLeadmethod correctly follows the established pattern of other similar methods (likeaddDeal,addPerson), passing the options to the appropriate API endpoint.components/pipedrive/actions/add-deal/add-deal.mjs (1)
8-8: Version increment is appropriate.The version bump from 0.1.7 to 0.1.8 is consistent with the coordinated version updates across the Pipedrive integration components.
components/pipedrive/actions/search-persons/search-persons.mjs (1)
10-10: Version increment is appropriate.The version bump from 0.1.7 to 0.1.8 is consistent with the coordinated version updates across the Pipedrive integration components.
components/pipedrive/actions/add-activity/add-activity.mjs (1)
10-10: Version bump to 0.1.8 is consistent
The version was incremented from 0.1.7 to 0.1.8 to align with the coordinated release across Pipedrive actions.components/pipedrive/actions/add-note/add-note.mjs (1)
8-8: Version bump to 0.0.6 is consistent
The version was updated from 0.0.5 to 0.0.6, matching the coordinated increments for this release.components/pipedrive/actions/update-deal/update-deal.mjs (1)
8-8: Version bump to 0.1.9 is consistent
The action version was bumped from 0.1.8 to 0.1.9 in line with other Pipedrive action updates.components/pipedrive/actions/add-organization/add-organization.mjs (1)
8-8: Version bump to 0.1.8 is consistent
Updated from 0.1.7 to 0.1.8 to keep alignment with the broader Pipedrive action release.components/pipedrive/actions/add-person/add-person.mjs (1)
9-9: Version bump to 0.1.8 is consistent
The version was incremented from 0.1.7 to 0.1.8, matching the coordinated versioning strategy.components/pipedrive/sources/updated-deal-instant/updated-deal-instant.mjs (1)
9-9: Version increment looks appropriate.The version number has been bumped from "0.0.3" to "0.0.4", which aligns with the other component updates in this PR. This is good practice for tracking changes across related components.
components/pipedrive/sources/updated-person-instant/updated-person-instant.mjs (1)
9-9: Version increment is consistent with other components.The version bump from "0.0.3" to "0.0.4" maintains consistency with the other Pipedrive source components in this PR.
components/pipedrive/sources/new-deal-instant/new-deal-instant.mjs (1)
9-9: Version update is in line with other components.The version increment from "0.0.3" to "0.0.4" is consistent with the other source components in this PR.
components/pipedrive/sources/new-person-instant/new-person-instant.mjs (1)
9-9: Version update maintains consistency across components.The version increment from "0.0.3" to "0.0.4" keeps this component in sync with the other Pipedrive source components.
components/pipedrive/actions/add-lead/add-lead.mjs (6)
1-4: Imports look appropriate for the action's functionality.The imports include the Pipedrive app module, the ConfigurationError for validation, and a utility function for parsing objects, which are all necessary for the action's implementation.
5-11: Action metadata is well-defined.The action's key, name, description, version, and type are properly defined. The description includes a link to the API documentation, which is helpful for users.
11-87: Props are comprehensive and well-documented.The props are clearly defined with appropriate types, labels, and descriptions. The conditional requirements between personId and organizationId are documented in their descriptions. The visibleTo property includes detailed options explaining the visibility settings for different Pipedrive plans.
89-91: Good validation for required fields.The action correctly validates that either organizationId or personId is provided, throwing a ConfigurationError with a clear message if both are missing.
93-103: API parameters are properly mapped.The action correctly maps the props to the API parameters, including parsing the value object. The parameter names follow the API's expected format with snake_case.
104-105: Meaningful success message and return value.The action exports a summary message that includes the lead's title or ID, making it clear which lead was created. It also returns the full API response, which is useful for downstream steps in a workflow.
jcortes
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @michelle0927 lgtm! Ready for QA!
Resolves #16766
Summary by CodeRabbit
New Features
Chores