-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Add Adversus Actions: Create/Update Lead, Add Note/Activity, Change Lead Status, Assign to Campaign #18912
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
Open
harshasiddartha
wants to merge
6
commits into
PipedreamHQ:master
Choose a base branch
from
harshasiddartha:adversus-actions-update
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add Adversus Actions: Create/Update Lead, Add Note/Activity, Change Lead Status, Assign to Campaign #18912
Changes from 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
697baf7
Add Adversus actions: Create/Update Lead, Add Note/Activity, Change L…
harshasiddartha 094ad7e
Merge branch 'master' into adversus-actions-update
harshasiddartha 0edd427
Add payload validation to create-or-update-lead action
harshasiddartha 0b8474d
Address reviewer feedback: update version and simplify auth
harshasiddartha 1e31c3c
Merge branch 'master' into adversus-actions-update
harshasiddartha 60d93c2
Merge branch 'master' into adversus-actions-update
harshasiddartha 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
Some comments aren't visible on the classic Files Changed page.
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
89 changes: 89 additions & 0 deletions
89
components/adversus/actions/add-note-activity/add-note-activity.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,89 @@ | ||
| import adversus from "../../adversus.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "adversus-add-note-activity", | ||
| name: "Add Note or Activity", | ||
| description: "Add a note or activity to a lead in Adversus. [See the API documentation](https://solutions.adversus.io/api).", | ||
| version: "0.0.1", | ||
| annotations: { | ||
| destructiveHint: false, | ||
| openWorldHint: true, | ||
| readOnlyHint: false, | ||
| }, | ||
| type: "action", | ||
| props: { | ||
| adversus, | ||
| leadId: { | ||
| propDefinition: [ | ||
| adversus, | ||
| "leadId", | ||
| ], | ||
| }, | ||
| note: { | ||
| type: "string", | ||
| label: "Note", | ||
| description: "The note text to add to the lead", | ||
| optional: true, | ||
| }, | ||
| activityType: { | ||
| type: "string", | ||
| label: "Activity Type", | ||
| description: "The type of activity (e.g., 'call', 'email', 'meeting')", | ||
| optional: true, | ||
| }, | ||
| activityDescription: { | ||
| type: "string", | ||
| label: "Activity Description", | ||
| description: "The description of the activity", | ||
| optional: true, | ||
| }, | ||
| additionalFields: { | ||
| type: "object", | ||
| label: "Additional Fields", | ||
| description: "Additional fields to include in the note or activity", | ||
| optional: true, | ||
| }, | ||
| }, | ||
| /** | ||
| * Execute the action to add a note or activity to a lead | ||
| * @param {Object} $ - Pipedream context | ||
| * @returns {Promise} The response from adding note/activity | ||
| */ | ||
| async run({ $ }) { | ||
| const promises = []; | ||
|
|
||
| if (this.note) { | ||
| promises.push( | ||
| this.adversus.addNoteToLead(this.leadId, { | ||
| data: { | ||
| note: this.note, | ||
| ...(this.additionalFields || {}), | ||
| }, | ||
| }) | ||
| ); | ||
| } | ||
|
|
||
| if (this.activityType || this.activityDescription) { | ||
| promises.push( | ||
| this.adversus.addActivityToLead(this.leadId, { | ||
| data: { | ||
| ...(this.activityType && { type: this.activityType }), | ||
| ...(this.activityDescription && { description: this.activityDescription }), | ||
| ...(this.additionalFields || {}), | ||
| }, | ||
| }) | ||
| ); | ||
| } | ||
|
|
||
| if (promises.length === 0) { | ||
| throw new Error("Either 'Note' or 'Activity Type'/'Activity Description' must be provided"); | ||
| } | ||
|
|
||
| const results = await Promise.all(promises); | ||
|
|
||
| $.export("$summary", `Successfully added ${promises.length} item(s) to lead ${this.leadId}`); | ||
|
|
||
| return results.length === 1 ? results[0] : results; | ||
| }, | ||
| }; | ||
|
|
52 changes: 52 additions & 0 deletions
52
components/adversus/actions/assign-to-campaign/assign-to-campaign.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,52 @@ | ||
| import adversus from "../../adversus.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "adversus-assign-to-campaign", | ||
| name: "Assign Lead to Campaign", | ||
| description: "Assign a lead to a campaign in Adversus. [See the API documentation](https://solutions.adversus.io/api).", | ||
| version: "0.0.1", | ||
| annotations: { | ||
| destructiveHint: true, | ||
| openWorldHint: true, | ||
| readOnlyHint: false, | ||
| }, | ||
| type: "action", | ||
| props: { | ||
| adversus, | ||
| leadId: { | ||
| propDefinition: [ | ||
| adversus, | ||
| "leadId", | ||
| ], | ||
| }, | ||
| campaignId: { | ||
| propDefinition: [ | ||
| adversus, | ||
| "campaignId", | ||
| ], | ||
| }, | ||
| additionalFields: { | ||
| type: "object", | ||
| label: "Additional Fields", | ||
| description: "Additional fields to include when assigning to campaign", | ||
| optional: true, | ||
| }, | ||
| }, | ||
| /** | ||
| * Execute the action to assign a lead to a campaign | ||
| * @param {Object} $ - Pipedream context | ||
| * @returns {Promise} The response from assigning the lead to campaign | ||
| */ | ||
| async run({ $ }) { | ||
| const response = await this.adversus.assignLeadToCampaign(this.leadId, this.campaignId, { | ||
| data: { | ||
| ...(this.additionalFields || {}), | ||
| }, | ||
| }); | ||
|
|
||
| $.export("$summary", `Successfully assigned lead ${this.leadId} to campaign ${this.campaignId}`); | ||
|
|
||
| return response; | ||
| }, | ||
| }; | ||
|
|
52 changes: 52 additions & 0 deletions
52
components/adversus/actions/change-lead-status/change-lead-status.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,52 @@ | ||
| import adversus from "../../adversus.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "adversus-change-lead-status", | ||
| name: "Change Lead Status", | ||
| description: "Change the status of a lead in Adversus. [See the API documentation](https://solutions.adversus.io/api).", | ||
| version: "0.0.1", | ||
| annotations: { | ||
| destructiveHint: true, | ||
| openWorldHint: true, | ||
| readOnlyHint: false, | ||
| }, | ||
| type: "action", | ||
| props: { | ||
| adversus, | ||
| leadId: { | ||
| propDefinition: [ | ||
| adversus, | ||
| "leadId", | ||
| ], | ||
| }, | ||
| statusId: { | ||
| propDefinition: [ | ||
| adversus, | ||
| "statusId", | ||
| ], | ||
| }, | ||
| additionalFields: { | ||
| type: "object", | ||
| label: "Additional Fields", | ||
| description: "Additional fields to include when changing the status", | ||
| optional: true, | ||
| }, | ||
| }, | ||
| /** | ||
| * Execute the action to change a lead's status | ||
| * @param {Object} $ - Pipedream context | ||
| * @returns {Promise} The response from changing the lead status | ||
| */ | ||
| async run({ $ }) { | ||
| const response = await this.adversus.changeLeadStatus(this.leadId, this.statusId, { | ||
| data: { | ||
| ...(this.additionalFields || {}), | ||
| }, | ||
| }); | ||
|
|
||
| $.export("$summary", `Successfully changed status of lead ${this.leadId} to status ${this.statusId}`); | ||
|
|
||
| return response; | ||
| }, | ||
| }; | ||
|
|
80 changes: 80 additions & 0 deletions
80
components/adversus/actions/create-or-update-lead/create-or-update-lead.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,80 @@ | ||
| import adversus from "../../adversus.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "adversus-create-or-update-lead", | ||
| name: "Create or Update Lead", | ||
| description: "Create a new lead or update an existing lead in Adversus. [See the API documentation](https://solutions.adversus.io/api).", | ||
| version: "0.0.1", | ||
| annotations: { | ||
| destructiveHint: true, | ||
| openWorldHint: true, | ||
| readOnlyHint: false, | ||
| }, | ||
| type: "action", | ||
| props: { | ||
| adversus, | ||
| firstName: { | ||
| type: "string", | ||
| label: "First Name", | ||
| description: "The first name of the lead", | ||
| optional: true, | ||
| }, | ||
| lastName: { | ||
| type: "string", | ||
| label: "Last Name", | ||
| description: "The last name of the lead", | ||
| optional: true, | ||
| }, | ||
| email: { | ||
| type: "string", | ||
| label: "Email", | ||
| description: "The email address of the lead", | ||
| optional: true, | ||
| }, | ||
| phone: { | ||
| type: "string", | ||
| label: "Phone", | ||
| description: "The phone number of the lead", | ||
| optional: true, | ||
| }, | ||
| leadId: { | ||
| propDefinition: [ | ||
| adversus, | ||
| "leadId", | ||
| ], | ||
| description: "The ID of the lead to update (leave empty to create a new lead)", | ||
| optional: true, | ||
| }, | ||
| additionalFields: { | ||
| type: "object", | ||
| label: "Additional Fields", | ||
| description: "Additional fields to include in the lead data", | ||
| optional: true, | ||
| }, | ||
| }, | ||
| /** | ||
| * Execute the action to create or update a lead | ||
| * @param {Object} $ - Pipedream context | ||
| * @returns {Promise} The created or updated lead response | ||
| */ | ||
| async run({ $ }) { | ||
| const data = { | ||
| ...(this.firstName && { firstName: this.firstName }), | ||
| ...(this.lastName && { lastName: this.lastName }), | ||
| ...(this.email && { email: this.email }), | ||
| ...(this.phone && { phone: this.phone }), | ||
| ...(this.additionalFields || {}), | ||
| }; | ||
|
|
||
| const response = this.leadId | ||
| ? await this.adversus.updateLead(this.leadId, { data }) | ||
| : await this.adversus.createLead({ data }); | ||
|
|
||
| $.export("$summary", this.leadId | ||
| ? `Successfully updated lead ${this.leadId}` | ||
| : "Successfully created new lead"); | ||
|
|
||
| return response; | ||
| }, | ||
| }; | ||
|
|
||
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.