@activepieces/piece-drip 0.2.2 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +11 -8
- package/src/index.d.ts +2 -1
- package/src/index.js +21 -2
- package/src/index.js.map +1 -1
- package/src/lib/actions/add-subscriber-to-campaign.action.d.ts +7 -1
- package/src/lib/actions/add-subscriber-to-campaign.action.js +24 -64
- package/src/lib/actions/add-subscriber-to-campaign.action.js.map +1 -1
- package/src/lib/actions/apply-tag-to-subscriber.action.d.ts +5 -1
- package/src/lib/actions/apply-tag-to-subscriber.action.js +15 -13
- package/src/lib/actions/apply-tag-to-subscriber.action.js.map +1 -1
- package/src/lib/actions/upsert-subscriber.action.d.ts +14 -1
- package/src/lib/actions/upsert-subscriber.action.js +59 -69
- package/src/lib/actions/upsert-subscriber.action.js.map +1 -1
- package/src/lib/common/index.d.ts +0 -1
- package/src/lib/common/index.js +20 -19
- package/src/lib/common/index.js.map +1 -1
- package/src/lib/trigger/new-subscriber.trigger.d.ts +8 -1
- package/src/lib/trigger/new-subscriber.trigger.js +16 -16
- package/src/lib/trigger/new-subscriber.trigger.js.map +1 -1
- package/src/lib/trigger/new-tag.trigger.d.ts +8 -1
- package/src/lib/trigger/new-tag.trigger.js +18 -15
- package/src/lib/trigger/new-tag.trigger.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@activepieces/piece-drip",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@sinclair/typebox": "0.26.8",
|
|
6
|
-
"axios": "1.
|
|
6
|
+
"axios": "^1.6.3",
|
|
7
|
+
"dayjs": "1.11.9",
|
|
8
|
+
"is-base64": "1.1.0",
|
|
7
9
|
"lodash": "4.17.21",
|
|
8
|
-
"nanoid": "3.3.
|
|
9
|
-
"
|
|
10
|
-
"@activepieces/
|
|
11
|
-
"@activepieces/pieces-
|
|
12
|
-
"
|
|
10
|
+
"nanoid": "3.3.6",
|
|
11
|
+
"semver": "7.5.4",
|
|
12
|
+
"@activepieces/pieces-common": "0.2.8",
|
|
13
|
+
"@activepieces/pieces-framework": "0.7.14",
|
|
14
|
+
"@activepieces/shared": "0.10.66",
|
|
15
|
+
"tslib": "2.6.2"
|
|
13
16
|
},
|
|
14
17
|
"main": "./src/index.js",
|
|
15
|
-
"
|
|
18
|
+
"type": "commonjs"
|
|
16
19
|
}
|
package/src/index.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const dripAuth: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
2
|
+
export declare const drip: import("@activepieces/pieces-framework").Piece<import("@activepieces/pieces-framework").SecretTextProperty<true>>;
|
package/src/index.js
CHANGED
|
@@ -1,17 +1,36 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.drip = void 0;
|
|
3
|
+
exports.drip = exports.dripAuth = void 0;
|
|
4
4
|
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
5
5
|
const add_subscriber_to_campaign_action_1 = require("./lib/actions/add-subscriber-to-campaign.action");
|
|
6
6
|
const apply_tag_to_subscriber_action_1 = require("./lib/actions/apply-tag-to-subscriber.action");
|
|
7
7
|
const upsert_subscriber_action_1 = require("./lib/actions/upsert-subscriber.action");
|
|
8
8
|
const new_subscriber_trigger_1 = require("./lib/trigger/new-subscriber.trigger");
|
|
9
9
|
const new_tag_trigger_1 = require("./lib/trigger/new-tag.trigger");
|
|
10
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
11
|
+
exports.dripAuth = pieces_framework_1.PieceAuth.SecretText({
|
|
12
|
+
displayName: 'API Key',
|
|
13
|
+
required: true,
|
|
14
|
+
description: 'Get it from https://www.getdrip.com/user/edit',
|
|
15
|
+
});
|
|
10
16
|
exports.drip = (0, pieces_framework_1.createPiece)({
|
|
11
17
|
displayName: 'Drip',
|
|
18
|
+
minimumSupportedRelease: '0.5.0',
|
|
12
19
|
logoUrl: 'https://cdn.activepieces.com/pieces/drip.png',
|
|
13
20
|
authors: ['AbdulTheActivePiecer'],
|
|
14
|
-
|
|
21
|
+
auth: exports.dripAuth,
|
|
22
|
+
actions: [
|
|
23
|
+
apply_tag_to_subscriber_action_1.dripApplyTagToSubscriber,
|
|
24
|
+
add_subscriber_to_campaign_action_1.dripAddSubscriberToCampaign,
|
|
25
|
+
upsert_subscriber_action_1.dripUpsertSubscriberAction,
|
|
26
|
+
(0, pieces_common_1.createCustomApiCallAction)({
|
|
27
|
+
baseUrl: () => `https://api.getdrip.com/v2/`,
|
|
28
|
+
auth: exports.dripAuth,
|
|
29
|
+
authMapping: (auth) => ({
|
|
30
|
+
Authorization: `Basic ${Buffer.from(auth).toString('base64')}`,
|
|
31
|
+
}),
|
|
32
|
+
}),
|
|
33
|
+
],
|
|
15
34
|
triggers: [new_subscriber_trigger_1.dripNewSubscriberEvent, new_tag_trigger_1.dripTagAppliedEvent],
|
|
16
35
|
});
|
|
17
36
|
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/pieces/community/drip/src/index.ts"],"names":[],"mappings":";;;AAAA,qEAAwE;AACxE,uGAA8F;AAC9F,iGAAwF;AACxF,qFAAoF;AACpF,iFAA8E;AAC9E,mEAAoE;AACpE,+DAAwE;AAE3D,QAAA,QAAQ,GAAG,4BAAS,CAAC,UAAU,CAAC;IAC3C,WAAW,EAAE,SAAS;IACtB,QAAQ,EAAE,IAAI;IACd,WAAW,EAAE,+CAA+C;CAC7D,CAAC,CAAC;AAEU,QAAA,IAAI,GAAG,IAAA,8BAAW,EAAC;IAC9B,WAAW,EAAE,MAAM;IACnB,uBAAuB,EAAE,OAAO;IAChC,OAAO,EAAE,8CAA8C;IACvD,OAAO,EAAE,CAAC,sBAAsB,CAAC;IACjC,IAAI,EAAE,gBAAQ;IACd,OAAO,EAAE;QACP,yDAAwB;QACxB,+DAA2B;QAC3B,qDAA0B;QAC1B,IAAA,yCAAyB,EAAC;YACxB,OAAO,EAAE,GAAG,EAAE,CAAC,6BAA6B;YAC5C,IAAI,EAAE,gBAAQ;YACd,WAAW,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;gBACtB,aAAa,EAAE,SAAS,MAAM,CAAC,IAAI,CAAC,IAAc,CAAC,CAAC,QAAQ,CAC1D,QAAQ,CACT,EAAE;aACJ,CAAC;SACH,CAAC;KACH;IACD,QAAQ,EAAE,CAAC,+CAAsB,EAAE,qCAAmB,CAAC;CACxD,CAAC,CAAC"}
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
export declare const dripAddSubscriberToCampaign: import("@activepieces/pieces-framework").
|
|
1
|
+
export declare const dripAddSubscriberToCampaign: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
account_id: import("@activepieces/pieces-framework").DropdownProperty<string, true>;
|
|
3
|
+
campaign_id: import("@activepieces/pieces-framework").DropdownProperty<string, true>;
|
|
4
|
+
subscriber: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
5
|
+
tags: import("@activepieces/pieces-framework").ArrayProperty<false>;
|
|
6
|
+
custom_fields: import("@activepieces/pieces-framework").ObjectProperty<false>;
|
|
7
|
+
}>;
|
|
@@ -5,37 +5,38 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
6
|
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
7
|
const common_1 = require("../common");
|
|
8
|
+
const __1 = require("../../");
|
|
8
9
|
exports.dripAddSubscriberToCampaign = (0, pieces_framework_1.createAction)({
|
|
10
|
+
auth: __1.dripAuth,
|
|
9
11
|
name: 'add_subscriber_to_campaign',
|
|
10
12
|
description: 'Add a subscriber to a campaign (Email series)',
|
|
11
13
|
displayName: 'Add a subscriber to a campaign',
|
|
12
14
|
props: {
|
|
13
|
-
authentication: common_1.dripCommon.authentication,
|
|
14
15
|
account_id: common_1.dripCommon.account_id,
|
|
15
16
|
campaign_id: pieces_framework_1.Property.Dropdown({
|
|
16
|
-
displayName:
|
|
17
|
-
refreshers: [
|
|
17
|
+
displayName: 'Email Series Campaign',
|
|
18
|
+
refreshers: ['account_id'],
|
|
18
19
|
required: true,
|
|
19
|
-
options: (
|
|
20
|
-
if (!
|
|
20
|
+
options: ({ auth, account_id }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
21
|
+
if (!auth) {
|
|
21
22
|
return {
|
|
22
23
|
disabled: true,
|
|
23
24
|
options: [],
|
|
24
|
-
placeholder:
|
|
25
|
+
placeholder: 'Please fill in API key first',
|
|
25
26
|
};
|
|
26
27
|
}
|
|
27
|
-
if (!
|
|
28
|
+
if (!account_id) {
|
|
28
29
|
return {
|
|
29
30
|
disabled: true,
|
|
30
31
|
options: [],
|
|
31
|
-
placeholder:
|
|
32
|
+
placeholder: 'Please select an account first',
|
|
32
33
|
};
|
|
33
34
|
}
|
|
34
35
|
const request = {
|
|
35
36
|
method: pieces_common_1.HttpMethod.GET,
|
|
36
|
-
url: `${common_1.dripCommon.baseUrl(
|
|
37
|
+
url: `${common_1.dripCommon.baseUrl(account_id)}/campaigns`,
|
|
37
38
|
headers: {
|
|
38
|
-
Authorization: `Basic ${Buffer.from(
|
|
39
|
+
Authorization: `Basic ${Buffer.from(auth).toString('base64')}`,
|
|
39
40
|
},
|
|
40
41
|
};
|
|
41
42
|
const response = yield pieces_common_1.httpClient.sendRequest(request);
|
|
@@ -46,81 +47,40 @@ exports.dripAddSubscriberToCampaign = (0, pieces_framework_1.createAction)({
|
|
|
46
47
|
return {
|
|
47
48
|
disabled: false,
|
|
48
49
|
options: [],
|
|
49
|
-
placeholder:
|
|
50
|
+
placeholder: 'Please create an email series campaign',
|
|
50
51
|
};
|
|
51
52
|
}
|
|
52
53
|
return {
|
|
53
54
|
disabled: false,
|
|
54
55
|
options: opts,
|
|
55
56
|
};
|
|
56
|
-
})
|
|
57
|
+
}),
|
|
57
58
|
}),
|
|
58
59
|
subscriber: common_1.dripCommon.subscriber,
|
|
59
60
|
tags: common_1.dripCommon.tags,
|
|
60
61
|
custom_fields: common_1.dripCommon.custom_fields,
|
|
61
62
|
},
|
|
62
|
-
|
|
63
|
-
"links": {
|
|
64
|
-
"subscribers.account": "https://api.getdrip.com/v2/accounts/{subscribers.account}"
|
|
65
|
-
},
|
|
66
|
-
"subscribers": [
|
|
67
|
-
{
|
|
68
|
-
"id": "1e0ukqg4yzqo1bxyy18f",
|
|
69
|
-
"href": "https://api.getdrip.com/v2/AAAAAAA/subscribers/AAAAAAA",
|
|
70
|
-
"status": "active",
|
|
71
|
-
"email": "yrdd@ggg.com",
|
|
72
|
-
"first_name": "joe",
|
|
73
|
-
"last_name": "doe",
|
|
74
|
-
"address1": "Iraq,Baghdad",
|
|
75
|
-
"address2": "Amman,Jordan",
|
|
76
|
-
"city": "Baghdad",
|
|
77
|
-
"state": "Baghdad",
|
|
78
|
-
"zip": "10011",
|
|
79
|
-
"phone": "079123123123",
|
|
80
|
-
"country": "Iraq",
|
|
81
|
-
"time_zone": "Baghdad GMT+3",
|
|
82
|
-
"utc_offset": 3,
|
|
83
|
-
"visitor_uuid": null,
|
|
84
|
-
"custom_fields": {},
|
|
85
|
-
"tags": [],
|
|
86
|
-
"created_at": "2023-01-30T07:42:12Z",
|
|
87
|
-
"ip_address": "000.000.00",
|
|
88
|
-
"user_agent": "Mozilla Firefox",
|
|
89
|
-
"lifetime_value": null,
|
|
90
|
-
"original_referrer": null,
|
|
91
|
-
"landing_url": null,
|
|
92
|
-
"prospect": false,
|
|
93
|
-
"base_lead_score": null,
|
|
94
|
-
"eu_consent": "unknown",
|
|
95
|
-
"sms_number": "079123123123",
|
|
96
|
-
"sms_consent": false,
|
|
97
|
-
"lead_score": null,
|
|
98
|
-
"user_id": null,
|
|
99
|
-
"links": {
|
|
100
|
-
"account": "00000000"
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
]
|
|
104
|
-
},
|
|
105
|
-
run(context) {
|
|
63
|
+
run({ auth, propsValue }) {
|
|
106
64
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
107
65
|
const request = {
|
|
108
66
|
method: pieces_common_1.HttpMethod.POST,
|
|
109
|
-
url: `${common_1.dripCommon.baseUrl(
|
|
67
|
+
url: `${common_1.dripCommon.baseUrl(propsValue.account_id)}/campaigns/${propsValue.campaign_id}/subscribers`,
|
|
110
68
|
body: {
|
|
111
|
-
subscribers: [
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
69
|
+
subscribers: [
|
|
70
|
+
{
|
|
71
|
+
email: propsValue.subscriber,
|
|
72
|
+
tags: propsValue.tags,
|
|
73
|
+
custom_fields: propsValue.custom_fields,
|
|
74
|
+
},
|
|
75
|
+
],
|
|
116
76
|
},
|
|
117
77
|
headers: {
|
|
118
|
-
|
|
78
|
+
Authorization: common_1.dripCommon.authorizationHeader(auth),
|
|
119
79
|
},
|
|
120
80
|
queryParams: {},
|
|
121
81
|
};
|
|
122
82
|
return yield pieces_common_1.httpClient.sendRequest(request);
|
|
123
83
|
});
|
|
124
|
-
}
|
|
84
|
+
},
|
|
125
85
|
});
|
|
126
86
|
//# sourceMappingURL=add-subscriber-to-campaign.action.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-subscriber-to-campaign.action.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"add-subscriber-to-campaign.action.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/drip/src/lib/actions/add-subscriber-to-campaign.action.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAIqC;AACrC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,CAAC,IAAI,EAAE,CAAC;gBACtD,CAAC,CAAC,CAAC;gBACH,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE;oBACrB,OAAO;wBACL,QAAQ,EAAE,KAAK;wBACf,OAAO,EAAE,EAAE;wBACX,WAAW,EAAE,wCAAwC;qBACtD,CAAC;iBACH;gBACD,OAAO;oBACL,QAAQ,EAAE,KAAK;oBACf,OAAO,EAAE,IAAI;iBACd,CAAC;YACJ,CAAC,CAAA;SACF,CAAC;QACF,UAAU,EAAE,mBAAU,CAAC,UAAU;QACjC,IAAI,EAAE,mBAAU,CAAC,IAAI;QACrB,aAAa,EAAE,mBAAU,CAAC,aAAa;KACxC;IACK,GAAG,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE;;YAC5B,MAAM,OAAO,GAAgB;gBAC3B,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,GAAG,EAAE,GAAG,mBAAU,CAAC,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC,cAC/C,UAAU,CAAC,WACb,cAAc;gBACd,IAAI,EAAE;oBACJ,WAAW,EAAE;wBACX;4BACE,KAAK,EAAE,UAAU,CAAC,UAAU;4BAC5B,IAAI,EAAE,UAAU,CAAC,IAAI;4BACrB,aAAa,EAAE,UAAU,CAAC,aAAa;yBACxC;qBACF;iBACF;gBACD,OAAO,EAAE;oBACP,aAAa,EAAE,mBAAU,CAAC,mBAAmB,CAAC,IAAI,CAAC;iBACpD;gBACD,WAAW,EAAE,EAAE;aAChB,CAAC;YACF,OAAO,MAAM,0BAAU,CAAC,WAAW,CAAwB,OAAO,CAAC,CAAC;QACtE,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -1 +1,5 @@
|
|
|
1
|
-
export declare const dripApplyTagToSubscriber: import("@activepieces/pieces-framework").
|
|
1
|
+
export declare const dripApplyTagToSubscriber: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
account_id: import("@activepieces/pieces-framework").DropdownProperty<string, true>;
|
|
3
|
+
subscriber: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
tag: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
5
|
+
}>;
|
|
@@ -5,39 +5,41 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
6
|
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
7
|
const common_1 = require("../common");
|
|
8
|
+
const __1 = require("../../");
|
|
8
9
|
exports.dripApplyTagToSubscriber = (0, pieces_framework_1.createAction)({
|
|
10
|
+
auth: __1.dripAuth,
|
|
9
11
|
name: 'apply_tag_to_subscriber',
|
|
10
12
|
description: 'Apply a tag to a subscriber',
|
|
11
13
|
displayName: 'Apply a tag to subscriber',
|
|
12
14
|
props: {
|
|
13
|
-
authentication: common_1.dripCommon.authentication,
|
|
14
15
|
account_id: common_1.dripCommon.account_id,
|
|
15
16
|
subscriber: common_1.dripCommon.subscriber,
|
|
16
17
|
tag: pieces_framework_1.Property.ShortText({
|
|
17
|
-
displayName:
|
|
18
|
+
displayName: 'Tag',
|
|
18
19
|
required: true,
|
|
19
|
-
description:
|
|
20
|
-
})
|
|
20
|
+
description: 'Tag to apply',
|
|
21
|
+
}),
|
|
21
22
|
},
|
|
22
|
-
|
|
23
|
-
run(context) {
|
|
23
|
+
run({ auth, propsValue }) {
|
|
24
24
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
25
25
|
const request = {
|
|
26
26
|
method: pieces_common_1.HttpMethod.POST,
|
|
27
|
-
url: `${common_1.dripCommon.baseUrl(
|
|
27
|
+
url: `${common_1.dripCommon.baseUrl(propsValue.account_id)}/tags`,
|
|
28
28
|
body: {
|
|
29
|
-
tags: [
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
tags: [
|
|
30
|
+
{
|
|
31
|
+
email: propsValue.subscriber,
|
|
32
|
+
tag: propsValue.tag,
|
|
33
|
+
},
|
|
34
|
+
],
|
|
33
35
|
},
|
|
34
36
|
headers: {
|
|
35
|
-
|
|
37
|
+
Authorization: common_1.dripCommon.authorizationHeader(auth),
|
|
36
38
|
},
|
|
37
39
|
queryParams: {},
|
|
38
40
|
};
|
|
39
41
|
return yield pieces_common_1.httpClient.sendRequest(request);
|
|
40
42
|
});
|
|
41
|
-
}
|
|
43
|
+
},
|
|
42
44
|
});
|
|
43
45
|
//# sourceMappingURL=apply-tag-to-subscriber.action.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apply-tag-to-subscriber.action.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"apply-tag-to-subscriber.action.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/drip/src/lib/actions/apply-tag-to-subscriber.action.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAIqC;AACrC,sCAAuC;AACvC,8BAAkC;AAErB,QAAA,wBAAwB,GAAG,IAAA,+BAAY,EAAC;IACnD,IAAI,EAAE,YAAQ;IACd,IAAI,EAAE,yBAAyB;IAC/B,WAAW,EAAE,6BAA6B;IAC1C,WAAW,EAAE,2BAA2B;IACxC,KAAK,EAAE;QACL,UAAU,EAAE,mBAAU,CAAC,UAAU;QACjC,UAAU,EAAE,mBAAU,CAAC,UAAU;QACjC,GAAG,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACtB,WAAW,EAAE,KAAK;YAClB,QAAQ,EAAE,IAAI;YACd,WAAW,EAAE,cAAc;SAC5B,CAAC;KACH;IACK,GAAG,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE;;YAC5B,MAAM,OAAO,GAAgB;gBAC3B,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,GAAG,EAAE,GAAG,mBAAU,CAAC,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC,OAAO;gBACxD,IAAI,EAAE;oBACJ,IAAI,EAAE;wBACJ;4BACE,KAAK,EAAE,UAAU,CAAC,UAAU;4BAC5B,GAAG,EAAE,UAAU,CAAC,GAAG;yBACpB;qBACF;iBACF;gBACD,OAAO,EAAE;oBACP,aAAa,EAAE,mBAAU,CAAC,mBAAmB,CAAC,IAAI,CAAC;iBACpD;gBACD,WAAW,EAAE,EAAE;aAChB,CAAC;YACF,OAAO,MAAM,0BAAU,CAAC,WAAW,CAAwB,OAAO,CAAC,CAAC;QACtE,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -1 +1,14 @@
|
|
|
1
|
-
export declare const dripUpsertSubscriberAction: import("@activepieces/pieces-framework").
|
|
1
|
+
export declare const dripUpsertSubscriberAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
account_id: import("@activepieces/pieces-framework").DropdownProperty<string, true>;
|
|
3
|
+
subscriber: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
tags: import("@activepieces/pieces-framework").ArrayProperty<false>;
|
|
5
|
+
custom_fields: import("@activepieces/pieces-framework").ObjectProperty<false>;
|
|
6
|
+
first_name: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
7
|
+
last_name: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
8
|
+
zip: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
9
|
+
country: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
10
|
+
state: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
11
|
+
city: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
12
|
+
phone: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
13
|
+
address: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
14
|
+
}>;
|
|
@@ -5,95 +5,85 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
6
|
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
7
|
const common_1 = require("../common");
|
|
8
|
+
const __1 = require("../../");
|
|
8
9
|
exports.dripUpsertSubscriberAction = (0, pieces_framework_1.createAction)({
|
|
10
|
+
auth: __1.dripAuth,
|
|
9
11
|
name: 'upsert_subscriber',
|
|
10
12
|
description: 'Create or Update Subscriber',
|
|
11
13
|
displayName: 'Create or Update Subscriber',
|
|
12
14
|
props: {
|
|
13
|
-
authentication: common_1.dripCommon.authentication,
|
|
14
15
|
account_id: common_1.dripCommon.account_id,
|
|
15
16
|
subscriber: common_1.dripCommon.subscriber,
|
|
16
17
|
tags: common_1.dripCommon.tags,
|
|
17
18
|
custom_fields: common_1.dripCommon.custom_fields,
|
|
18
|
-
first_name: pieces_framework_1.Property.ShortText({
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
19
|
+
first_name: pieces_framework_1.Property.ShortText({
|
|
20
|
+
displayName: 'First Name',
|
|
21
|
+
required: false,
|
|
22
|
+
}),
|
|
23
|
+
last_name: pieces_framework_1.Property.ShortText({
|
|
24
|
+
displayName: 'Last Name',
|
|
25
|
+
required: false,
|
|
26
|
+
}),
|
|
27
|
+
zip: pieces_framework_1.Property.ShortText({
|
|
28
|
+
displayName: 'Zip Code',
|
|
29
|
+
description: 'Postal code in which the subscriber resides',
|
|
30
|
+
required: false,
|
|
31
|
+
}),
|
|
32
|
+
country: pieces_framework_1.Property.ShortText({
|
|
33
|
+
displayName: 'Country',
|
|
34
|
+
description: 'The country in which the subscriber resides',
|
|
35
|
+
required: false,
|
|
36
|
+
}),
|
|
37
|
+
state: pieces_framework_1.Property.ShortText({
|
|
38
|
+
displayName: 'State',
|
|
39
|
+
description: 'The region in which the subscriber resides',
|
|
40
|
+
required: false,
|
|
41
|
+
}),
|
|
42
|
+
city: pieces_framework_1.Property.ShortText({
|
|
43
|
+
displayName: 'City',
|
|
44
|
+
description: 'The city in which the subscriber resides',
|
|
45
|
+
required: false,
|
|
46
|
+
}),
|
|
47
|
+
phone: pieces_framework_1.Property.ShortText({
|
|
48
|
+
displayName: 'Phone',
|
|
49
|
+
description: "The subscriber's primary phone number",
|
|
50
|
+
required: false,
|
|
51
|
+
}),
|
|
52
|
+
address: pieces_framework_1.Property.ShortText({
|
|
53
|
+
displayName: 'Address',
|
|
54
|
+
description: "The subscriber's mailing address",
|
|
55
|
+
required: false,
|
|
56
|
+
}),
|
|
26
57
|
},
|
|
27
|
-
|
|
28
|
-
"links": {
|
|
29
|
-
"subscribers.account": "https://api.getdrip.com/v2/accounts/{subscribers.account}"
|
|
30
|
-
},
|
|
31
|
-
"subscribers": [
|
|
32
|
-
{
|
|
33
|
-
"id": "1e0ukqg4yzqo1bxyy18f",
|
|
34
|
-
"href": "https://api.getdrip.com/v2/AAAAAAA/subscribers/AAAAAAA",
|
|
35
|
-
"status": "active",
|
|
36
|
-
"email": "yrdd@ggg.com",
|
|
37
|
-
"first_name": "joe",
|
|
38
|
-
"last_name": "doe",
|
|
39
|
-
"address1": "Iraq,Baghdad",
|
|
40
|
-
"address2": "Amman,Jordan",
|
|
41
|
-
"city": "Baghdad",
|
|
42
|
-
"state": "Baghdad",
|
|
43
|
-
"zip": "10011",
|
|
44
|
-
"phone": "079123123123",
|
|
45
|
-
"country": "Iraq",
|
|
46
|
-
"time_zone": "Baghdad GMT+3",
|
|
47
|
-
"utc_offset": 3,
|
|
48
|
-
"visitor_uuid": null,
|
|
49
|
-
"custom_fields": {},
|
|
50
|
-
"tags": [],
|
|
51
|
-
"created_at": "2023-01-30T07:42:12Z",
|
|
52
|
-
"ip_address": "000.000.00",
|
|
53
|
-
"user_agent": "Mozilla Firefox",
|
|
54
|
-
"lifetime_value": null,
|
|
55
|
-
"original_referrer": null,
|
|
56
|
-
"landing_url": null,
|
|
57
|
-
"prospect": false,
|
|
58
|
-
"base_lead_score": null,
|
|
59
|
-
"eu_consent": "unknown",
|
|
60
|
-
"sms_number": "079123123123",
|
|
61
|
-
"sms_consent": false,
|
|
62
|
-
"lead_score": null,
|
|
63
|
-
"user_id": null,
|
|
64
|
-
"links": {
|
|
65
|
-
"account": "00000000"
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
]
|
|
69
|
-
},
|
|
70
|
-
run(context) {
|
|
58
|
+
run({ auth, propsValue }) {
|
|
71
59
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
72
60
|
const request = {
|
|
73
61
|
method: pieces_common_1.HttpMethod.POST,
|
|
74
|
-
url: `${common_1.dripCommon.baseUrl(
|
|
62
|
+
url: `${common_1.dripCommon.baseUrl(propsValue.account_id)}/subscribers`,
|
|
75
63
|
body: {
|
|
76
|
-
subscribers: [
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
64
|
+
subscribers: [
|
|
65
|
+
{
|
|
66
|
+
email: propsValue.subscriber,
|
|
67
|
+
tags: propsValue.tags,
|
|
68
|
+
custom_fields: propsValue.custom_fields,
|
|
69
|
+
country: propsValue.country,
|
|
70
|
+
address1: propsValue.address,
|
|
71
|
+
city: propsValue.city,
|
|
72
|
+
state: propsValue.state,
|
|
73
|
+
zip: propsValue.zip,
|
|
74
|
+
phone: propsValue.phone,
|
|
75
|
+
first_name: propsValue.first_name,
|
|
76
|
+
last_name: propsValue.last_name,
|
|
77
|
+
},
|
|
78
|
+
],
|
|
89
79
|
},
|
|
90
80
|
headers: {
|
|
91
|
-
|
|
81
|
+
Authorization: common_1.dripCommon.authorizationHeader(auth),
|
|
92
82
|
},
|
|
93
83
|
queryParams: {},
|
|
94
84
|
};
|
|
95
85
|
return yield pieces_common_1.httpClient.sendRequest(request);
|
|
96
86
|
});
|
|
97
|
-
}
|
|
87
|
+
},
|
|
98
88
|
});
|
|
99
89
|
//# sourceMappingURL=upsert-subscriber.action.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upsert-subscriber.action.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"upsert-subscriber.action.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/drip/src/lib/actions/upsert-subscriber.action.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAIqC;AACrC,sCAAuC;AACvC,8BAAkC;AAErB,QAAA,0BAA0B,GAAG,IAAA,+BAAY,EAAC;IACrD,IAAI,EAAE,YAAQ;IACd,IAAI,EAAE,mBAAmB;IACzB,WAAW,EAAE,6BAA6B;IAC1C,WAAW,EAAE,6BAA6B;IAC1C,KAAK,EAAE;QACL,UAAU,EAAE,mBAAU,CAAC,UAAU;QACjC,UAAU,EAAE,mBAAU,CAAC,UAAU;QACjC,IAAI,EAAE,mBAAU,CAAC,IAAI;QACrB,aAAa,EAAE,mBAAU,CAAC,aAAa;QACvC,UAAU,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC7B,WAAW,EAAE,YAAY;YACzB,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,SAAS,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC5B,WAAW,EAAE,WAAW;YACxB,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,GAAG,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACtB,WAAW,EAAE,UAAU;YACvB,WAAW,EAAE,6CAA6C;YAC1D,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,OAAO,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC1B,WAAW,EAAE,SAAS;YACtB,WAAW,EAAE,6CAA6C;YAC1D,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,KAAK,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACxB,WAAW,EAAE,OAAO;YACpB,WAAW,EAAE,4CAA4C;YACzD,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,IAAI,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACvB,WAAW,EAAE,MAAM;YACnB,WAAW,EAAE,0C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
|
1
1
|
export declare const dripCommon: {
|
|
2
2
|
baseUrl: (accountId: string) => string;
|
|
3
|
-
authentication: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
4
3
|
account_id: import("@activepieces/pieces-framework").DropdownProperty<string, true>;
|
|
5
4
|
subscriber: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
6
5
|
tags: import("@activepieces/pieces-framework").ArrayProperty<false>;
|
package/src/lib/common/index.js
CHANGED
|
@@ -5,29 +5,26 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
6
|
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
7
|
exports.dripCommon = {
|
|
8
|
-
baseUrl: (accountId) => {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
required: true,
|
|
12
|
-
description: "Get it from https://www.getdrip.com/user/edit"
|
|
13
|
-
}),
|
|
8
|
+
baseUrl: (accountId) => {
|
|
9
|
+
return `https://api.getdrip.com/v2/${accountId}`;
|
|
10
|
+
},
|
|
14
11
|
account_id: pieces_framework_1.Property.Dropdown({
|
|
15
12
|
displayName: 'Account',
|
|
16
13
|
required: true,
|
|
17
|
-
refreshers: [
|
|
18
|
-
options: (
|
|
19
|
-
if (!
|
|
14
|
+
refreshers: [],
|
|
15
|
+
options: ({ auth }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
16
|
+
if (!auth) {
|
|
20
17
|
return {
|
|
21
18
|
disabled: true,
|
|
22
19
|
options: [],
|
|
23
|
-
placeholder:
|
|
20
|
+
placeholder: 'Please fill in API key first',
|
|
24
21
|
};
|
|
25
22
|
}
|
|
26
23
|
const request = {
|
|
27
24
|
method: pieces_common_1.HttpMethod.GET,
|
|
28
|
-
url:
|
|
25
|
+
url: 'https://api.getdrip.com/v2/accounts',
|
|
29
26
|
headers: {
|
|
30
|
-
Authorization: `Basic ${Buffer.from(
|
|
27
|
+
Authorization: `Basic ${Buffer.from(auth).toString('base64')}`,
|
|
31
28
|
},
|
|
32
29
|
};
|
|
33
30
|
const response = yield pieces_common_1.httpClient.sendRequest(request);
|
|
@@ -38,19 +35,23 @@ exports.dripCommon = {
|
|
|
38
35
|
disabled: false,
|
|
39
36
|
options: opts,
|
|
40
37
|
};
|
|
41
|
-
})
|
|
38
|
+
}),
|
|
39
|
+
}),
|
|
40
|
+
subscriber: pieces_framework_1.Property.ShortText({
|
|
41
|
+
required: true,
|
|
42
|
+
displayName: 'Subscriber Email',
|
|
43
|
+
description: 'Email of the subscriber',
|
|
42
44
|
}),
|
|
43
|
-
subscriber: pieces_framework_1.Property.ShortText({ required: true, displayName: "Subscriber Email", description: "Email of the subscriber" }),
|
|
44
45
|
tags: pieces_framework_1.Property.Array({
|
|
45
|
-
displayName:
|
|
46
|
+
displayName: 'tags',
|
|
46
47
|
required: false,
|
|
47
|
-
description:
|
|
48
|
+
description: 'Tags to apply to subscriber',
|
|
48
49
|
}),
|
|
49
50
|
custom_fields: pieces_framework_1.Property.Object({
|
|
50
|
-
displayName:
|
|
51
|
+
displayName: 'Custom Fields',
|
|
51
52
|
required: false,
|
|
52
|
-
description:
|
|
53
|
+
description: 'Custom field data about the subscriber',
|
|
53
54
|
}),
|
|
54
|
-
authorizationHeader: (apiKey) => `Basic ${Buffer.from(apiKey).toString('base64')}
|
|
55
|
+
authorizationHeader: (apiKey) => `Basic ${Buffer.from(apiKey).toString('base64')}`,
|
|
55
56
|
};
|
|
56
57
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/drip/src/lib/common/index.ts"],"names":[],"mappings":";;;;AAAA,qEAA0D;AAC1D,+DAIqC;AAExB,QAAA,UAAU,GAAG;IACxB,OAAO,EAAE,CAAC,SAAiB,EAAE,EAAE;QAC7B,OAAO,8BAA8B,SAAS,EAAE,CAAC;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AAQ,CAAC,MAAM,CAAC;QAC7B,WAAW,EAAE,eAAe;QAC5B,QAAQ,EAAE,KAAK;QACf,WAAW,EAAE,wCAAwC;KACtD,CAAC;IACF,mBAAmB,EAAE,CAAC,MAAc,EAAE,EAAE,CACtC,SAAS,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE;CACpD,CAAC"}
|
|
@@ -1 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import { TriggerStrategy } from '@activepieces/pieces-framework';
|
|
2
|
+
export declare const dripNewSubscriberEvent: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
3
|
+
account_id: import("@activepieces/pieces-framework").DropdownProperty<string, true>;
|
|
4
|
+
}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
5
|
+
account_id: import("@activepieces/pieces-framework").DropdownProperty<string, true>;
|
|
6
|
+
}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
7
|
+
account_id: import("@activepieces/pieces-framework").DropdownProperty<string, true>;
|
|
8
|
+
}>;
|
|
@@ -5,43 +5,43 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
6
6
|
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
7
7
|
const common_1 = require("../common");
|
|
8
|
+
const __1 = require("../../");
|
|
8
9
|
const triggerNameInStore = 'drip_new_subscriber_trigger';
|
|
9
10
|
exports.dripNewSubscriberEvent = (0, pieces_framework_1.createTrigger)({
|
|
11
|
+
auth: __1.dripAuth,
|
|
10
12
|
name: 'new_subscriber',
|
|
11
13
|
displayName: 'New Subscriber',
|
|
12
14
|
description: 'Triggers when a subscriber is created in your Drip account.',
|
|
13
15
|
props: {
|
|
14
|
-
|
|
15
|
-
account_id: common_1.dripCommon.account_id
|
|
16
|
+
account_id: common_1.dripCommon.account_id,
|
|
16
17
|
},
|
|
17
18
|
sampleData: {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
event: 'subscriber.created',
|
|
20
|
+
data: {
|
|
21
|
+
account_id: '9999999',
|
|
22
|
+
subscriber: {},
|
|
22
23
|
},
|
|
23
|
-
|
|
24
|
+
occurred_at: '2013-06-21T10:31:58Z',
|
|
24
25
|
},
|
|
25
26
|
type: pieces_framework_1.TriggerStrategy.WEBHOOK,
|
|
26
|
-
onEnable(
|
|
27
|
-
var _a;
|
|
27
|
+
onEnable({ auth, propsValue, webhookUrl, store }) {
|
|
28
28
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
29
29
|
const request = {
|
|
30
30
|
method: pieces_common_1.HttpMethod.POST,
|
|
31
|
-
url: `${common_1.dripCommon.baseUrl(
|
|
31
|
+
url: `${common_1.dripCommon.baseUrl(propsValue.account_id)}/webhooks`,
|
|
32
32
|
body: {
|
|
33
|
-
webhooks: [{ post_url:
|
|
33
|
+
webhooks: [{ post_url: webhookUrl, events: ['subscriber.created'] }],
|
|
34
34
|
},
|
|
35
35
|
headers: {
|
|
36
|
-
|
|
36
|
+
Authorization: common_1.dripCommon.authorizationHeader(auth),
|
|
37
37
|
},
|
|
38
38
|
queryParams: {},
|
|
39
39
|
};
|
|
40
40
|
const { body } = yield pieces_common_1.httpClient.sendRequest(request);
|
|
41
|
-
yield
|
|
41
|
+
yield store.put(triggerNameInStore, {
|
|
42
42
|
webhookId: body.webhooks[0].id,
|
|
43
|
-
userId:
|
|
44
|
-
})
|
|
43
|
+
userId: propsValue.account_id,
|
|
44
|
+
});
|
|
45
45
|
});
|
|
46
46
|
},
|
|
47
47
|
onDisable(context) {
|
|
@@ -53,7 +53,7 @@ exports.dripNewSubscriberEvent = (0, pieces_framework_1.createTrigger)({
|
|
|
53
53
|
method: pieces_common_1.HttpMethod.DELETE,
|
|
54
54
|
url: `${common_1.dripCommon.baseUrl(response.userId)}/webhooks/${response.webhookId}`,
|
|
55
55
|
headers: {
|
|
56
|
-
|
|
56
|
+
Authorization: common_1.dripCommon.authorizationHeader(context.auth),
|
|
57
57
|
},
|
|
58
58
|
};
|
|
59
59
|
yield pieces_common_1.httpClient.sendRequest(request);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"new-subscriber.trigger.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"new-subscriber.trigger.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/drip/src/lib/trigger/new-subscriber.trigger.ts"],"names":[],"mappings":";;;;AAAA,+DAIqC;AACrC,qEAAgF;AAChF,sCAAuC;AACvC,8BAAkC;AAElC,MAAM,kBAAkB,GAAG,6BAA6B,CAAC;AAC5C,QAAA,sBAAsB,GAAG,IAAA,gCAAa,EAAC;IAClD,IAAI,EAAE,YAAQ;IACd,IAAI,EAAE,gBAAgB;IACtB,WAAW,EAAE,gBAAgB;IAC7B,WAAW,EAAE,6DAA6D;IAC1E,KAAK,EAAE;QACL,UAAU,EAAE,mBAAU,CAAC,UAAU;KAClC;IACD,UAAU,EAAE;QACV,KAAK,EAAE,oBAAoB;QAC3B,IAAI,EAAE;YACJ,UAAU,EAAE,SAAS;YACrB,UAAU,EAAE,EAAE;SACf;QACD,WAAW,EAAE,sBAAsB;KACpC;IACD,IAAI,EAAE,kCAAe,CAAC,OAAO;IACvB,QAAQ,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,KAAK,EAAE;;YACpD,MAAM,OAAO,GAAgB;gBAC3B,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,GAAG,EAAE,GAAG,mBAAU,CAAC,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC,WAAW;gBAC5D,IAAI,EAAE;oBACJ,QAAQ,EAAE,CAAC,EAAE,QAAQ,EAAE,UAAU,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: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
3
|
+
account_id: import("@activepieces/pieces-framework").DropdownProperty<string, true>;
|
|
4
|
+
}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
5
|
+
account_id: import("@activepieces/pieces-framework").DropdownProperty<string, true>;
|
|
6
|
+
}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
7
|
+
account_id: import("@activepieces/pieces-framework").DropdownProperty<string, true>;
|
|
8
|
+
}>;
|
|
@@ -5,25 +5,26 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
6
6
|
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
7
7
|
const common_1 = require("../common");
|
|
8
|
+
const __1 = require("../../");
|
|
8
9
|
const triggerNameInStore = 'drip_tag_applied_to_subscriber_trigger';
|
|
9
10
|
exports.dripTagAppliedEvent = (0, pieces_framework_1.createTrigger)({
|
|
11
|
+
auth: __1.dripAuth,
|
|
10
12
|
name: 'tag_applied_to_subscribers',
|
|
11
13
|
displayName: 'Tag Applied',
|
|
12
14
|
description: 'Triggers when a tag is applied.',
|
|
13
15
|
props: {
|
|
14
|
-
|
|
15
|
-
account_id: common_1.dripCommon.account_id
|
|
16
|
+
account_id: common_1.dripCommon.account_id,
|
|
16
17
|
},
|
|
17
18
|
sampleData: {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
19
|
+
event: 'subscriber.applied_tag',
|
|
20
|
+
data: {
|
|
21
|
+
account_id: '9999999',
|
|
22
|
+
subscriber: {},
|
|
23
|
+
properties: {
|
|
24
|
+
tag: 'Customer',
|
|
25
|
+
},
|
|
25
26
|
},
|
|
26
|
-
|
|
27
|
+
occurred_at: '2013-06-21T10:31:58Z',
|
|
27
28
|
},
|
|
28
29
|
type: pieces_framework_1.TriggerStrategy.WEBHOOK,
|
|
29
30
|
onEnable(context) {
|
|
@@ -31,19 +32,21 @@ exports.dripTagAppliedEvent = (0, pieces_framework_1.createTrigger)({
|
|
|
31
32
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
32
33
|
const request = {
|
|
33
34
|
method: pieces_common_1.HttpMethod.POST,
|
|
34
|
-
url: `${common_1.dripCommon.baseUrl(context.propsValue
|
|
35
|
+
url: `${common_1.dripCommon.baseUrl(context.propsValue.account_id)}/webhooks`,
|
|
35
36
|
body: {
|
|
36
|
-
webhooks: [
|
|
37
|
+
webhooks: [
|
|
38
|
+
{ post_url: context.webhookUrl, events: ['subscriber.applied_tag'] },
|
|
39
|
+
],
|
|
37
40
|
},
|
|
38
41
|
headers: {
|
|
39
|
-
|
|
42
|
+
Authorization: common_1.dripCommon.authorizationHeader(context.auth),
|
|
40
43
|
},
|
|
41
44
|
queryParams: {},
|
|
42
45
|
};
|
|
43
46
|
const { body } = yield pieces_common_1.httpClient.sendRequest(request);
|
|
44
47
|
yield ((_a = context.store) === null || _a === void 0 ? void 0 : _a.put(triggerNameInStore, {
|
|
45
48
|
webhookId: body.webhooks[0].id,
|
|
46
|
-
userId: context.propsValue[
|
|
49
|
+
userId: context.propsValue['account_id'],
|
|
47
50
|
}));
|
|
48
51
|
});
|
|
49
52
|
},
|
|
@@ -56,7 +59,7 @@ exports.dripTagAppliedEvent = (0, pieces_framework_1.createTrigger)({
|
|
|
56
59
|
method: pieces_common_1.HttpMethod.DELETE,
|
|
57
60
|
url: `${common_1.dripCommon.baseUrl(response.userId)}/webhooks/${response.webhookId}`,
|
|
58
61
|
headers: {
|
|
59
|
-
|
|
62
|
+
Authorization: common_1.dripCommon.authorizationHeader(context.auth),
|
|
60
63
|
},
|
|
61
64
|
};
|
|
62
65
|
yield pieces_common_1.httpClient.sendRequest(request);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"new-tag.trigger.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"new-tag.trigger.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/drip/src/lib/trigger/new-tag.trigger.ts"],"names":[],"mappings":";;;;AAAA,+DAIqC;AACrC,qEAAgF;AAChF,sCAAuC;AACvC,8BAAkC;AAElC,MAAM,kBAAkB,GAAG,wCAAwC,CAAC;AACvD,QAAA,mBAAmB,GAAG,IAAA,gCAAa,EAAC;IAC/C,IAAI,EAAE,YAAQ;IACd,IAAI,EAAE,4BAA4B;IAClC,WAAW,EAAE,aAAa;IAC1B,WAAW,EAAE,iCAAiC;IAC9C,KAAK,EAAE;QACL,UAAU,EAAE,mBAAU,CAAC,UAAU;KAClC;IACD,UAAU,EAAE;QACV,KAAK,EAAE,wBAAwB;QAC/B,IAAI,EAAE;YACJ,UAAU,EAAE,SAAS;YACrB,UAAU,EAAE,EAAE;YACd,UAAU,EAAE;gBACV,GAAG,EAAE,UAAU;aAChB;SACF;QACD,WAAW,EAAE,sBAAsB;KACpC;IACD,IAAI,EAAE,kCAAe,CAAC,OAAO;IACvB,QAAQ,CAAC,OAAO;;;YACpB,MAAM,OAAO,GAAgB;gBAC3B,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,GAAG,EAAE,GAAG,mBAAU,CAAC,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC,WAAW;gBACpE,IAAI,EAAE;oBACJ,QAAQ,EAAE;wBACR,EAAE,QAAQ,EAAE,OAAO,CAAC,UAAU,EAAE,MAAM,EAAE,CAAC,wBAAwB,CAAC,EAAE;qBACrE;iBACF;gBACD,OAAO,EAAE;oBACP,aAAa,EAAE,mBAAU,CAAC,mBAAmB,CAAC,OAAO,CAAC,IAAI,CAAC;iBAC5D;gBACD,WAAW,EAAE,EAAE;aAChB,CAAC;YACF,MAAM,EAAE,IAA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