Skip to content

Commit 6bd184d

Browse files
committed
[FEATURE] Update Pipedrive to use Webhooks v2 #16246
Sources - New Deal (Instant) - New Person (Instant) - New Deal Updated (Instant) - New Person Updated (Instant)
1 parent cd04a13 commit 6bd184d

File tree

10 files changed

+170
-577
lines changed

10 files changed

+170
-577
lines changed

components/pipedrive/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/pipedrive",
3-
"version": "0.3.12",
3+
"version": "0.3.13",
44
"description": "Pipedream Pipedrive Components",
55
"main": "pipedrive.app.mjs",
66
"keywords": [

components/pipedrive/sources/common/base.mjs

+3-6
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,10 @@ export default {
2020
hooks: {
2121
async activate() {
2222
const response = await this.pipedrive.addWebhook({
23-
// Specifying v1 because webhooks v2 became the default on March 17, 2025:
24-
// https://developers.pipedrive.com/changelog/post/breaking-change-webhooks-v2-will-become-the-new-default-version
25-
version: "1.0",
23+
version: "2.0",
2624
subscription_url: this.http.endpoint,
2725
...this.getExtraData(),
2826
});
29-
console.log("response: ", response);
3027

3128
this._setHookId(response.data.id);
3229
},
@@ -36,10 +33,10 @@ export default {
3633
},
3734
},
3835
async run({ body }) {
39-
const ts = Date.parse(body.current.update_time);
36+
const ts = Date.parse(body.meta.timestamp);
4037

4138
this.$emit(body, {
42-
id: `${body.current.id}-${ts}`,
39+
id: `${body.data.id}-${ts}`,
4340
summary: this.getSummary(body),
4441
ts,
4542
});

components/pipedrive/sources/new-deal-instant/new-deal-instant.mjs

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,19 @@ export default {
66
key: "pipedrive-new-deal-instant",
77
name: "New Deal (Instant)",
88
description: "Emit new event when a new deal is created.",
9-
version: "0.0.2",
9+
version: "0.0.3",
1010
type: "source",
1111
dedupe: "unique",
1212
methods: {
1313
...common.methods,
1414
getExtraData() {
1515
return {
16-
event_action: "added",
16+
event_action: "create",
1717
event_object: "deal",
1818
};
1919
},
2020
getSummary(body) {
21-
return `New Deal successfully created: ${body.current.id}`;
21+
return `New Deal successfully created: ${body.data.id}`;
2222
},
2323
},
2424
sampleEmit,
Original file line numberDiff line numberDiff line change
@@ -1,106 +1,52 @@
11
export default {
2-
"v": 1,
3-
"matches_filters": {
4-
"current": []
5-
},
62
"meta": {
7-
"action": "added",
8-
"change_source": "api",
9-
"company_id": 1234567890,
10-
"host": "subdomain.pipedrive.com",
11-
"id": 10,
12-
"is_bulk_update": false,
13-
"matches_filters": {
14-
"current": []
15-
},
16-
"object": "deal",
17-
"permitted_user_ids": [
18-
1234567890
19-
],
20-
"pipedrive_service_name": false,
21-
"timestamp": 1739826584,
22-
"timestamp_micro": 1739826584443168,
23-
"prepublish_timestamp": 1739826584525,
24-
"trans_pending": false,
25-
"user_id": 1234567890,
26-
"v": 1,
27-
"webhook_id": "1234567890"
3+
"action": "create",
4+
"entity": "deal",
5+
"company_id": 123123,
6+
"correlation_id": "123456789-1234-1234-1234-123456789012",
7+
"entity_id": 123,
8+
"id": "123456789-1234-1234-1234-123456789012",
9+
"is_bulk_edit": false,
10+
"timestamp": "2023-01-01T00:00:00.000Z",
11+
"type": "general",
12+
"user_id": 123123,
13+
"version": "2.0",
14+
"webhook_id": 123,
15+
"webhook_owner_id": 123123,
16+
"attempt": 1,
17+
"host": "company.pipedrive.com"
2818
},
29-
"current": {
30-
"email_messages_count": 0,
31-
"cc_email": "subomain+deal11@pipedrivemail.com",
32-
"channel": 8,
33-
"products_count": 0,
34-
"archive_time": null,
35-
"acv_currency": null,
36-
"next_activity_date": null,
37-
"acv": null,
38-
"next_activity_type": null,
39-
"local_close_date": null,
40-
"next_activity_duration": null,
41-
"id": 11,
42-
"person_id": null,
43-
"creator_user_id": 1234567890,
44-
"expected_close_date": null,
45-
"owner_name": "Owner Name",
46-
"arr_currency": null,
47-
"participants_count": 0,
48-
"stage_id": 1,
49-
"probability": null,
50-
"undone_activities_count": 0,
51-
"active": true,
52-
"local_lost_date": null,
53-
"person_name": null,
54-
"last_activity_date": null,
55-
"close_time": null,
56-
"org_hidden": false,
57-
"next_activity_id": null,
58-
"weighted_value_currency": "USD",
59-
"local_won_date": null,
60-
"stage_order_nr": 0,
61-
"next_activity_subject": null,
62-
"rotten_time": null,
63-
"is_archived": false,
64-
"user_id": 1234567890,
65-
"visible_to": "3",
66-
"org_id": null,
67-
"notes_count": 0,
68-
"next_activity_time": null,
69-
"channel_id": "Pipedream",
70-
"formatted_value": "$ 0",
71-
"status": "open",
72-
"formatted_weighted_value": "$ 0",
73-
"mrr_currency": null,
74-
"first_won_time": null,
75-
"origin": "Marketplace",
76-
"last_outgoing_mail_time": null,
77-
"origin_id": "5d80274eae050b58",
78-
"title": "Deal Title",
79-
"last_activity_id": null,
80-
"update_time": "2025-02-17 21:09:44",
81-
"activities_count": 0,
82-
"pipeline_id": 1,
83-
"lost_time": null,
84-
"currency": "USD",
85-
"weighted_value": 0,
86-
"org_name": null,
87-
"value": 0,
88-
"person_hidden": false,
89-
"next_activity_note": null,
90-
"arr": null,
91-
"files_count": 0,
92-
"last_incoming_mail_time": null,
93-
"label": null,
94-
"mrr": null,
95-
"lost_reason": null,
96-
"deleted": false,
97-
"won_time": null,
98-
"followers_count": 0,
99-
"stage_change_time": null,
100-
"add_time": "2025-02-17 21:09:44",
101-
"done_activities_count": 0
19+
"data": {
20+
"add_time":"2025-04-15T15:31:17Z",
21+
"channel":null,
22+
"channel_id":null,
23+
"close_time":null,
24+
"creator_user_id":123123,
25+
"currency":"BRL",
26+
"custom_fields":{},
27+
"expected_close_date":null,
28+
"first_won_time":null,
29+
"id":1,
30+
"label_ids":[],
31+
"lost_reason":null,
32+
"lost_time":null,
33+
"org_id":2,
34+
"origin":"ManuallyCreated",
35+
"origin_id":null,
36+
"owner_id":123123,
37+
"person_id":3,
38+
"pipeline_id":1,
39+
"probability":null,
40+
"stage_change_time":null,
41+
"stage_id":1,
42+
"status":"open",
43+
"title":"Title",
44+
"update_time":null,
45+
"value":2,
46+
"visible_to":"3",
47+
"won_time":null,
48+
"is_archived":false,
49+
"archive_time":null
10250
},
10351
"previous": null,
104-
"retry": 0,
105-
"event": "added.deal"
10652
}

components/pipedrive/sources/new-person-instant/new-person-instant.mjs

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,19 @@ export default {
66
key: "pipedrive-new-person-instant",
77
name: "New Person (Instant)",
88
description: "Emit new event when a new person is created.",
9-
version: "0.0.2",
9+
version: "0.0.3",
1010
type: "source",
1111
dedupe: "unique",
1212
methods: {
1313
...common.methods,
1414
getExtraData() {
1515
return {
16-
event_action: "added",
16+
event_action: "create",
1717
event_object: "person",
1818
};
1919
},
2020
getSummary(body) {
21-
return `New Person successfully created: ${body.current.id}`;
21+
return `New Person successfully created: ${body.data.id}`;
2222
},
2323
},
2424
sampleEmit,
Original file line numberDiff line numberDiff line change
@@ -1,110 +1,36 @@
11
export default {
2-
"v": 1,
3-
"matches_filters": {
4-
"current": []
5-
},
62
"meta": {
7-
"action": "added",
8-
"change_source": "api",
9-
"company_id": 1234567890,
10-
"host": "subdomain.pipedrive.com",
11-
"id": 10,
12-
"is_bulk_update": false,
13-
"matches_filters": {
14-
"current": []
15-
},
16-
"object": "person",
17-
"permitted_user_ids": [
18-
1234567890
19-
],
20-
"pipedrive_service_name": false,
21-
"timestamp": 1739826941,
22-
"timestamp_micro": 1739826941509060,
23-
"prepublish_timestamp": 1739826941605,
24-
"trans_pending": false,
25-
"user_id": 1234567890,
26-
"v": 1,
27-
"webhook_id": "1234567890"
3+
"action": "create",
4+
"entity": "deal",
5+
"company_id": 123123,
6+
"correlation_id": "123456789-1234-1234-1234-123456789012",
7+
"entity_id": 123,
8+
"id": "123456789-1234-1234-1234-123456789012",
9+
"is_bulk_edit": false,
10+
"timestamp": "2023-01-01T00:00:00.000Z",
11+
"type": "general",
12+
"user_id": 123123,
13+
"version": "2.0",
14+
"webhook_id": 123,
15+
"webhook_owner_id": 123123,
16+
"attempt": 1,
17+
"host": "company.pipedrive.com"
2818
},
29-
"current": {
30-
"related_closed_deals_count": 0,
31-
"notes": null,
32-
"email_messages_count": 0,
33-
"cc_email": "subdomain@pipedrivemail.com",
34-
"owner_id": 1234567890,
35-
"open_deals_count": 0,
36-
"postal_address_subpremise": null,
37-
"next_activity_date": null,
38-
"participant_open_deals_count": 0,
39-
"postal_address_locality": null,
40-
"id": 10,
41-
"job_title": null,
42-
"postal_address": null,
43-
"owner_name": "Owner Name",
44-
"im": [
45-
{
46-
"value": "",
47-
"primary": true
48-
}
49-
],
50-
"related_won_deals_count": 0,
51-
"label_ids": [],
52-
"undone_activities_count": 0,
53-
"last_activity_date": null,
54-
"next_activity_id": null,
55-
"postal_address_country": null,
56-
"phone": [
57-
{
58-
"value": "",
59-
"primary": true
60-
}
61-
],
62-
"visible_to": "3",
63-
"org_id": null,
64-
"notes_count": 0,
65-
"name": "Person Name",
66-
"participant_closed_deals_count": 0,
67-
"lost_deals_count": 0,
68-
"next_activity_time": null,
69-
"birthday": null,
70-
"delete_time": null,
71-
"postal_address_postal_code": null,
72-
"last_outgoing_mail_time": null,
73-
"active_flag": true,
74-
"picture_id": null,
75-
"last_activity_id": null,
76-
"update_time": "2025-02-17 21:15:41",
77-
"activities_count": 0,
78-
"postal_address_route": null,
79-
"org_name": null,
80-
"first_name": "Person Name",
81-
"email": [
82-
{
83-
"value": "",
84-
"primary": true
85-
}
86-
],
87-
"postal_address_street_number": null,
88-
"won_deals_count": 0,
89-
"files_count": 0,
90-
"company_id": 1234567890,
91-
"last_incoming_mail_time": null,
92-
"first_char": "p",
93-
"closed_deals_count": 0,
94-
"last_name": "02",
95-
"label": null,
96-
"related_lost_deals_count": 0,
97-
"related_open_deals_count": 0,
98-
"postal_address_formatted_address": null,
99-
"postal_address_sublocality": null,
100-
"postal_address_admin_area_level_2": null,
101-
"postal_address_admin_area_level_1": null,
102-
"followers_count": 0,
103-
"primary_email": null,
104-
"add_time": "2025-02-17 21:15:41",
105-
"done_activities_count": 0
19+
"data": {
20+
"add_time":"2025-04-15T15:35:54Z",
21+
"custom_fields":{},
22+
"emails":[],
23+
"first_name":"First Name",
24+
"id":1,
25+
"label":null,
26+
"label_ids":[],
27+
"last_name":null,
28+
"name":"Person Name",
29+
"org_id":null,
30+
"owner_id":123123,
31+
"phones":[],
32+
"update_time":"2025-04-15T15:35:54Z",
33+
"visible_to":"3"
10634
},
10735
"previous": null,
108-
"retry": 0,
109-
"event": "added.person"
11036
}

0 commit comments

Comments
 (0)