-
Notifications
You must be signed in to change notification settings - Fork 5.5k
18199 action hubspot workflow api #18252
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
Merged
Changes from 8 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
9539dd4
Add HubSpot Workflow Management Actions
luancazarine 9620829
pnpm update
luancazarine 694d552
Update HubSpot Workflow Management Actions
luancazarine 8a9e21d
Remove Retrieve Batch Workflows Action
luancazarine b1cb28b
Update HubSpot Actions and Sources Versions
luancazarine e62ab48
Merge branch 'master' into 18199-action-hubspot-workflow-api
luancazarine 9fb867c
Refactor HubSpot workflow actions to use v3 API endpoints
luancazarine 93842d6
Merge branch 'master' into 18199-action-hubspot-workflow-api
luancazarine aba4264
Update versions for multiple HubSpot action and source components to …
luancazarine 8d0ee1b
Update version numbers for HubSpot source components to ensure compat…
luancazarine File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
components/hubspot/actions/create-workflow/create-workflow.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| import { parseObject } from "../../common/utils.mjs"; | ||
| import hubspot from "../../hubspot.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "hubspot-create-workflow", | ||
| name: "Create a New Workflow", | ||
| description: "Create a new workflow. [See the documentation](https://developers.hubspot.com/docs/api-reference/legacy/create-manage-workflows-v3/post-automation-v3-workflows)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| hubspot, | ||
| name: { | ||
| type: "string", | ||
| label: "Workflow Name", | ||
| description: "The name of the workflow to create", | ||
| }, | ||
| type: { | ||
| propDefinition: [ | ||
| hubspot, | ||
| "type", | ||
| ], | ||
| }, | ||
| actions: { | ||
| propDefinition: [ | ||
| hubspot, | ||
| "actions", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.hubspot.createWorkflow({ | ||
| data: { | ||
| name: this.name, | ||
| type: this.type, | ||
| actions: parseObject(this.actions), | ||
| }, | ||
| $, | ||
| }); | ||
|
|
||
| $.export("$summary", `Successfully created workflow: ${this.name}`); | ||
| return response; | ||
| }, | ||
| }; |
28 changes: 28 additions & 0 deletions
28
components/hubspot/actions/delete-workflow/delete-workflow.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| import hubspot from "../../hubspot.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "hubspot-delete-workflow", | ||
| name: "Delete a Workflow", | ||
| description: "Delete a workflow by ID. [See the documentation](https://developers.hubspot.com/docs/api-reference/legacy/create-manage-workflows-v3/delete-automation-v3-workflows-workflowId)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| hubspot, | ||
| workflowId: { | ||
| propDefinition: [ | ||
| hubspot, | ||
| "workflow", | ||
| ], | ||
| description: "The ID of the workflow to delete", | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.hubspot.deleteWorkflow({ | ||
| workflowId: this.workflowId, | ||
| $, | ||
| }); | ||
|
|
||
| $.export("$summary", `Successfully deleted workflow ${this.workflowId}`); | ||
| return response; | ||
| }, | ||
| }; |
72 changes: 72 additions & 0 deletions
72
...bspot/actions/retrieve-migrated-workflow-mappings/retrieve-migrated-workflow-mappings.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| import { parseObject } from "../../common/utils.mjs"; | ||
| import hubspot from "../../hubspot.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "hubspot-retrieve-migrated-workflow-mappings", | ||
| name: "Retrieve Migrated Workflow Mappings", | ||
| description: "Retrieve the IDs of v3 workflows that have been migrated to the v4 API. [See the documentation](https://developers.hubspot.com/docs/api-reference/automation-automation-v4-v4/workflow-id-mappings/post-automation-v4-workflow-id-mappings-batch-read)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| hubspot, | ||
| flowIds: { | ||
| propDefinition: [ | ||
| hubspot, | ||
| "workflow", | ||
| () => ({ | ||
| version: "V4", | ||
| }), | ||
| ], | ||
| type: "string[]", | ||
| label: "Flow IDs", | ||
| description: "A list of flowIds from the V4 API.", | ||
| optional: true, | ||
| }, | ||
| workflow: { | ||
luancazarine marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| propDefinition: [ | ||
| hubspot, | ||
| "workflow", | ||
| () => ({ | ||
| version: "V3", | ||
| }), | ||
| ], | ||
| type: "string[]", | ||
| label: "Workflow IDs", | ||
| description: "A list of workflowIds from the V3 API.", | ||
| optional: true, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const parsedFlowIds = parseObject(this.flowIds) || []; | ||
| const parsedWorkflowIds = parseObject(this.workflowIds) || []; | ||
|
|
||
| const flowIds = []; | ||
| const workflowIds = []; | ||
|
|
||
| for (const flowId of parsedFlowIds) { | ||
| flowIds.push({ | ||
| flowMigrationStatuses: `${flowId}`, | ||
| type: "FLOW_ID", | ||
| }); | ||
| } | ||
| for (const workflowId of parsedWorkflowIds) { | ||
| workflowIds.push({ | ||
| flowMigrationStatusForClassicWorkflows: `${workflowId}`, | ||
| type: "WORKFLOW_ID", | ||
| }); | ||
| } | ||
luancazarine marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| const response = await this.hubspot.getMigratedWorkflowMappings({ | ||
| $, | ||
| data: { | ||
| inputs: [ | ||
| ...flowIds, | ||
| ...workflowIds, | ||
| ], | ||
| }, | ||
| }); | ||
|
|
||
| $.export("$summary", `Successfully retrieved ${response.results.length} migrated result(s) with ${response.errors?.length || 0} error(s)`); | ||
| return response; | ||
| }, | ||
| }; | ||
29 changes: 29 additions & 0 deletions
29
components/hubspot/actions/retrieve-workflow-details/retrieve-workflow-details.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| import hubspot from "../../hubspot.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "hubspot-retrieve-workflow-details", | ||
| name: "Retrieve Workflow Details", | ||
| description: "Retrieve detailed information about a specific workflow. [See the documentation](https://developers.hubspot.com/docs/api-reference/legacy/create-manage-workflows-v3/get-automation-v3-workflows-workflowId)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| hubspot, | ||
| workflowId: { | ||
| propDefinition: [ | ||
| hubspot, | ||
| "workflow", | ||
| ], | ||
| label: "Workflow ID", | ||
| description: "The ID of the workflow you wish to see details for.", | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.hubspot.getWorkflowDetails({ | ||
| workflowId: this.workflowId, | ||
| $, | ||
| }); | ||
|
|
||
| $.export("$summary", `Successfully retrieved details for workflow ${this.workflowId}`); | ||
| return response; | ||
| }, | ||
| }; |
51 changes: 51 additions & 0 deletions
51
components/hubspot/actions/retrieve-workflow-emails/retrieve-workflow-emails.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| import hubspot from "../../hubspot.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "hubspot-retrieve-workflow-emails", | ||
| name: "Retrieve Workflow Emails", | ||
| description: "Retrieve emails sent by a workflow by ID. [See the documentation](https://developers.hubspot.com/docs/api-reference/automation-automation-v4-v4/email-campaigns/get-automation-v4-flows-email-campaigns)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| hubspot, | ||
| workflowId: { | ||
| propDefinition: [ | ||
| hubspot, | ||
| "workflow", | ||
| ], | ||
| }, | ||
| after: { | ||
| type: "string", | ||
| label: "After", | ||
| description: "The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results.", | ||
| optional: true, | ||
| }, | ||
| before: { | ||
| type: "string", | ||
| label: "Before", | ||
| description: "The paging cursor token of the last successfully read resource will be returned as the `paging.next.before` JSON property of a paged response containing more results.", | ||
| optional: true, | ||
| }, | ||
| limit: { | ||
| type: "integer", | ||
| label: "Limit", | ||
| description: "The maximum number of results to display per page.", | ||
| default: 100, | ||
| optional: true, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.hubspot.getWorkflowEmails({ | ||
| $, | ||
| params: { | ||
| flowId: this.workflowId, | ||
luancazarine marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| after: this.after, | ||
| before: this.before, | ||
| limit: this.limit, | ||
| }, | ||
| }); | ||
|
|
||
| $.export("$summary", `Successfully retrieved ${response.results.length} emails for workflow ${this.workflowId}`); | ||
| return response; | ||
| }, | ||
| }; | ||
20 changes: 20 additions & 0 deletions
20
components/hubspot/actions/retrieve-workflows/retrieve-workflows.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| import hubspot from "../../hubspot.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "hubspot-retrieve-workflows", | ||
| name: "Retrieve Workflows", | ||
| description: "Retrieve a list of all workflows. [See the documentation](https://developers.hubspot.com/docs/api-reference/legacy/create-manage-workflows-v3/get-automation-v3-workflows)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| hubspot, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.hubspot.listWorkflows({ | ||
| $, | ||
| }); | ||
|
|
||
| $.export("$summary", `Successfully retrieved ${response.results.length} workflows`); | ||
| return response; | ||
| }, | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.