Skip to content

Commit f781332

Browse files
committed
[Component] Pipedrive - add note prop to add deal action
1 parent db457a5 commit f781332

File tree

24 files changed

+218
-52
lines changed

24 files changed

+218
-52
lines changed

components/pipedrive/actions/add-activity/add-activity.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default {
77
key: "pipedrive-add-activity",
88
name: "Add Activity",
99
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)",
10-
version: "0.1.13",
10+
version: "0.1.14",
1111
type: "action",
1212
props: {
1313
pipedriveApp,

components/pipedrive/actions/add-deal/add-deal.mjs

Lines changed: 132 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,110 +1,212 @@
11
import { ConfigurationError } from "@pipedream/platform";
2-
import pipedriveApp from "../../pipedrive.app.mjs";
2+
import app from "../../pipedrive.app.mjs";
3+
import { parseObject } from "../../common/utils.mjs";
34

45
export default {
56
key: "pipedrive-add-deal",
67
name: "Add Deal",
78
description: "Adds a new deal. See the Pipedrive API docs for Deals [here](https://developers.pipedrive.com/docs/api/v1/Deals#addDeal)",
8-
version: "0.1.13",
9+
version: "0.1.14",
910
type: "action",
1011
props: {
11-
pipedriveApp,
12+
app,
1213
title: {
1314
propDefinition: [
14-
pipedriveApp,
15+
app,
1516
"dealTitle",
1617
],
1718
},
1819
ownerId: {
1920
propDefinition: [
20-
pipedriveApp,
21+
app,
2122
"userId",
2223
],
2324
},
2425
personId: {
2526
propDefinition: [
26-
pipedriveApp,
27+
app,
2728
"personId",
2829
],
2930
},
3031
orgId: {
3132
propDefinition: [
32-
pipedriveApp,
33+
app,
3334
"organizationId",
3435
],
3536
},
3637
pipelineId: {
3738
propDefinition: [
38-
pipedriveApp,
39+
app,
3940
"pipelineId",
4041
],
4142
optional: true,
4243
},
4344
stageId: {
4445
propDefinition: [
45-
pipedriveApp,
46+
app,
4647
"stageId",
4748
],
4849
},
4950
value: {
5051
propDefinition: [
51-
pipedriveApp,
52+
app,
5253
"dealValue",
5354
],
5455
},
5556
currency: {
5657
propDefinition: [
57-
pipedriveApp,
58+
app,
5859
"dealCurrency",
5960
],
6061
},
6162
status: {
6263
propDefinition: [
63-
pipedriveApp,
64+
app,
6465
"status",
6566
],
6667
},
6768
probability: {
6869
propDefinition: [
69-
pipedriveApp,
70+
app,
7071
"probability",
7172
],
7273
},
7374
lostReason: {
7475
propDefinition: [
75-
pipedriveApp,
76+
app,
7677
"lostReason",
7778
],
7879
},
7980
visibleTo: {
8081
propDefinition: [
81-
pipedriveApp,
82+
app,
8283
"visibleTo",
8384
],
8485
},
86+
isDeleted: {
87+
propDefinition: [
88+
app,
89+
"isDeleted",
90+
],
91+
},
92+
isArchived: {
93+
propDefinition: [
94+
app,
95+
"isArchived",
96+
],
97+
},
98+
archiveTime: {
99+
propDefinition: [
100+
app,
101+
"archiveTime",
102+
],
103+
},
104+
closeTime: {
105+
propDefinition: [
106+
app,
107+
"closeTime",
108+
],
109+
},
110+
wonTime: {
111+
propDefinition: [
112+
app,
113+
"wonTime",
114+
],
115+
},
116+
lostTime: {
117+
propDefinition: [
118+
app,
119+
"lostTime",
120+
],
121+
},
122+
expectedCloseDate: {
123+
propDefinition: [
124+
app,
125+
"expectedCloseDate",
126+
],
127+
},
128+
labelIds: {
129+
propDefinition: [
130+
app,
131+
"labelIds",
132+
],
133+
},
134+
customFields: {
135+
propDefinition: [
136+
app,
137+
"customFields",
138+
],
139+
},
140+
note: {
141+
type: "string",
142+
label: "Note",
143+
description: "The content of a note to be attached to the deal. The note will be created after the deal is successfully added.",
144+
optional: true,
145+
},
85146
},
86147
async run({ $ }) {
148+
const {
149+
app,
150+
title,
151+
ownerId,
152+
personId,
153+
orgId,
154+
pipelineId,
155+
stageId,
156+
value,
157+
currency,
158+
status,
159+
probability,
160+
lostReason,
161+
visibleTo,
162+
isDeleted,
163+
isArchived,
164+
archiveTime,
165+
closeTime,
166+
wonTime,
167+
lostTime,
168+
expectedCloseDate,
169+
labelIds,
170+
customFields,
171+
note,
172+
} = this;
173+
87174
try {
88-
const resp =
89-
await this.pipedriveApp.addDeal({
90-
title: this.title,
91-
owner_id: this.ownerId,
92-
person_id: this.personId,
93-
org_id: this.orgId,
94-
pipeline_id: this.pipelineId,
95-
stage_id: this.stageId,
96-
value: this.value,
97-
currency: this.currency,
98-
status: this.status,
99-
probability: this.probability,
100-
lost_reason: this.lostReason,
101-
visible_to: this.visibleTo,
175+
const resp = await app.addDeal({
176+
title,
177+
owner_id: ownerId,
178+
person_id: personId,
179+
org_id: orgId,
180+
pipeline_id: pipelineId,
181+
stage_id: stageId,
182+
value,
183+
currency,
184+
status,
185+
probability,
186+
lost_reason: lostReason,
187+
visible_to: visibleTo,
188+
is_deleted: isDeleted,
189+
is_archived: isArchived,
190+
archive_time: archiveTime,
191+
close_time: closeTime,
192+
won_time: wonTime,
193+
lost_time: lostTime,
194+
expected_close_date: expectedCloseDate,
195+
label_ids: parseObject(labelIds),
196+
custom_fields: parseObject(customFields),
197+
});
198+
199+
if (note) {
200+
await app.addNote({
201+
content: note,
202+
deal_id: resp.data?.id,
102203
});
204+
}
103205

104206
$.export("$summary", "Successfully added deal");
105207

106208
return resp;
107-
} catch ({ error }) {
209+
} catch ({ error }) {
108210
throw new ConfigurationError(error);
109211
}
110212
},

components/pipedrive/actions/add-lead/add-lead.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default {
66
key: "pipedrive-add-lead",
77
name: "Add Lead",
88
description: "Create a new lead in Pipedrive. [See the documentation](https://developers.pipedrive.com/docs/api/v1/Leads#addLead)",
9-
version: "0.0.7",
9+
version: "0.0.8",
1010
type: "action",
1111
props: {
1212
pipedrive,

components/pipedrive/actions/add-note/add-note.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default {
55
key: "pipedrive-add-note",
66
name: "Add Note",
77
description: "Adds a new note. For info on [adding an note in Pipedrive](https://developers.pipedrive.com/docs/api/v1/Notes#addNote)",
8-
version: "0.0.11",
8+
version: "0.0.12",
99
type: "action",
1010
props: {
1111
pipedriveApp,

components/pipedrive/actions/add-organization/add-organization.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default {
55
key: "pipedrive-add-organization",
66
name: "Add Organization",
77
description: "Adds a new organization. See the Pipedrive API docs for Organizations [here](https://developers.pipedrive.com/docs/api/v1/Organizations#addOrganization)",
8-
version: "0.1.13",
8+
version: "0.1.14",
99
type: "action",
1010
props: {
1111
pipedriveApp,

components/pipedrive/actions/add-person/add-person.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default {
66
key: "pipedrive-add-person",
77
name: "Add Person",
88
description: "Adds a new person. See the Pipedrive API docs for People [here](https://developers.pipedrive.com/docs/api/v1/Persons#addPerson)",
9-
version: "0.1.13",
9+
version: "0.1.14",
1010
type: "action",
1111
props: {
1212
pipedriveApp,

components/pipedrive/actions/get-lead-by-id/get-lead-by-id.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "pipedrive-get-lead-by-id",
55
name: "Get Lead by ID",
66
description: "Get a lead by its ID. [See the documentation](https://developers.pipedrive.com/docs/api/v1/Leads#getLead)",
7-
version: "0.0.1",
7+
version: "0.0.2",
88
type: "action",
99
props: {
1010
pipedriveApp,

components/pipedrive/actions/get-person-details/get-person-details.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default {
55
key: "pipedrive-get-person-details",
66
name: "Get person details",
77
description: "Get details of a person by their ID. [See the documentation](https://developers.pipedrive.com/docs/api/v1/Persons#getPerson)",
8-
version: "0.0.2",
8+
version: "0.0.3",
99
type: "action",
1010
props: {
1111
pipedriveApp,

components/pipedrive/actions/merge-deals/merge-deals.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "pipedrive-merge-deals",
55
name: "Merge Deals",
66
description: "Merge two deals in Pipedrive. [See the documentation](https://developers.pipedrive.com/docs/api/v1/Deals#mergeDeals)",
7-
version: "0.0.1",
7+
version: "0.0.2",
88
type: "action",
99
props: {
1010
pipedriveApp,

components/pipedrive/actions/merge-persons/merge-persons.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "pipedrive-merge-persons",
55
name: "Merge Persons",
66
description: "Merge two persons in Pipedrive. [See the documentation](https://developers.pipedrive.com/docs/api/v1/Persons#mergePersons)",
7-
version: "0.0.1",
7+
version: "0.0.2",
88
type: "action",
99
props: {
1010
pipedriveApp,

0 commit comments

Comments
 (0)