Skip to content

Conversation

@michelle0927
Copy link
Collaborator

@michelle0927 michelle0927 commented May 22, 2025

Resolves #16766

Summary by CodeRabbit

  • New Features

    • Added support for managing lead labels and creating leads in Pipedrive.
    • Introduced a new "Add Lead" action, allowing users to create leads with customizable properties.
  • Chores

    • Updated version numbers for multiple Pipedrive actions and sources to reflect recent changes.
    • Increased the overall package version for Pipedrive integrations.

@vercel
Copy link

vercel bot commented May 22, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

3 Skipped Deployments
Name Status Preview Comments Updated (UTC)
docs-v2 ⬜️ Ignored (Inspect) May 22, 2025 5:16pm
pipedream-docs ⬜️ Ignored (Inspect) May 22, 2025 5:16pm
pipedream-docs-redirect-do-not-edit ⬜️ Ignored (Inspect) May 22, 2025 5:16pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented May 22, 2025

Walkthrough

This 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 package.json.

Changes

Files / Grouped Files Change Summary
components/pipedrive/actions/add-lead/add-lead.mjs New "Add Lead" action component for Pipedrive, enabling creation of leads via API.
components/pipedrive/pipedrive.app.mjs Added leadLabelIds prop definition, getLeadLabels method, and addLead method.
components/pipedrive/actions/add-activity/add-activity.mjs
components/pipedrive/actions/add-deal/add-deal.mjs
components/pipedrive/actions/add-organization/add-organization.mjs
components/pipedrive/actions/add-person/add-person.mjs
components/pipedrive/actions/search-persons/search-persons.mjs
Incremented version numbers in action components.
components/pipedrive/actions/add-note/add-note.mjs Incremented version number.
components/pipedrive/actions/update-deal/update-deal.mjs Incremented version number.
components/pipedrive/sources/new-deal-instant/new-deal-instant.mjs
components/pipedrive/sources/new-person-instant/new-person-instant.mjs
components/pipedrive/sources/updated-deal-instant/updated-deal-instant.mjs
components/pipedrive/sources/updated-person-instant/updated-person-instant.mjs
Incremented version numbers in source components.
components/pipedrive/package.json Updated package version from 0.3.13 to 0.4.0.

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
Loading

Assessment against linked issues

Objective Addressed Explanation
Add Lead action to be available in Pipedream for Pipedrive (#16766)

Suggested labels

User submitted

Suggested reviewers

  • lcaresia

Poem

A rabbit hopped into Pipedrive’s field,
With “Add Lead” magic, new powers revealed!
Labels and owners, all tidy and neat,
Version numbers marching in a rhythmic beat.
Now leads can grow where carrots once lay—
Hooray for new features, hip-hip-hooray! 🥕✨

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

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

components/pipedrive/actions/add-activity/add-activity.mjs

Oops! Something went wrong! :(

ESLint: 8.57.1

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs
at Object.getPackageJSONURL (node:internal/modules/package_json_reader:255:9)
at packageResolve (node:internal/modules/esm/resolve:767:81)
at moduleResolve (node:internal/modules/esm/resolve:853:18)
at defaultResolve (node:internal/modules/esm/resolve:983:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:799:12)
at #cachedDefaultResolve (node:internal/modules/esm/loader:723:25)
at ModuleLoader.resolve (node:internal/modules/esm/loader:706:38)
at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:307:38)
at #link (node:internal/modules/esm/module_job:163:49)

components/pipedrive/actions/add-deal/add-deal.mjs

Oops! Something went wrong! :(

ESLint: 8.57.1

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs
at Object.getPackageJSONURL (node:internal/modules/package_json_reader:255:9)
at packageResolve (node:internal/modules/esm/resolve:767:81)
at moduleResolve (node:internal/modules/esm/resolve:853:18)
at defaultResolve (node:internal/modules/esm/resolve:983:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:799:12)
at #cachedDefaultResolve (node:internal/modules/esm/loader:723:25)
at ModuleLoader.resolve (node:internal/modules/esm/loader:706:38)
at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:307:38)
at #link (node:internal/modules/esm/module_job:163:49)

components/pipedrive/actions/add-note/add-note.mjs

Oops! Something went wrong! :(

ESLint: 8.57.1

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs
at Object.getPackageJSONURL (node:internal/modules/package_json_reader:255:9)
at packageResolve (node:internal/modules/esm/resolve:767:81)
at moduleResolve (node:internal/modules/esm/resolve:853:18)
at defaultResolve (node:internal/modules/esm/resolve:983:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:799:12)
at #cachedDefaultResolve (node:internal/modules/esm/loader:723:25)
at ModuleLoader.resolve (node:internal/modules/esm/loader:706:38)
at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:307:38)
at #link (node:internal/modules/esm/module_job:163:49)

  • 10 others

Note

⚡️ AI Code Reviews for VS Code, Cursor, Windsurf

CodeRabbit 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.
Learn more here.


Note

⚡️ Faster reviews with caching

CodeRabbit 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 Review - Disable Cache at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the Data Retention setting under your Organization Settings.
Enjoy the performance boost—your workflow just got faster.

✨ Finishing Touches
  • 📝 Generate Docstrings

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need 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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

📥 Commits

Reviewing files that changed from the base of the PR and between aa6fd81 and 12a5f75.

📒 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 leadLabelIds property 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 getLeadLabels method 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 addLead method correctly follows the established pattern of other similar methods (like addDeal, 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.

Copy link
Collaborator

@jcortes jcortes left a 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!

@michelle0927 michelle0927 merged commit 2f51624 into master May 23, 2025
10 of 11 checks passed
@michelle0927 michelle0927 deleted the issue-16766 branch May 23, 2025 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ACTION] Add Lead in Pipedream - Pipedrive

3 participants