Skip to content

16246 feature update pipedrive to use webhooks v2 #16297

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

Merged

Conversation

luancazarine
Copy link
Collaborator

@luancazarine luancazarine commented Apr 15, 2025

Resolves #16246

Summary by CodeRabbit

  • New Features
    • Updated to support the latest Pipedrive webhook API version, ensuring compatibility with new event payload structures.
  • Bug Fixes
    • Improved event data handling for instant triggers, including more accurate extraction of event IDs and timestamps.
  • Tests
    • Updated test event data to reflect the new webhook schema, providing more relevant and simplified examples.
  • Chores
    • Incremented version numbers for Pipedrive package and sources.
    • Renamed and refined event action labels and summary messages for clarity across deal and person events.

Sources
 - New Deal (Instant)
 - New Person (Instant)
 - New Deal Updated (Instant)
 - New Person Updated (Instant)
@luancazarine luancazarine linked an issue Apr 15, 2025 that may be closed by this pull request
Copy link

vercel bot commented Apr 15, 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) Visit Preview Apr 21, 2025 10:26pm
pipedream-docs ⬜️ Ignored (Inspect) Apr 21, 2025 10:26pm
pipedream-docs-redirect-do-not-edit ⬜️ Ignored (Inspect) Apr 21, 2025 10:26pm

Copy link
Contributor

coderabbitai bot commented Apr 15, 2025

Walkthrough

This change updates the Pipedrive integration to use Webhooks API version 2.0 instead of version 1.0. The webhook activation logic, event payload parsing, and test event data structures were modified to align with the new schema introduced in v2. The event processing methods now reference updated payload fields, and the event action strings were revised to match the new webhook event types. All relevant source component versions were incremented, and the package version was updated to reflect these changes.

Changes

Files / Group Change Summary
components/pipedrive/package.json Incremented package version from 0.3.12 to 0.3.13.
components/pipedrive/sources/common/base.mjs Updated webhook activation to use version "2.0", removed v1 comment, adjusted event payload parsing to use new v2 fields, and updated event ID and timestamp extraction.
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 source versions. Updated getExtraData methods to use new event action strings ("create" or "change"). Modified getSummary methods to reference new payload structure (body.data.id instead of body.current.id).
components/pipedrive/sources/new-deal-instant/test-event.mjs
components/pipedrive/sources/new-person-instant/test-event.mjs
components/pipedrive/sources/updated-deal-instant/test-event.mjs
components/pipedrive/sources/updated-person-instant/test-event.mjs
Replaced and simplified test event payloads to match the new webhook v2 schema: changed metadata fields, updated timestamp formats, restructured and reduced event data, and removed obsolete or renamed fields.
components/agentx/agentx.app.mjs
components/ai_chatbot_hub/ai_chatbot_hub.app.mjs
components/easyfill_ai/easyfill_ai.app.mjs
components/ifthenpay/ifthenpay.app.mjs
components/musicbrainz/musicbrainz.app.mjs
components/notion_api_key/notion_api_key.app.mjs
components/proprofs_knowledge_base/proprofs_knowledge_base.app.mjs
components/riku_ai/riku_ai.app.mjs
components/salesloft/salesloft.app.mjs
components/screenshot_api/screenshot_api.app.mjs
components/voicemaker/voicemaker.app.mjs
Added newline characters at the end of multiple app files without any functional or logical code changes.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant SourceComponent
    participant PipedriveAPI

    User->>SourceComponent: Activate webhook
    SourceComponent->>PipedriveAPI: Register webhook (version 2.0)
    PipedriveAPI-->>SourceComponent: Webhook registration confirmation

    PipedriveAPI-->>SourceComponent: Send event (v2 schema)
    SourceComponent->>SourceComponent: Parse event using v2 fields
    SourceComponent-->>User: Emit event with updated payload structure
Loading

Assessment against linked issues

Objective Addressed Explanation
Update Pipedrive sources to use Webhooks API v2, including payload structure and event handling (#16246)

Possibly related PRs

  • PipedreamHQ/pipedream#16245: This PR previously set the webhook version to "1.0" and added a comment, directly relating to webhook version management in Pipedrive.

Suggested labels

ai-assisted

Poem

A hop, a skip, to version two,
Webhooks fresh, and payloads new!
Fields renamed, the data’s bright,
Events now parsed exactly right.
With every trigger, deals and folks,
This bunny’s code no longer croaks!
🐇✨

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/agentx/agentx.app.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 packageResolve (node:internal/modules/esm/resolve:839:9)
at moduleResolve (node:internal/modules/esm/resolve:908:18)
at defaultResolve (node:internal/modules/esm/resolve:1038:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:557:12)
at ModuleLoader.resolve (node:internal/modules/esm/loader:525:25)
at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:246:38)
at ModuleJob._link (node:internal/modules/esm/module_job:126:49)

components/ai_chatbot_hub/ai_chatbot_hub.app.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 packageResolve (node:internal/modules/esm/resolve:839:9)
at moduleResolve (node:internal/modules/esm/resolve:908:18)
at defaultResolve (node:internal/modules/esm/resolve:1038:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:557:12)
at ModuleLoader.resolve (node:internal/modules/esm/loader:525:25)
at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:246:38)
at ModuleJob._link (node:internal/modules/esm/module_job:126:49)

components/easyfill_ai/easyfill_ai.app.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 packageResolve (node:internal/modules/esm/resolve:839:9)
at moduleResolve (node:internal/modules/esm/resolve:908:18)
at defaultResolve (node:internal/modules/esm/resolve:1038:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:557:12)
at ModuleLoader.resolve (node:internal/modules/esm/loader:525:25)
at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:246:38)
at ModuleJob._link (node:internal/modules/esm/module_job:126:49)

  • 8 others

Tip

⚡💬 Agentic Chat (Pro Plan, General Availability)
  • We're introducing multi-step agentic chat in review comments and issue comments, within and outside of PR's. This feature enhances review and issue discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments and add commits to existing pull requests.

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3074664 and 6e841c1.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (11)
  • components/agentx/agentx.app.mjs (1 hunks)
  • components/ai_chatbot_hub/ai_chatbot_hub.app.mjs (1 hunks)
  • components/easyfill_ai/easyfill_ai.app.mjs (1 hunks)
  • components/ifthenpay/ifthenpay.app.mjs (1 hunks)
  • components/musicbrainz/musicbrainz.app.mjs (1 hunks)
  • components/notion_api_key/notion_api_key.app.mjs (1 hunks)
  • components/proprofs_knowledge_base/proprofs_knowledge_base.app.mjs (1 hunks)
  • components/riku_ai/riku_ai.app.mjs (1 hunks)
  • components/salesloft/salesloft.app.mjs (1 hunks)
  • components/screenshot_api/screenshot_api.app.mjs (1 hunks)
  • components/voicemaker/voicemaker.app.mjs (1 hunks)
✅ Files skipped from review due to trivial changes (11)
  • components/musicbrainz/musicbrainz.app.mjs
  • components/proprofs_knowledge_base/proprofs_knowledge_base.app.mjs
  • components/easyfill_ai/easyfill_ai.app.mjs
  • components/notion_api_key/notion_api_key.app.mjs
  • components/riku_ai/riku_ai.app.mjs
  • components/screenshot_api/screenshot_api.app.mjs
  • components/voicemaker/voicemaker.app.mjs
  • components/ifthenpay/ifthenpay.app.mjs
  • components/ai_chatbot_hub/ai_chatbot_hub.app.mjs
  • components/salesloft/salesloft.app.mjs
  • components/agentx/agentx.app.mjs
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: Verify TypeScript components
  • GitHub Check: pnpm publish
  • GitHub Check: Publish TypeScript components
  • GitHub Check: Lint Code Base

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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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 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: 5

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cd04a13 and 6111095.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (10)
  • components/pipedrive/package.json (1 hunks)
  • components/pipedrive/sources/common/base.mjs (2 hunks)
  • components/pipedrive/sources/new-deal-instant/new-deal-instant.mjs (1 hunks)
  • components/pipedrive/sources/new-deal-instant/test-event.mjs (1 hunks)
  • components/pipedrive/sources/new-person-instant/new-person-instant.mjs (1 hunks)
  • components/pipedrive/sources/new-person-instant/test-event.mjs (1 hunks)
  • components/pipedrive/sources/updated-deal-instant/test-event.mjs (1 hunks)
  • components/pipedrive/sources/updated-deal-instant/updated-deal-instant.mjs (1 hunks)
  • components/pipedrive/sources/updated-person-instant/test-event.mjs (1 hunks)
  • components/pipedrive/sources/updated-person-instant/updated-person-instant.mjs (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: pnpm publish
  • GitHub Check: Verify TypeScript components
  • GitHub Check: Publish TypeScript components
🔇 Additional comments (23)
components/pipedrive/sources/common/base.mjs (3)

23-23: Webhook API version updated correctly to 2.0

The update from webhook version "1.0" to "2.0" aligns with the PR objective to migrate to Pipedrive's v2 webhooks API.


36-36: Timestamp parsing adjusted for v2 payload structure

The timestamp extraction now correctly uses body.meta.timestamp instead of the previous body.current.update_time to match Pipedrive's v2 webhook payload structure.

Consider adding validation to handle potential format mismatches when parsing the timestamp:

-const ts = Date.parse(body.meta.timestamp);
+const ts = body.meta?.timestamp ? Date.parse(body.meta.timestamp) : Date.now();

39-39: Event ID reference updated for new payload structure

The event ID generation now correctly references body.data.id instead of body.current.id to align with the v2 webhook payload structure.

Consider adding defensive programming to handle potential payload format variations:

-id: `${body.data.id}-${ts}`,
+id: `${body.data?.id || body.current?.id || "unknown"}-${ts}`,
components/pipedrive/package.json (1)

3-3: Package version increment is appropriate

The package version increment from 0.3.12 to 0.3.13 follows proper semantic versioning practices for this type of API update.

components/pipedrive/sources/updated-person-instant/updated-person-instant.mjs (3)

9-9: Component version increment is appropriate

The version bump from 0.0.2 to 0.0.3 properly reflects the changes to webhook API integration.


16-16: Event action updated to match v2 webhook terminology

Changed from "updated" to "change" to align with Pipedrive's webhook v2 event action naming.


21-21: Updated reference to person ID in webhook payload

The reference to body.data.id correctly reflects the new structure in Pipedrive webhook v2 payload.

components/pipedrive/sources/new-person-instant/new-person-instant.mjs (3)

9-9: Component version increment is appropriate

The version bump from 0.0.2 to 0.0.3 properly reflects the changes to webhook API integration.


16-16: Event action updated to match v2 webhook terminology

Changed from "added" to "create" to align with Pipedrive's webhook v2 event action naming.


21-21: Updated reference to person ID in webhook payload

The reference to body.data.id correctly reflects the new structure in Pipedrive webhook v2 payload.

components/pipedrive/sources/new-deal-instant/new-deal-instant.mjs (3)

9-9: Version incremented correctly

The component version increment from "0.0.2" to "0.0.3" correctly reflects the changes to webhook API integration.


16-16: Event action updated to match Webhooks v2 terminology

The change from "added" to "create" aligns with Pipedrive's Webhooks API v2 event action terminology.


21-21: Summary method updated for new event payload structure

The update to reference body.data.id instead of body.current.id correctly handles the new webhook payload structure in v2.

components/pipedrive/sources/updated-deal-instant/updated-deal-instant.mjs (3)

9-9: Version incremented correctly

The component version increment from "0.0.2" to "0.0.3" properly reflects the changes to webhook API integration.


16-16: Event action updated to match Webhooks v2 terminology

The change from "updated" to "change" aligns with Pipedrive's Webhooks API v2 event action terminology.


21-21: Summary method updated for new event payload structure

The update to reference body.data.id instead of body.current.id correctly handles the new webhook payload structure in v2.

components/pipedrive/sources/updated-deal-instant/test-event.mjs (2)

3-17: Meta object updated for Webhooks v2 format

The meta object structure has been properly updated to follow Pipedrive's Webhooks API v2 format, including the appropriate version identifier and new required fields.


19-50: Event data structure updated from 'current' to 'data'

The event payload structure has been correctly updated from using a 'current' object to using a 'data' object, following Pipedrive's Webhooks API v2 format.

components/pipedrive/sources/updated-person-instant/test-event.mjs (2)

3-17: Meta object updated for Webhooks v2 format

The meta object structure has been properly updated to follow Pipedrive's Webhooks API v2 format, including the appropriate version identifier and new required fields.


19-34: Event data structure updated from 'current' to 'data'

The event payload structure has been correctly updated from using a 'current' object to using a 'data' object, following Pipedrive's Webhooks API v2 format.

components/pipedrive/sources/new-deal-instant/test-event.mjs (1)

3-17: Meta structure correctly updated for webhook v2 format

The meta structure has been properly updated to match Pipedrive's webhook v2 format with all required fields. The action value has been changed from "added" to "create" and object has been renamed to "entity", reflecting the new webhook schema.

components/pipedrive/sources/new-person-instant/test-event.mjs (2)

3-17: Meta structure correctly updated for webhook v2 format

The meta structure has been properly updated to match Pipedrive's webhook v2 format with all required fields. The action value has been changed from "added" to "create" and object has been renamed to "entity".


19-34: Person data structure correctly updated to v2 format

The data structure for the person object has been simplified to match Pipedrive's webhook v2 format with appropriate fields for a person entity. The relevant fields like name, first_name, emails, phones, etc. are correctly included.

lcaresia
lcaresia previously approved these changes Apr 17, 2025
@luancazarine
Copy link
Collaborator Author

/approve

@luancazarine luancazarine requested a review from lcaresia April 22, 2025 14:37
@luancazarine luancazarine merged commit 01bc71d into master Apr 22, 2025
11 checks passed
@luancazarine luancazarine deleted the 16246-feature-update-pipedrive-to-use-webhooks-v2 branch April 22, 2025 21:28
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.

[FEATURE] Update Pipedrive to use Webhooks v2
2 participants