-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Highlevel Oauth - New Components #16462
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?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ |
WalkthroughThis update introduces several new actions and sources to the HighLevel OAuth integration, including the ability to create and update custom object records, update notes, and detect updates to contacts, notes, and records via polling sources. The HighLevel app module is expanded with new property definitions and API methods to support these features. Several existing actions and sources have their version numbers incremented. Utility functions are improved for safer parsing, and new test event files are added for source testing. The package version is incremented and a new dependency ( Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Action
participant App
participant HighLevelAPI
User->>Action: Trigger (e.g., Create Record, Update Note)
Action->>App: Call corresponding method (e.g., createRecord, updateNote)
App->>HighLevelAPI: Make HTTP request (POST/PUT)
HighLevelAPI-->>App: Respond with result
App-->>Action: Return response
Action-->>User: Output result/summary
sequenceDiagram
participant Source (Polling)
participant App
participant HighLevelAPI
participant Store
loop On schedule
Source->>App: Fetch entities (contacts, notes, records)
App->>HighLevelAPI: GET/POST for entities
HighLevelAPI-->>App: Return entities
App-->>Source: Return data
Source->>Store: Retrieve previous hashes
Source->>Source: Compare hashes for changes
alt If change detected
Source->>User: Emit event with metadata
end
Source->>Store: Update hashes
end
Assessment against linked issues
Possibly related PRs
Suggested labels
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/highlevel_oauth/actions/add-contact-to-campaign/add-contact-to-campaign.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/highlevel_oauth/actions/create-contact/create-contact.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/highlevel_oauth/actions/create-record/create-record.mjsOops! Something went wrong! :( ESLint: 8.57.1 Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs
✨ 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:
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: 7
🧹 Nitpick comments (8)
components/highlevel_oauth/sources/note-updated/note-updated.mjs (2)
39-61
: Improve the update detection logicThe current implementation detects updates by comparing MD5 hashes of the entire note object, which works but has limitations.
Consider enhancing the update detection to be more specific:
- Only calculate hash on relevant fields that indicate an update (like
body
,updatedAt
)- Add a debug log to show which notes were updated and what changed
- const hash = md5(JSON.stringify(note)); + // Only hash the relevant fields to detect meaningful updates + const hashData = { + body: note.body, + updatedAt: note.updatedAt, + }; + const hash = md5(JSON.stringify(hashData)); if (noteValues[note.id] && noteValues[note.id] !== hash) { + console.log(`Note ${note.id} was updated`); results.push(note); }This would make the update detection more precise and easier to debug.
23-38
: Add protection against undefined DB valuesThe method for getting note values doesn't protect against the possibility of the DB not being initialized yet.
Consider adding a default parameter to ensure
_getNoteValues
always returns an object:_getNoteValues() { - return this.db.get("noteValues") || {}; + return this.db.get("noteValues") ?? {}; }Using the nullish coalescing operator (
??
) is slightly better than||
as it only returns the right-hand side when the left isnull
orundefined
, not any falsy value.components/highlevel_oauth/sources/contact-updated/contact-updated.mjs (2)
7-9
: Update source name to follow component guidelines.According to Pipedream's component guidelines, source names should start with "New". Consider renaming from "Contact Updated" to "New Contact Updated" to comply with the guidelines.
- name: "Contact Updated", + name: "New Contact Updated",🧰 Tools
🪛 GitHub Check: Lint Code Base
[warning] 8-8:
Source names should start with "New". See https://pipedream.com/docs/components/guidelines/#source-name
24-26
: Enhance ID uniqueness for better deduplication.The current ID generation uses contact ID + timestamp. While this works for deduplication within a single run, it might be better to include more context for better debugging and traceability.
return { - id: `${contact.id}${ts}`, + id: `${contact.id}-${ts}`, summary: `Contact Updated w/ ID: ${contact.id}`, ts, };components/highlevel_oauth/sources/record-updated/record-updated.mjs (2)
7-9
: Update source name to follow component guidelines.According to Pipedream's component guidelines, source names should start with "New". Consider renaming from "Record Updated" to "New Record Updated" to comply with the guidelines.
- name: "Record Updated", + name: "New Record Updated",🧰 Tools
🪛 GitHub Check: Lint Code Base
[warning] 7-7:
Source names should start with "New". See https://pipedream.com/docs/components/guidelines/#source-name
32-35
: Enhance ID uniqueness for better deduplication.The current ID generation uses record ID + timestamp. While this works for deduplication within a single run, it might be better to include more context for better debugging and traceability.
return { - id: `${record.id}${ts}`, + id: `${record.id}-${ts}`, summary: `Record ${createdOrUpdated} w/ ID: ${record.id}`, ts, };components/highlevel_oauth/highlevel_oauth.app.mjs (2)
56-65
: Enhance note options with more context for better selection.The current implementation displays only the first 50 characters of the note body as the label, which might not provide enough context for users to select the correct note, especially if notes have similar beginnings.
return notes?.map(({ - id: value, body, + id: value, body, createdAt, }) => ({ - label: body.slice(0, 50), + label: `${body.slice(0, 40)}... (${new Date(createdAt).toLocaleString() || 'No date'})`, value, })) || [];
121-126
: Enhance properties documentation with schema reference.The current description provides an example but lacks information about what properties are available or required for different schema types. Consider adding a reference to how users can discover the expected properties for their specific schema.
properties: { type: "object", label: "Properties", - description: "Properties of the record as key/value pairs. Example: `{\"customer_number\":1424,\"ticket_name\":\"Customer not able login\",\"phone_number\":\"+917000000000\"}`", + description: "Properties of the record as key/value pairs. The available properties depend on the selected Object Schema. You can view required and optional properties in the HighLevel UI under Settings > Custom Objects. Example: `{\"customer_number\":1424,\"ticket_name\":\"Customer not able login\",\"phone_number\":\"+917000000000\"}`", optional: true, },
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yaml
is excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (17)
components/highlevel_oauth/actions/add-contact-to-campaign/add-contact-to-campaign.mjs
(1 hunks)components/highlevel_oauth/actions/create-contact/create-contact.mjs
(1 hunks)components/highlevel_oauth/actions/create-record/create-record.mjs
(1 hunks)components/highlevel_oauth/actions/update-contact/update-contact.mjs
(1 hunks)components/highlevel_oauth/actions/update-note/update-note.mjs
(1 hunks)components/highlevel_oauth/actions/update-record/update-record.mjs
(1 hunks)components/highlevel_oauth/actions/upsert-contact/upsert-contact.mjs
(1 hunks)components/highlevel_oauth/common/utils.mjs
(1 hunks)components/highlevel_oauth/highlevel_oauth.app.mjs
(3 hunks)components/highlevel_oauth/package.json
(2 hunks)components/highlevel_oauth/sources/contact-updated/contact-updated.mjs
(1 hunks)components/highlevel_oauth/sources/contact-updated/test-event.mjs
(1 hunks)components/highlevel_oauth/sources/new-contact-created/new-contact-created.mjs
(1 hunks)components/highlevel_oauth/sources/new-form-submission/new-form-submission.mjs
(1 hunks)components/highlevel_oauth/sources/note-updated/note-updated.mjs
(1 hunks)components/highlevel_oauth/sources/note-updated/test-event.mjs
(1 hunks)components/highlevel_oauth/sources/record-updated/record-updated.mjs
(1 hunks)
🧰 Additional context used
🪛 GitHub Check: Lint Code Base
components/highlevel_oauth/sources/contact-updated/contact-updated.mjs
[warning] 8-8:
Source names should start with "New". See https://pipedream.com/docs/components/guidelines/#source-name
components/highlevel_oauth/sources/record-updated/record-updated.mjs
[warning] 7-7:
Source names should start with "New". See https://pipedream.com/docs/components/guidelines/#source-name
components/highlevel_oauth/sources/note-updated/note-updated.mjs
[warning] 8-8:
Source names should start with "New". See https://pipedream.com/docs/components/guidelines/#source-name
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: pnpm publish
🔇 Additional comments (11)
components/highlevel_oauth/sources/note-updated/test-event.mjs (1)
1-9
: Approve test-event schema for Note Updated source.
The exported sample event includes all required fields (id
,body
,userId
,dateAdded
,contactId
,businessId
,relations
) and follows the expected structure for the polling source.components/highlevel_oauth/sources/contact-updated/test-event.mjs (1)
1-41
: Approve test-event schema for Contact Updated source.
The sample event covers a comprehensive set of contact attributes and metadata, matching the contract used by thecontact-updated
source component.components/highlevel_oauth/package.json (1)
3-4
: Verify package version and new dependency.
Version bump to0.3.0
and addition ofmd5@^2.3.0
look correct. Please confirm that all new source modules import and utilizemd5
, and that this dependency upgrade does not introduce compatibility issues.Also applies to: 16-17
components/highlevel_oauth/actions/update-contact/update-contact.mjs (1)
14-14
: Approve version bump for Update Contact action.
The version has been updated from0.0.2
to0.0.3
without changes to the logic. This aligns with the coordinated release versioning.components/highlevel_oauth/sources/new-contact-created/new-contact-created.mjs (1)
9-9
: Approve version bump for New Contact Created source.
Updated version from0.0.1
to0.0.2
, consistent with other source component releases.components/highlevel_oauth/actions/create-contact/create-contact.mjs (1)
14-14
: Version bump looks good.The increment from "0.0.3" is consistent with the version updates in other contact-related actions in this PR. This coordination helps maintain version alignment across the HighLevel OAuth integration components.
components/highlevel_oauth/actions/add-contact-to-campaign/add-contact-to-campaign.mjs (1)
8-8
: Version bump is appropriate.The increment from "0.0.1" to "0.0.2" aligns with the version updates across other HighLevel OAuth components in this PR, maintaining consistent versioning throughout the integration.
components/highlevel_oauth/actions/upsert-contact/upsert-contact.mjs (1)
14-14
: Version update is consistent with related components.The version increment to "0.0.3" maintains consistency with other contact management actions in this PR (like create-contact.mjs), ensuring synchronized versioning across the HighLevel OAuth integration.
components/highlevel_oauth/sources/new-form-submission/new-form-submission.mjs (1)
9-9
: Version increment is appropriate.The version update from "0.0.1" to "0.0.2" is in line with the versioning strategy across the HighLevel OAuth integration. This source component's version is appropriately incremented as part of the broader enhancement to the component suite.
components/highlevel_oauth/common/utils.mjs (1)
10-12
: Good defensive programming enhancement.Adding an early return for falsy values is an excellent improvement that prevents potential errors when parsing null or undefined inputs. This makes the utility function more robust when handling optional fields like
properties
in the newly added record management actions.This change follows best practices for error handling in API integrations where input data quality can vary. It ensures the function gracefully handles edge cases rather than attempting to parse invalid inputs.
components/highlevel_oauth/actions/update-note/update-note.mjs (1)
1-46
: Clean implementation for note updatesThe action component is well-structured and follows the common pattern. The dynamic filtering of noteId options based on contactId is a good UX enhancement.
Resolves #16290
FYI, the record related components are untested.
Summary by CodeRabbit
New Features
Bug Fixes
Chores