-
Notifications
You must be signed in to change notification settings - Fork 5.5k
18199 action hubspot workflow api #18348
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
Conversation
- Implemented new actions for managing workflows in HubSpot, including: - Create a new workflow - Retrieve workflow details - Retrieve emails associated with a workflow - Retrieve multiple workflows by their IDs - Retrieve migrated workflow mappings - Update an existing workflow - Delete a workflow - Added corresponding methods in the hubspot.app.mjs for API interactions. - Updated constants and added necessary props for each action.
- Refactored workflow-related actions to align with the v4 API, including: - Updated endpoints and request structures for creating, retrieving, updating, and deleting workflows. - Added new properties for workflow creation and management, such as `isEnabled`, `actions`, and `enrollmentCriteria`. - Enhanced error handling and response parsing for better integration. - Bumped package version to 1.7.0 to reflect these changes.
- Deleted the `retrieve-batch-workflows` action from HubSpot components as part of the ongoing refactor to streamline workflow management actions. - Updated the `update-workflow` action to change the `revisionId` type from string to integer for better data integrity.
- Bumped version numbers for multiple HubSpot actions and sources to reflect recent updates and improvements. - Actions updated include: add-contact-to-list, batch-create-companies, batch-update-companies, create-associations, create-communication, and more. - Sources updated include: new-company-property-change, new-contact-property-change, new-deal-property-change, and others. - Ensured consistency across versioning for better management and tracking of changes.
- Updated workflow-related actions to utilize the v3 API instead of v4. - Renamed variables for clarity and consistency. - Removed deprecated props from create and update workflow actions. - Adjusted descriptions in action components to reflect the new API documentation. - Bumped versions for several source components to maintain compatibility.
…maintain compatibility with the latest API changes.
…ibility with the latest API changes.
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
WalkthroughBumped version fields: the HubSpot batch-upsert-companies action from 0.0.6 to 0.0.7 and the HubSpot package from 1.7.2 to 1.7.3. No code, logic, inputs, or control flow changes. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Pre-merge checks (1 passed, 4 warnings)❌ Failed checks (4 warnings)
✅ Passed checks (1 passed)
Poem
✨ Finishing touches
🧪 Generate unit tests
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. 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.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
components/hubspot/actions/batch-upsert-companies/batch-upsert-companies.mjs (1)
48-52
: Brittle error parsing can throw in the catch block. Replace with resilient extraction.Nested
JSON.parse
+ regex splits assume a very specific error shape and will themselves throw, masking the original error. Prefer checkingerror.response?.data
(Axios), HubSpot error arrays, and falling back toerror.message
.Apply:
- } catch (error) { - const message = JSON.parse( - JSON.parse(error.message).message.split(/:(.+)/)[1], - )[0].message; - throw new ConfigurationError(message.split(/:(.+)/)[0]); - } + } catch (error) { + // Prefer Axios / HubSpot error structures, with safe fallbacks + const data = error?.response?.data; + const message = + data?.message + ?? data?.errors?.[0]?.message + ?? data?.status + ?? error?.message + ?? "Unknown error"; + throw new ConfigurationError(String(message)); + }
🧹 Nitpick comments (4)
components/hubspot/package.json (1)
3-3
: Patch bump looks fine, but PR scope doesn’t match the objective.This PR only bumps the HubSpot package version to 1.7.3. The PR title/issue #18199 requests new HubSpot Workflow API actions (flows CRUD, batch read, mappings, emails). None of those files are included here. Please confirm whether:
- This PR is intentionally scoped to a republish/version bump, or
- The Workflow actions are missing and should be added to this PR (or a separate PR), and the title/description updated accordingly.
If you want, I can scaffold action files for the Workflow endpoints listed in the issue.
components/hubspot/actions/batch-upsert-companies/batch-upsert-companies.mjs (3)
21-25
: Validate and normalizeinputs
before sending.
inputs
is declared as astring[]
, then passed throughparseObject
. Depending on UI serialization, this can be an array already or a JSON string; if parsing fails or returns a non-array, the request will 400. Add normalization + schema validation and fail fast with a clear message.Proposed change:
inputs: { type: "string[]", label: "Inputs (Companies)", description: "Provide a **list of companies** to be upserted. [See the documentation](https://developers.hubspot.com/docs/reference/api/crm/objects/companies#post-%2Fcrm%2Fv3%2Fobjects%2Fcompanies%2Fbatch%2Fupsert) for more information. Example: `[ { \"idProperty\": \"unique_property\", \"id\": \"123\", \"properties\": { \"name\": \"CompanyName\" } } ]`", },- inputs: parseObject(this.inputs), + inputs: Array.isArray(this.inputs) + ? this.inputs + : parseObject(this.inputs),Optionally, guard against bad shapes:
+ if (!Array.isArray(inputs) || inputs.some((i) => typeof i !== "object")) { + throw new ConfigurationError("`inputs` must be an array of objects"); + }
45-46
: Defensive summary to avoid crashes whenresults
is absent.Some HubSpot errors still return 200 with partials, or network retries might return undefined. Guard
results
to avoid a TypeError.- $.export("$summary", `Upserted ${response.results.length} companies`); + $.export("$summary", `Upserted ${response?.results?.length ?? 0} companies`);
1-55
: Scope gap: Workflow API actions are missing from this PR.Per issue #18199, we need actions for:
- GET /automation/v4/flows/email-campaigns
- GET /automation/v4/flows/{flowId}
- GET /automation/v4/flows
- POST /automation/v4/flows
- POST /automation/v4/flows/batch/read
- PUT /automation/v4/flows/{flowId}
- DELETE /automation/v4/flows/{flowId}
- POST /automation/v4/workflow-id-mappings/batch/read
Please add these actions (or open a separate PR) and wire them to
hubspot.makeRequest
under anautomation/v4
API path constant. I can provide scaffolds matching the existing action patterns.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
components/hubspot/actions/batch-upsert-companies/batch-upsert-companies.mjs
(1 hunks)components/hubspot/package.json
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: Publish TypeScript components
- GitHub Check: Lint Code Base
- GitHub Check: Verify TypeScript components
🔇 Additional comments (1)
components/hubspot/actions/batch-upsert-companies/batch-upsert-companies.mjs (1)
10-10
: Version bump only — no functional change.Safe to publish as a patch to re-release metadata or docs updates.
Resolves #18199
Summary by CodeRabbit