diff --git a/components/pipedrive/actions/add-activity/add-activity.mjs b/components/pipedrive/actions/add-activity/add-activity.mjs index 2c96278c47155..1f94468a38837 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.10", + version: "0.1.11", 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 fe13f92baa689..4f6ee648da9d2 100644 --- a/components/pipedrive/actions/add-deal/add-deal.mjs +++ b/components/pipedrive/actions/add-deal/add-deal.mjs @@ -5,7 +5,7 @@ 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.10", + version: "0.1.11", type: "action", props: { pipedriveApp, diff --git a/components/pipedrive/actions/add-lead/add-lead.mjs b/components/pipedrive/actions/add-lead/add-lead.mjs index 850ed90947eee..3e233f1e3631c 100644 --- a/components/pipedrive/actions/add-lead/add-lead.mjs +++ b/components/pipedrive/actions/add-lead/add-lead.mjs @@ -1,12 +1,12 @@ -import pipedrive from "../../pipedrive.app.mjs"; import { ConfigurationError } from "@pipedream/platform"; import { parseObject } from "../../common/utils.mjs"; +import pipedrive from "../../pipedrive.app.mjs"; 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.4", + version: "0.0.5", 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 2f33e6e7384d3..9eaccd8f77956 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.8", + version: "0.0.9", 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 55d5f0ba5e9f1..c33aacf6f82fd 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.10", + version: "0.1.11", 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 1d3bbc901ee71..9d214cca4b4bd 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.10", + version: "0.1.11", 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 c8114ffe86ace..7d32a343cbabe 100644 --- a/components/pipedrive/actions/remove-duplicate-notes/remove-duplicate-notes.mjs +++ b/components/pipedrive/actions/remove-duplicate-notes/remove-duplicate-notes.mjs @@ -1,11 +1,11 @@ -import pipedriveApp from "../../pipedrive.app.mjs"; import { decode } from "html-entities"; +import pipedriveApp from "../../pipedrive.app.mjs"; 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.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 9f76f363c3773..cf40c148b5c66 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.1", + version: "0.0.2", 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 c1b47f7700785..bade41b0423b5 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.10", + version: "0.1.11", 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 e1ef1d03977af..cbc7fe25091ab 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.12", + version: "0.1.13", 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 13f447d3030ce..084f0393a7185 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.2", + version: "0.0.3", type: "action", props: { pipedriveApp, diff --git a/components/pipedrive/common/utils.mjs b/components/pipedrive/common/utils.mjs index dcc9cc61f6f41..e382dc56a1b7d 100644 --- a/components/pipedrive/common/utils.mjs +++ b/components/pipedrive/common/utils.mjs @@ -22,3 +22,26 @@ export const parseObject = (obj) => { } return obj; }; + +const parseCustomFields = async (data, customFields) => { + if (data.custom_fields) { + const newCustomFields = {}; + for (const field of Object.keys(data.custom_fields)) { + const customField = customFields.find(({ key }) => key === field); + if (customField) { + newCustomFields[customField.name] = data.custom_fields[field]?.value; + } + } + return newCustomFields; + } + return data.custom_fields; +}; + +export const parseData = async ({ + fn, body, +}) => { + const { data: customFields } = await fn(); + body.data.custom_fields = await parseCustomFields(body.data, customFields); + body.previous.custom_fields = await parseCustomFields(body.previous, customFields); + return body; +}; diff --git a/components/pipedrive/package.json b/components/pipedrive/package.json index 79cbd3091f598..4cdd7598550e1 100644 --- a/components/pipedrive/package.json +++ b/components/pipedrive/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/pipedrive", - "version": "0.6.0", + "version": "0.7.0", "description": "Pipedream Pipedrive Components", "main": "pipedrive.app.mjs", "keywords": [ @@ -14,7 +14,7 @@ "access": "public" }, "dependencies": { - "@pipedream/platform": "^3.0.3", + "@pipedream/platform": "^3.1.0", "html-entities": "^2.6.0", "pipedrive": "^24.1.1" } diff --git a/components/pipedrive/pipedrive.app.mjs b/components/pipedrive/pipedrive.app.mjs index 8c985902defd0..8fd344e7a8d12 100644 --- a/components/pipedrive/pipedrive.app.mjs +++ b/components/pipedrive/pipedrive.app.mjs @@ -359,6 +359,14 @@ export default { const notesApi = this.api("NotesApi"); return notesApi.getNotes(opts); }, + getDealCustomFields(opts) { + const dealCustomFieldsApi = this.api("DealFieldsApi"); + return dealCustomFieldsApi.getDealFields(opts); + }, + getPersonCustomFields(opts) { + const personCustomFieldsApi = this.api("PersonFieldsApi"); + return personCustomFieldsApi.getPersonFields(opts); + }, addActivity(opts = {}) { const activityApi = this.api("ActivitiesApi", "v2"); return activityApi.addActivity({ diff --git a/components/pipedrive/sources/common/base.mjs b/components/pipedrive/sources/common/base.mjs index 5338961c87293..fd956def07a96 100644 --- a/components/pipedrive/sources/common/base.mjs +++ b/components/pipedrive/sources/common/base.mjs @@ -16,6 +16,9 @@ export default { getExtraData() { return {}; }, + parseData(data) { + return data; + }, }, hooks: { async activate() { @@ -35,7 +38,7 @@ export default { async run({ body }) { const ts = Date.parse(body.meta.timestamp); - this.$emit(body, { + this.$emit(await this.parseData(body), { id: `${body.data.id}-${ts}`, summary: this.getSummary(body), ts, 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 881bda6ffdd18..6d5a5507f706e 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.6", + version: "0.0.7", type: "source", dedupe: "unique", methods: { 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 210aac876d859..ca89b4eb24ad9 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.6", + version: "0.0.7", 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 69b221e2e9168..f3df09dab9ed5 100644 --- a/components/pipedrive/sources/updated-deal-instant/updated-deal-instant.mjs +++ b/components/pipedrive/sources/updated-deal-instant/updated-deal-instant.mjs @@ -1,12 +1,13 @@ +import { parseData } from "../../common/utils.mjs"; import common from "../common/base.mjs"; import sampleEmit from "./test-event.mjs"; export default { ...common, key: "pipedrive-updated-deal-instant", - name: "New Deal Update (Instant)", + name: "Deal Updated (Instant)", description: "Emit new event when a deal is updated.", - version: "0.0.6", + version: "0.1.0", type: "source", dedupe: "unique", methods: { @@ -20,6 +21,12 @@ export default { getSummary(body) { return `Deal successfully updated: ${body.data.id}`; }, + async parseData(body) { + return await parseData({ + fn: this.pipedrive.getDealCustomFields, + body, + }); + }, }, sampleEmit, }; diff --git a/components/pipedrive/sources/updated-lead-instant/test-event.mjs b/components/pipedrive/sources/updated-lead-instant/test-event.mjs new file mode 100644 index 0000000000000..c64d0ebcb06b3 --- /dev/null +++ b/components/pipedrive/sources/updated-lead-instant/test-event.mjs @@ -0,0 +1,56 @@ +export default { + "data": { + "add_time": "2025-06-19T16:07:08.597Z", + "channel": null, + "channel_id": null, + "creator_id": 12345678, + "custom_fields": {}, + "expected_close_date": null, + "id": "123456789-1234-1234-1234-123456789012", + "is_archived": false, + "label_ids": [ + "123456789-1234-1234-1234-123456789012", + "123456789-1234-1234-1234-123456789012", + "123456789-1234-1234-1234-123456789012" + ], + "next_activity_id": null, + "organization_id": null, + "origin": "ManuallyCreated", + "origin_id": null, + "owner_id": 12345678, + "person_id": 12, + "source_name": "Manually created", + "title": "Lead Title", + "update_time": "2025-06-19T16:07:36.753Z", + "was_seen": true, + "value": { + "amount": 123, + "currency": "BRL" + } + }, + "previous": { + "update_time": "2025-06-19T16:07:30.029Z", + "value": null + }, + "meta": { + "action": "change", + "company_id": "12345678", + "correlation_id": "123456789-1234-1234-1234-123456789012", + "entity_id": "123456789-1234-1234-1234-123456789012", + "entity": "lead", + "id": "123456789-1234-1234-1234-123456789012", + "is_bulk_edit": false, + "timestamp": "2025-06-19T16:07:36.754Z", + "type": "application", + "user_id": "12345678", + "version": "2.0", + "webhook_id": "12345678", + "webhook_owner_id": "12345678", + "change_source": "app", + "permitted_user_ids": [ + "12345678" + ], + "attempt": 1, + "host": "pd.pipedrive.com" + } +} \ No newline at end of file diff --git a/components/pipedrive/sources/updated-lead-instant/updated-lead-instant.mjs b/components/pipedrive/sources/updated-lead-instant/updated-lead-instant.mjs new file mode 100644 index 0000000000000..d76608439c0c0 --- /dev/null +++ b/components/pipedrive/sources/updated-lead-instant/updated-lead-instant.mjs @@ -0,0 +1,32 @@ +import { parseData } from "../../common/utils.mjs"; +import common from "../common/base.mjs"; +import sampleEmit from "./test-event.mjs"; + +export default { + ...common, + key: "pipedrive-updated-lead-instant", + name: "Lead Updated (Instant)", + description: "Emit new event when a lead is updated.", + version: "0.1.0", + type: "source", + dedupe: "unique", + methods: { + ...common.methods, + getExtraData() { + return { + event_action: "change", + event_object: "lead", + }; + }, + getSummary(body) { + return `Lead successfully updated: ${body.data.id}`; + }, + async parseData(body) { + return await parseData({ + fn: this.pipedrive.getDealCustomFields, + body, + }); + }, + }, + sampleEmit, +}; 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 cb09964ece5a7..35672c1d0dcab 100644 --- a/components/pipedrive/sources/updated-person-instant/updated-person-instant.mjs +++ b/components/pipedrive/sources/updated-person-instant/updated-person-instant.mjs @@ -1,12 +1,13 @@ +import { parseData } from "../../common/utils.mjs"; import common from "../common/base.mjs"; import sampleEmit from "./test-event.mjs"; export default { ...common, key: "pipedrive-updated-person-instant", - name: "Updated Person (Instant)", + name: "Person Updated (Instant)", description: "Emit new event when a person is updated.", - version: "0.0.6", + version: "0.1.0", type: "source", dedupe: "unique", methods: { @@ -20,6 +21,12 @@ export default { getSummary(body) { return `Person successfully updated: ${body.data.id}`; }, + async parseData(body) { + return await parseData({ + fn: this.pipedrive.getPersonCustomFields, + body, + }); + }, }, sampleEmit, }; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 39fc633f66056..2126d84758405 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1030,8 +1030,7 @@ importers: specifier: ^4.0.0 version: 4.0.1 - components/aspsms: - specifiers: {} + components/aspsms: {} components/assembla: dependencies: @@ -10116,8 +10115,8 @@ importers: components/pipedrive: dependencies: '@pipedream/platform': - specifier: ^3.0.3 - version: 3.0.3 + specifier: ^3.1.0 + version: 3.1.0 html-entities: specifier: ^2.6.0 version: 2.6.0 @@ -12568,8 +12567,7 @@ importers: components/smartymeet: {} - components/smashsend: - specifiers: {} + components/smashsend: {} components/smiirl: dependencies: @@ -15757,14 +15755,6 @@ importers: specifier: ^6.0.0 version: 6.2.0 - modelcontextprotocol/node_modules2/@modelcontextprotocol/sdk/dist/cjs: {} - - modelcontextprotocol/node_modules2/@modelcontextprotocol/sdk/dist/esm: {} - - modelcontextprotocol/node_modules2/zod-to-json-schema/dist/cjs: {} - - modelcontextprotocol/node_modules2/zod-to-json-schema/dist/esm: {} - packages/ai: dependencies: '@pipedream/sdk':