Skip to content
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

New Components - kommo #12549

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

New Components - kommo #12549

wants to merge 4 commits into from

Conversation

luancazarine
Copy link
Collaborator

@luancazarine luancazarine commented Jun 24, 2024

Resolves #12547.

Summary by CodeRabbit

  • New Features

    • Introduced "Create Lead" action to easily create new leads in the Kommo app.
    • Added "Search Companies" action to search for companies within Kommo based on various filters.
    • Added "Update Contact" action to update existing contact details in Kommo.
    • New "New Company (Instant)" source component to emit events when a new company is created.
    • New "New Contact (Instant)" source component to emit events when a new contact is created.
    • New "New Lead (Instant)" source component to emit events when a new lead is created.
  • Enhancements

    • Added multiple properties and methods to support various API interactions within the Kommo app.
    • Updated version to 0.1.0 and added new dependency in the package configuration.
  • Utilities

    • Introduced a utility function to parse JSON strings within objects or arrays.
  • Event Handling

    • Added methods to handle and emit events for new companies, contacts, and leads in real-time.

@luancazarine luancazarine added the ai-assisted Content generated by AI, with human refinement and modification label Jun 24, 2024
Copy link

vercel bot commented Jun 24, 2024

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

3 Ignored Deployments
Name Status Preview Comments Updated (UTC)
docs-v2 ⬜️ Ignored (Inspect) Visit Preview Jun 25, 2024 8:00pm
pipedream-docs ⬜️ Ignored (Inspect) Jun 25, 2024 8:00pm
pipedream-docs-redirect-do-not-edit ⬜️ Ignored (Inspect) Jun 25, 2024 8:00pm

Copy link
Contributor

coderabbitai bot commented Jun 24, 2024

Walkthrough

Recent updates have added multiple new actions and sources for the Kommo app, including creating leads, updating contacts, and searching for companies. Additionally, the package version has been incremented, and a new utility for parsing JSON strings has been introduced. These enhancements streamline the integration with Kommo’s API, facilitating robust CRM data management through automated workflows.

Changes

File Path Change Summary
components/kommo/actions/create-lead/... Introduced "Create Lead" action to allow users to add new leads.
components/kommo/actions/search-companies/... Added "Search Companies" action for finding companies with various filters.
components/kommo/actions/update-contact/... Created "Update Contact" action to update existing contact details.
components/kommo/common/utils.mjs Introduced parseObject utility function for parsing JSON strings within objects or arrays.
components/kommo/kommo.app.mjs Added prop definitions and methods for interacting with Kommo API endpoints, including creating leads, listing entities, and managing webhooks.
components/kommo/package.json Updated version from 0.0.1 to 0.1.0; added @pipedream/platform dependency.
components/kommo/sources/common/base.mjs Added base definitions and methods for new sources, including generating metadata and handling webhooks.
components/kommo/sources/new-company-instant/... Introduced "New Company (Instant)" source to emit events when a company is created.
components/kommo/sources/new-contact-instant/... Added "New Contact (Instant)" source to emit events when a contact is created.
components/kommo/sources/new-lead-instant/... Implemented "New Lead (Instant)" source to emit events when a lead is created.
components/kommo/sources/new-lead-instant/test-... Provided test event in test-event.mjs to represent account and contact details used in CRM.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Kommo App
    participant API

    User->>Kommo App: Create Lead (name, price, pipelineId, statusId)
    Kommo App->>API: Create Lead Request
    API->>Kommo App: Lead Created Response
    Kommo App->>User: Lead Creation Confirmation

    User->>Kommo App: Search Companies (filters)
    Kommo App->>API: Search Companies Request
    API->>Kommo App: Companies List Response
    Kommo App->>User: Return Companies List

    User->>Kommo App: Update Contact (contactId, new details)
    Kommo App->>API: Update Contact Request
    API->>Kommo App: Contact Updated Response
    Kommo App->>User: Contact Update Confirmation
Loading

Assessment against linked issues

Objective Addressed Explanation
New event source for when a company is created (#12547)
New event source for when a lead is created (#12547)
New event source for when a contact is created (#12547)
Action to create a lead (#12547)
Action to update a contact (#12547)
Search for companies with filters (#12547)

Poem

In fields of code where components grow,
New leads sprout and companies flow.
With contacts updated swift and neat,
Kommo's features are now complete.
A platform enhanced, workflows refined,
In the garden of CRM, success aligned. 🌸


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration 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.

Sources
 - New Company (Instant)
 - New Lead (Instant)
 - New Contact (Instant)

Actions
 - Create Lead
 - Update Contact
 - Search Companies
@luancazarine luancazarine marked this pull request as ready for review June 25, 2024 20:00
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: 2

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 86e2d76 and 7cad1de.

Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
Files selected for processing (13)
  • components/kommo/actions/create-lead/create-lead.mjs (1 hunks)
  • components/kommo/actions/search-companies/search-companies.mjs (1 hunks)
  • components/kommo/actions/update-contact/update-contact.mjs (1 hunks)
  • components/kommo/common/utils.mjs (1 hunks)
  • components/kommo/kommo.app.mjs (1 hunks)
  • components/kommo/package.json (2 hunks)
  • components/kommo/sources/common/base.mjs (1 hunks)
  • components/kommo/sources/new-company-instant/new-company-instant.mjs (1 hunks)
  • components/kommo/sources/new-company-instant/test-event.mjs (1 hunks)
  • components/kommo/sources/new-contact-instant/new-contact-instant.mjs (1 hunks)
  • components/kommo/sources/new-contact-instant/test-event.mjs (1 hunks)
  • components/kommo/sources/new-lead-instant/new-lead-instant.mjs (1 hunks)
  • components/kommo/sources/new-lead-instant/test-event.mjs (1 hunks)
Files skipped from review due to trivial changes (2)
  • components/kommo/sources/new-contact-instant/test-event.mjs
  • components/kommo/sources/new-lead-instant/test-event.mjs
Additional comments not posted (10)
components/kommo/package.json (2)

3-3: Version Update Approved

The version update from "0.0.1" to "0.1.0" is appropriate given the significant feature additions described in the PR.


16-16: New Dependency Review

The addition of "@pipedream/platform" ^3.0.0 is appropriate for supporting the platform-specific functionalities being introduced. Ensure compatibility with existing components.

components/kommo/common/utils.mjs (1)

1-23: Review of parseObject Function

The function handles both strings and arrays, attempting to parse JSON strings. The error handling is appropriate, returning the original item if parsing fails. This utility function is well-written and should handle expected inputs correctly.

However, consider adding detailed comments explaining the function's behavior and expected inputs/outputs for better maintainability.

components/kommo/sources/new-company-instant/new-company-instant.mjs (1)

4-24: Review of New Company Instant Source Component

The component is well-structured, inheriting common properties and methods effectively. The getEvents and getSummary methods are correctly implemented to handle the specified webhook event and generate a summary.

Ensure the body parameter structure in getSummary matches the expected webhook payload.

components/kommo/sources/new-lead-instant/new-lead-instant.mjs (1)

4-28: Review of New Lead Instant Source Component

This component is consistent with the previously reviewed source components, effectively using inheritance and implementing methods. The generateMeta method is particularly well-implemented, extracting and formatting data from the body. Ensure the body structure used matches the expected webhook payload.

Verification successful

Verification of generateMeta Method in new-lead-instant Component

The generateMeta method in the new-lead-instant component expects the body parameter to contain specific fields related to leads. The sampleEmit and common files indicate that the body structure is consistent with the expected webhook payload.

  • The body parameter includes fields such as leads[add][0][id], leads[add][0][name], and leads[add][0][created_at], which are used in the generateMeta method.

This confirms that the generateMeta method is correctly implemented to handle the webhook payload.

  • File: components/kommo/sources/new-lead-instant/new-lead-instant.mjs
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the structure of `body` parameter in `generateMeta` matches the expected webhook payload.

# Test: Search for the function usage. Expect: Only occurances of the new signature.
rg --type python $'generateMeta'

Length of output: 62



Script:

#!/bin/bash
# Description: Verify the structure of `body` parameter in `generateMeta` matches the expected webhook payload.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg 'generateMeta' --type js

Length of output: 756



Script:

#!/bin/bash
# Description: Verify the structure of `body` parameter in `generateMeta` matches the expected webhook payload.

# Search for documentation or comments related to the webhook payload structure.
rg 'webhook' --type md
rg 'payload' --type md

Length of output: 112101



Script:

#!/bin/bash
# Description: Verify the structure of `body` parameter in `generateMeta` matches the expected webhook payload.

# Search for webhook configuration or implementation in the `kommo` component files.
rg 'webhook' --type js
rg 'kommo-new-lead-instant' --type js

Length of output: 577



Script:

#!/bin/bash
# Description: Verify the structure of `body` parameter in `generateMeta` matches the expected webhook payload.

# Search for the `common` object and `sampleEmit` in the `kommo` component files.
rg 'common' --type js
rg 'sampleEmit' --type js

Length of output: 3110



Script:

#!/bin/bash
# Description: Verify the structure of `body` parameter in `generateMeta` matches the expected webhook payload.

# List files in the `components/kommo` directory.
fd . --type f --search-path components/kommo

# Search for `common` and `sampleEmit` within the `components/kommo` directory files.
rg 'common' components/kommo
rg 'sampleEmit' components/kommo

Length of output: 2311



Script:

#!/bin/bash
# Description: Display the contents of `base.mjs` and `test-event.mjs` to verify the structure of `body` parameter in `generateMeta`.

# Display the contents of `base.mjs`.
cat components/kommo/sources/common/base.mjs

# Display the contents of `test-event.mjs`.
cat components/kommo/sources/new-lead-instant/test-event.mjs

Length of output: 1709

components/kommo/sources/new-company-instant/test-event.mjs (1)

1-17: Review of Test Event Structure for New Company Instant

The structure of the test event data looks comprehensive and correctly formatted. It includes necessary fields such as account links, IDs, timestamps, and other relevant data, which should be sufficient for testing the new company instantiation functionality. Ensure that these fields match the data structure expected by the components that will use this test event.

components/kommo/sources/common/base.mjs (2)

3-46: Review of Base Component Configuration

The base component is well-configured with essential properties like db and http, and methods for metadata generation and webhook management. The use of async hooks for activating and deactivating webhooks is a good practice, ensuring that resources are managed efficiently.


1-1: Check Import of kommo Module

Ensure that the kommo module is correctly imported and accessible within this file. This is crucial for the component to function properly, as it relies on methods from the kommo module.

Verification successful

The kommo module is correctly imported and accessible within base.mjs. The kommo.app.mjs file defines various methods and properties that are essential for the component's functionality.

Check Import of kommo Module

The kommo module is correctly imported and accessible within this file. The methods and properties defined in kommo.app.mjs are available for use, ensuring the component functions properly.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Verify that the kommo module is correctly set up and accessible.
cat components/kommo/kommo.app.mjs

Length of output: 4974

components/kommo/actions/create-lead/create-lead.mjs (1)

4-65: Comprehensive Review of Create Lead Action

The Create Lead action is well-defined with appropriate properties and an asynchronous run method. The integration of the parseObject utility function to handle custom fields is a good practice, ensuring data integrity before making API calls. The method's implementation appears robust, handling the creation process and providing a summary of the action.

However, ensure that error handling is robust, especially regarding API call failures or data parsing issues.

components/kommo/actions/update-contact/update-contact.mjs (1)

3-65: Detailed Review of Update Contact Action

The Update Contact action is thoroughly defined with detailed and optional properties, enhancing flexibility in specifying which contact details to update. The asynchronous run method is well-implemented, handling the update process and providing a summary of the action. Ensure that the method includes adequate error handling for API call failures and data integrity issues.

Consider adding error handling to improve robustness.

components/kommo/kommo.app.mjs Show resolved Hide resolved
components/kommo/kommo.app.mjs Show resolved Hide resolved
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 @luancazarine lgtm! Ready for QA!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ai-assisted Content generated by AI, with human refinement and modification
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Components] kommo
2 participants