diff --git a/components/pipedrive/actions/add-activity/add-activity.mjs b/components/pipedrive/actions/add-activity/add-activity.mjs index 62fd1ddb4e415..1ee9eaffa214a 100644 --- a/components/pipedrive/actions/add-activity/add-activity.mjs +++ b/components/pipedrive/actions/add-activity/add-activity.mjs @@ -7,7 +7,7 @@ export default { key: "pipedrive-add-activity", name: "Add Activity", description: "Adds a new activity. Includes `more_activities_scheduled_in_context` property in response's `additional_data` which indicates whether there are more undone activities scheduled with the same deal, person or organization (depending on the supplied data). See the Pipedrive API docs for Activities [here](https://developers.pipedrive.com/docs/api/v1/#!/Activities). For info on [adding an activity in Pipedrive](https://developers.pipedrive.com/docs/api/v1/Activities#addActivity)", - version: "0.1.13", + version: "0.1.14", type: "action", props: { pipedriveApp, diff --git a/components/pipedrive/actions/add-deal/add-deal.mjs b/components/pipedrive/actions/add-deal/add-deal.mjs index 9d5ae98bf7b81..744ec15550bd0 100644 --- a/components/pipedrive/actions/add-deal/add-deal.mjs +++ b/components/pipedrive/actions/add-deal/add-deal.mjs @@ -1,110 +1,212 @@ import { ConfigurationError } from "@pipedream/platform"; -import pipedriveApp from "../../pipedrive.app.mjs"; +import app from "../../pipedrive.app.mjs"; +import { parseObject } from "../../common/utils.mjs"; export default { key: "pipedrive-add-deal", name: "Add Deal", description: "Adds a new deal. See the Pipedrive API docs for Deals [here](https://developers.pipedrive.com/docs/api/v1/Deals#addDeal)", - version: "0.1.13", + version: "0.1.14", type: "action", props: { - pipedriveApp, + app, title: { propDefinition: [ - pipedriveApp, + app, "dealTitle", ], }, ownerId: { propDefinition: [ - pipedriveApp, + app, "userId", ], }, personId: { propDefinition: [ - pipedriveApp, + app, "personId", ], }, orgId: { propDefinition: [ - pipedriveApp, + app, "organizationId", ], }, pipelineId: { propDefinition: [ - pipedriveApp, + app, "pipelineId", ], optional: true, }, stageId: { propDefinition: [ - pipedriveApp, + app, "stageId", ], }, value: { propDefinition: [ - pipedriveApp, + app, "dealValue", ], }, currency: { propDefinition: [ - pipedriveApp, + app, "dealCurrency", ], }, status: { propDefinition: [ - pipedriveApp, + app, "status", ], }, probability: { propDefinition: [ - pipedriveApp, + app, "probability", ], }, lostReason: { propDefinition: [ - pipedriveApp, + app, "lostReason", ], }, visibleTo: { propDefinition: [ - pipedriveApp, + app, "visibleTo", ], }, + isDeleted: { + propDefinition: [ + app, + "isDeleted", + ], + }, + isArchived: { + propDefinition: [ + app, + "isArchived", + ], + }, + archiveTime: { + propDefinition: [ + app, + "archiveTime", + ], + }, + closeTime: { + propDefinition: [ + app, + "closeTime", + ], + }, + wonTime: { + propDefinition: [ + app, + "wonTime", + ], + }, + lostTime: { + propDefinition: [ + app, + "lostTime", + ], + }, + expectedCloseDate: { + propDefinition: [ + app, + "expectedCloseDate", + ], + }, + labelIds: { + propDefinition: [ + app, + "labelIds", + ], + }, + customFields: { + propDefinition: [ + app, + "customFields", + ], + }, + note: { + type: "string", + label: "Note", + description: "The content of a note to be attached to the deal. The note will be created after the deal is successfully added.", + optional: true, + }, }, async run({ $ }) { + const { + app, + title, + ownerId, + personId, + orgId, + pipelineId, + stageId, + value, + currency, + status, + probability, + lostReason, + visibleTo, + isDeleted, + isArchived, + archiveTime, + closeTime, + wonTime, + lostTime, + expectedCloseDate, + labelIds, + customFields, + note, + } = this; + try { - const resp = - await this.pipedriveApp.addDeal({ - title: this.title, - owner_id: this.ownerId, - person_id: this.personId, - org_id: this.orgId, - pipeline_id: this.pipelineId, - stage_id: this.stageId, - value: this.value, - currency: this.currency, - status: this.status, - probability: this.probability, - lost_reason: this.lostReason, - visible_to: this.visibleTo, + const resp = await app.addDeal({ + title, + owner_id: ownerId, + person_id: personId, + org_id: orgId, + pipeline_id: pipelineId, + stage_id: stageId, + value, + currency, + status, + probability, + lost_reason: lostReason, + visible_to: visibleTo, + is_deleted: isDeleted, + is_archived: isArchived, + archive_time: archiveTime, + close_time: closeTime, + won_time: wonTime, + lost_time: lostTime, + expected_close_date: expectedCloseDate, + label_ids: parseObject(labelIds), + custom_fields: parseObject(customFields), + }); + + if (note) { + await app.addNote({ + content: note, + deal_id: resp.data?.id, }); + } $.export("$summary", "Successfully added deal"); return resp; - } catch ({ error }) { + } catch ({ error }) { throw new ConfigurationError(error); } }, diff --git a/components/pipedrive/actions/add-lead/add-lead.mjs b/components/pipedrive/actions/add-lead/add-lead.mjs index 5943198b17279..d0f9348cb1f30 100644 --- a/components/pipedrive/actions/add-lead/add-lead.mjs +++ b/components/pipedrive/actions/add-lead/add-lead.mjs @@ -6,7 +6,7 @@ export default { key: "pipedrive-add-lead", name: "Add Lead", description: "Create a new lead in Pipedrive. [See the documentation](https://developers.pipedrive.com/docs/api/v1/Leads#addLead)", - version: "0.0.7", + version: "0.0.8", type: "action", props: { pipedrive, diff --git a/components/pipedrive/actions/add-note/add-note.mjs b/components/pipedrive/actions/add-note/add-note.mjs index 5d2aa27fc47d9..d5bb93ab938b4 100644 --- a/components/pipedrive/actions/add-note/add-note.mjs +++ b/components/pipedrive/actions/add-note/add-note.mjs @@ -5,7 +5,7 @@ export default { key: "pipedrive-add-note", name: "Add Note", description: "Adds a new note. For info on [adding an note in Pipedrive](https://developers.pipedrive.com/docs/api/v1/Notes#addNote)", - version: "0.0.11", + version: "0.0.12", type: "action", props: { pipedriveApp, diff --git a/components/pipedrive/actions/add-organization/add-organization.mjs b/components/pipedrive/actions/add-organization/add-organization.mjs index 38d27ea6dffe1..8e0091b23e1bc 100644 --- a/components/pipedrive/actions/add-organization/add-organization.mjs +++ b/components/pipedrive/actions/add-organization/add-organization.mjs @@ -5,7 +5,7 @@ export default { key: "pipedrive-add-organization", name: "Add Organization", description: "Adds a new organization. See the Pipedrive API docs for Organizations [here](https://developers.pipedrive.com/docs/api/v1/Organizations#addOrganization)", - version: "0.1.13", + version: "0.1.14", type: "action", props: { pipedriveApp, diff --git a/components/pipedrive/actions/add-person/add-person.mjs b/components/pipedrive/actions/add-person/add-person.mjs index e6d3092c3e94c..3685d6df1d7e1 100644 --- a/components/pipedrive/actions/add-person/add-person.mjs +++ b/components/pipedrive/actions/add-person/add-person.mjs @@ -6,7 +6,7 @@ export default { key: "pipedrive-add-person", name: "Add Person", description: "Adds a new person. See the Pipedrive API docs for People [here](https://developers.pipedrive.com/docs/api/v1/Persons#addPerson)", - version: "0.1.13", + version: "0.1.14", type: "action", props: { pipedriveApp, diff --git a/components/pipedrive/actions/get-lead-by-id/get-lead-by-id.mjs b/components/pipedrive/actions/get-lead-by-id/get-lead-by-id.mjs index 435889c543e5e..e6b0b72aa2b90 100644 --- a/components/pipedrive/actions/get-lead-by-id/get-lead-by-id.mjs +++ b/components/pipedrive/actions/get-lead-by-id/get-lead-by-id.mjs @@ -4,7 +4,7 @@ export default { key: "pipedrive-get-lead-by-id", name: "Get Lead by ID", description: "Get a lead by its ID. [See the documentation](https://developers.pipedrive.com/docs/api/v1/Leads#getLead)", - version: "0.0.1", + version: "0.0.2", type: "action", props: { pipedriveApp, diff --git a/components/pipedrive/actions/get-person-details/get-person-details.mjs b/components/pipedrive/actions/get-person-details/get-person-details.mjs index aaaebe0965e28..3c8ce0fdc824e 100644 --- a/components/pipedrive/actions/get-person-details/get-person-details.mjs +++ b/components/pipedrive/actions/get-person-details/get-person-details.mjs @@ -5,7 +5,7 @@ export default { key: "pipedrive-get-person-details", name: "Get person details", description: "Get details of a person by their ID. [See the documentation](https://developers.pipedrive.com/docs/api/v1/Persons#getPerson)", - version: "0.0.2", + version: "0.0.3", type: "action", props: { pipedriveApp, diff --git a/components/pipedrive/actions/merge-deals/merge-deals.mjs b/components/pipedrive/actions/merge-deals/merge-deals.mjs index 79ef53cbea4fd..48cea5a78183b 100644 --- a/components/pipedrive/actions/merge-deals/merge-deals.mjs +++ b/components/pipedrive/actions/merge-deals/merge-deals.mjs @@ -4,7 +4,7 @@ export default { key: "pipedrive-merge-deals", name: "Merge Deals", description: "Merge two deals in Pipedrive. [See the documentation](https://developers.pipedrive.com/docs/api/v1/Deals#mergeDeals)", - version: "0.0.1", + version: "0.0.2", type: "action", props: { pipedriveApp, diff --git a/components/pipedrive/actions/merge-persons/merge-persons.mjs b/components/pipedrive/actions/merge-persons/merge-persons.mjs index b46c159a19279..4f88364b97b9d 100644 --- a/components/pipedrive/actions/merge-persons/merge-persons.mjs +++ b/components/pipedrive/actions/merge-persons/merge-persons.mjs @@ -4,7 +4,7 @@ export default { key: "pipedrive-merge-persons", name: "Merge Persons", description: "Merge two persons in Pipedrive. [See the documentation](https://developers.pipedrive.com/docs/api/v1/Persons#mergePersons)", - version: "0.0.1", + version: "0.0.2", type: "action", props: { pipedriveApp, diff --git a/components/pipedrive/actions/remove-duplicate-notes/remove-duplicate-notes.mjs b/components/pipedrive/actions/remove-duplicate-notes/remove-duplicate-notes.mjs index f808eb5331669..deaae5d765252 100644 --- a/components/pipedrive/actions/remove-duplicate-notes/remove-duplicate-notes.mjs +++ b/components/pipedrive/actions/remove-duplicate-notes/remove-duplicate-notes.mjs @@ -5,7 +5,7 @@ export default { key: "pipedrive-remove-duplicate-notes", name: "Remove Duplicate Notes", description: "Remove duplicate notes from an object in Pipedrive. See the documentation for [getting notes](https://developers.pipedrive.com/docs/api/v1/Notes#getNotes) and [deleting notes](https://developers.pipedrive.com/docs/api/v1/Notes#deleteNote)", - version: "0.0.4", + version: "0.0.5", type: "action", props: { pipedriveApp, diff --git a/components/pipedrive/actions/search-leads/search-leads.mjs b/components/pipedrive/actions/search-leads/search-leads.mjs index dcbe0274ee137..bd8c477a80249 100644 --- a/components/pipedrive/actions/search-leads/search-leads.mjs +++ b/components/pipedrive/actions/search-leads/search-leads.mjs @@ -5,7 +5,7 @@ export default { key: "pipedrive-search-leads", name: "Search Leads", description: "Search for leads by name or email. [See the documentation](https://developers.pipedrive.com/docs/api/v1/Leads#searchLeads)", - version: "0.0.1", + version: "0.0.2", type: "action", props: { pipedriveApp, diff --git a/components/pipedrive/actions/search-notes/search-notes.mjs b/components/pipedrive/actions/search-notes/search-notes.mjs index 5d3740c5997b7..7499eded06d11 100644 --- a/components/pipedrive/actions/search-notes/search-notes.mjs +++ b/components/pipedrive/actions/search-notes/search-notes.mjs @@ -4,7 +4,7 @@ export default { key: "pipedrive-search-notes", name: "Search Notes", description: "Search for notes in Pipedrive. [See the documentation](https://developers.pipedrive.com/docs/api/v1/Notes#getNotes)", - version: "0.0.4", + version: "0.0.5", type: "action", props: { pipedriveApp, diff --git a/components/pipedrive/actions/search-persons/search-persons.mjs b/components/pipedrive/actions/search-persons/search-persons.mjs index 09d4ba6301da5..beaf0a68e426f 100644 --- a/components/pipedrive/actions/search-persons/search-persons.mjs +++ b/components/pipedrive/actions/search-persons/search-persons.mjs @@ -7,7 +7,7 @@ export default { key: "pipedrive-search-persons", name: "Search persons", description: "Searches all Persons by `name`, `email`, `phone`, `notes` and/or custom fields. This endpoint is a wrapper of `/v1/itemSearch` with a narrower OAuth scope. Found Persons can be filtered by Organization ID. See the Pipedrive API docs [here](https://developers.pipedrive.com/docs/api/v1/Persons#searchPersons)", - version: "0.1.13", + version: "0.1.14", type: "action", props: { pipedriveApp, diff --git a/components/pipedrive/actions/update-deal/update-deal.mjs b/components/pipedrive/actions/update-deal/update-deal.mjs index 522b3f7889dc1..ce579d5bbf1ba 100644 --- a/components/pipedrive/actions/update-deal/update-deal.mjs +++ b/components/pipedrive/actions/update-deal/update-deal.mjs @@ -5,7 +5,7 @@ export default { key: "pipedrive-update-deal", name: "Update Deal", description: "Updates the properties of a deal. See the Pipedrive API docs for Deals [here](https://developers.pipedrive.com/docs/api/v1/Deals#updateDeal)", - version: "0.1.15", + version: "0.1.16", type: "action", props: { pipedriveApp, diff --git a/components/pipedrive/actions/update-person/update-person.mjs b/components/pipedrive/actions/update-person/update-person.mjs index ae77a8623bb53..20cdf28213169 100644 --- a/components/pipedrive/actions/update-person/update-person.mjs +++ b/components/pipedrive/actions/update-person/update-person.mjs @@ -6,7 +6,7 @@ export default { key: "pipedrive-update-person", name: "Update Person", description: "Updates an existing person in Pipedrive. [See the documentation](https://developers.pipedrive.com/docs/api/v1/Persons#updatePerson)", - version: "0.0.5", + version: "0.0.6", type: "action", props: { pipedriveApp, diff --git a/components/pipedrive/package.json b/components/pipedrive/package.json index 1b4a95a930517..968bdf3e3e773 100644 --- a/components/pipedrive/package.json +++ b/components/pipedrive/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/pipedrive", - "version": "0.10.0", + "version": "0.10.1", "description": "Pipedream Pipedrive Components", "main": "pipedrive.app.mjs", "keywords": [ diff --git a/components/pipedrive/pipedrive.app.mjs b/components/pipedrive/pipedrive.app.mjs index ba57104a136af..a1c32ef01eb52 100644 --- a/components/pipedrive/pipedrive.app.mjs +++ b/components/pipedrive/pipedrive.app.mjs @@ -306,6 +306,70 @@ export default { description: "Phone numbers (one or more) associated with the person, presented in the same manner as received by GET request of a person. **Example: {\"value\":\"12345\", \"primary\":true, \"label\":\"work\"}**", optional: true, }, + isDeleted: { + type: "boolean", + label: "Is Deleted", + description: "Whether the deal is deleted or not", + optional: true, + }, + isArchived: { + type: "boolean", + label: "Is Archived", + description: "Whether the deal is archived or not", + optional: true, + }, + archiveTime: { + type: "string", + label: "Archive Time", + description: "The optional date and time of archiving the deal in UTC. Format: `YYYY-MM-DD HH:MM:SS`. If omitted and **Is Archived** is `true`, it will be set to the current date and time.", + optional: true, + }, + closeTime: { + type: "string", + label: "Close Time", + description: "The date and time of closing the deal. Can only be set if deal status is won or lost. Format: `YYYY-MM-DD HH:MM:SS`", + optional: true, + }, + wonTime: { + type: "string", + label: "Won Time", + description: "The date and time of changing the deal status as won. Can only be set if deal status is won. Format: `YYYY-MM-DD HH:MM:SS`", + optional: true, + }, + lostTime: { + type: "string", + label: "Lost Time", + description: "The date and time of changing the deal status as lost. Can only be set if deal status is lost. Format: `YYYY-MM-DD HH:MM:SS`", + optional: true, + }, + expectedCloseDate: { + type: "string", + label: "Expected Close Date", + description: "The expected close date of the deal. Format: `YYYY-MM-DD`", + optional: true, + }, + customFields: { + type: "object", + label: "Custom Fields", + description: "An object where each key represents a custom field. All custom fields are referenced as randomly generated 40-character hashes", + optional: true, + }, + labelIds: { + type: "integer[]", + label: "Label IDs", + description: "The IDs of labels assigned to the deal", + optional: true, + async options() { + const { data } = await this.getDealCustomFields(); + const labelField = data.find(({ key }) => key === "label"); + return labelField?.options?.map(({ + id: value, label, + }) => ({ + label, + value, + })) || []; + }, + }, }, methods: { api(model, version = "v1") { diff --git a/components/pipedrive/sources/new-deal-instant/new-deal-instant.mjs b/components/pipedrive/sources/new-deal-instant/new-deal-instant.mjs index 2e301066d86e3..0579b0a287716 100644 --- a/components/pipedrive/sources/new-deal-instant/new-deal-instant.mjs +++ b/components/pipedrive/sources/new-deal-instant/new-deal-instant.mjs @@ -6,7 +6,7 @@ export default { key: "pipedrive-new-deal-instant", name: "New Deal (Instant)", description: "Emit new event when a new deal is created.", - version: "0.0.10", + version: "0.0.11", type: "source", dedupe: "unique", methods: { diff --git a/components/pipedrive/sources/new-event-instant/new-event-instant.mjs b/components/pipedrive/sources/new-event-instant/new-event-instant.mjs index 05af00af53f24..524e3aea4aa4d 100644 --- a/components/pipedrive/sources/new-event-instant/new-event-instant.mjs +++ b/components/pipedrive/sources/new-event-instant/new-event-instant.mjs @@ -5,7 +5,7 @@ export default { key: "pipedrive-new-event-instant", name: "New Event (Instant)", description: "Emit new event when a new webhook event is received. [See the documentation](https://developers.pipedrive.com/docs/api/v1/Webhooks#addWebhook)", - version: "0.0.1", + version: "0.0.2", type: "source", dedupe: "unique", props: { diff --git a/components/pipedrive/sources/new-person-instant/new-person-instant.mjs b/components/pipedrive/sources/new-person-instant/new-person-instant.mjs index 532815ddf5a76..884570662d55a 100644 --- a/components/pipedrive/sources/new-person-instant/new-person-instant.mjs +++ b/components/pipedrive/sources/new-person-instant/new-person-instant.mjs @@ -6,7 +6,7 @@ export default { key: "pipedrive-new-person-instant", name: "New Person (Instant)", description: "Emit new event when a new person is created.", - version: "0.0.10", + version: "0.0.11", type: "source", dedupe: "unique", methods: { diff --git a/components/pipedrive/sources/updated-deal-instant/updated-deal-instant.mjs b/components/pipedrive/sources/updated-deal-instant/updated-deal-instant.mjs index 32b43104c3c97..07a7972a7598a 100644 --- a/components/pipedrive/sources/updated-deal-instant/updated-deal-instant.mjs +++ b/components/pipedrive/sources/updated-deal-instant/updated-deal-instant.mjs @@ -7,7 +7,7 @@ export default { key: "pipedrive-updated-deal-instant", name: "Deal Updated (Instant)", description: "Emit new event when a deal is updated.", - version: "0.1.3", + version: "0.1.4", type: "source", dedupe: "unique", methods: { diff --git a/components/pipedrive/sources/updated-lead-instant/updated-lead-instant.mjs b/components/pipedrive/sources/updated-lead-instant/updated-lead-instant.mjs index c35a36d5fadb6..4d3a7b83836f4 100644 --- a/components/pipedrive/sources/updated-lead-instant/updated-lead-instant.mjs +++ b/components/pipedrive/sources/updated-lead-instant/updated-lead-instant.mjs @@ -7,7 +7,7 @@ export default { key: "pipedrive-updated-lead-instant", name: "Lead Updated (Instant)", description: "Emit new event when a lead is updated.", - version: "0.1.3", + version: "0.1.4", type: "source", dedupe: "unique", methods: { diff --git a/components/pipedrive/sources/updated-person-instant/updated-person-instant.mjs b/components/pipedrive/sources/updated-person-instant/updated-person-instant.mjs index 2a5f0feaba633..9347d83289136 100644 --- a/components/pipedrive/sources/updated-person-instant/updated-person-instant.mjs +++ b/components/pipedrive/sources/updated-person-instant/updated-person-instant.mjs @@ -7,7 +7,7 @@ export default { key: "pipedrive-updated-person-instant", name: "Person Updated (Instant)", description: "Emit new event when a person is updated.", - version: "0.1.3", + version: "0.1.4", type: "source", dedupe: "unique", methods: {