@activepieces/piece-drip 0.0.0-pre1
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/README.md +7 -0
- package/package.json +17 -0
- package/src/index.d.ts +1 -0
- package/src/index.js +21 -0
- package/src/index.js.map +1 -0
- package/src/lib/actions/add-subscriber-to-campaign.action.d.ts +1 -0
- package/src/lib/actions/add-subscriber-to-campaign.action.js +125 -0
- package/src/lib/actions/add-subscriber-to-campaign.action.js.map +1 -0
- package/src/lib/actions/apply-tag-to-subscriber.action.d.ts +1 -0
- package/src/lib/actions/apply-tag-to-subscriber.action.js +42 -0
- package/src/lib/actions/apply-tag-to-subscriber.action.js.map +1 -0
- package/src/lib/actions/upsert-subscriber.action.d.ts +1 -0
- package/src/lib/actions/upsert-subscriber.action.js +98 -0
- package/src/lib/actions/upsert-subscriber.action.js.map +1 -0
- package/src/lib/common/index.d.ts +9 -0
- package/src/lib/common/index.js +55 -0
- package/src/lib/common/index.js.map +1 -0
- package/src/lib/trigger/new-subscriber.trigger.d.ts +1 -0
- package/src/lib/trigger/new-subscriber.trigger.js +68 -0
- package/src/lib/trigger/new-subscriber.trigger.js.map +1 -0
- package/src/lib/trigger/new-tag.trigger.d.ts +1 -0
- package/src/lib/trigger/new-tag.trigger.js +71 -0
- package/src/lib/trigger/new-tag.trigger.js.map +1 -0
package/README.md
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@activepieces/piece-drip",
|
|
3
|
+
"version": "0.0.0-pre1",
|
|
4
|
+
"dependencies": {
|
|
5
|
+
"@sinclair/typebox": "0.24.51",
|
|
6
|
+
"axios": "1.2.4",
|
|
7
|
+
"cron-validator": "1.3.1",
|
|
8
|
+
"nanoid": "3.3.4"
|
|
9
|
+
},
|
|
10
|
+
"peerDependencies": {
|
|
11
|
+
"@activepieces/framework": "0.0.1",
|
|
12
|
+
"@activepieces/shared": "0.0.1",
|
|
13
|
+
"tslib": "2.4.1"
|
|
14
|
+
},
|
|
15
|
+
"main": "./src/index.js",
|
|
16
|
+
"types": "./src/index.d.ts"
|
|
17
|
+
}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const drip: import("@activepieces/framework").Piece;
|
package/src/index.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.drip = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const package_json_1 = tslib_1.__importDefault(require("../package.json"));
|
|
6
|
+
const framework_1 = require("@activepieces/framework");
|
|
7
|
+
const add_subscriber_to_campaign_action_1 = require("./lib/actions/add-subscriber-to-campaign.action");
|
|
8
|
+
const apply_tag_to_subscriber_action_1 = require("./lib/actions/apply-tag-to-subscriber.action");
|
|
9
|
+
const upsert_subscriber_action_1 = require("./lib/actions/upsert-subscriber.action");
|
|
10
|
+
const new_subscriber_trigger_1 = require("./lib/trigger/new-subscriber.trigger");
|
|
11
|
+
const new_tag_trigger_1 = require("./lib/trigger/new-tag.trigger");
|
|
12
|
+
exports.drip = (0, framework_1.createPiece)({
|
|
13
|
+
name: 'drip',
|
|
14
|
+
displayName: 'Drip',
|
|
15
|
+
logoUrl: 'https://cdn.activepieces.com/pieces/drip.png',
|
|
16
|
+
version: package_json_1.default.version,
|
|
17
|
+
authors: ['AbdulTheActivePiecer'],
|
|
18
|
+
actions: [apply_tag_to_subscriber_action_1.dripApplyTagToSubscriber, add_subscriber_to_campaign_action_1.dripAddSubscriberToCampaign, upsert_subscriber_action_1.dripUpsertSubscriberAction],
|
|
19
|
+
triggers: [new_subscriber_trigger_1.dripNewSubscriberEvent, new_tag_trigger_1.dripTagAppliedEvent],
|
|
20
|
+
});
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/pieces/drip/src/index.ts"],"names":[],"mappings":";;;;AAAA,2EAA0C;AAC1C,uDAAsD;AACtD,uGAA8F;AAC9F,iGAAwF;AACxF,qFAAoF;AACpF,iFAA8E;AAC9E,mEAAoE;AAGvD,QAAA,IAAI,GAAG,IAAA,uBAAW,EAAC;IAC/B,IAAI,EAAE,MAAM;IACZ,WAAW,EAAE,MAAM;IACnB,OAAO,EAAE,8CAA8C;IACtD,OAAO,EAAE,sBAAW,CAAC,OAAO;IAC7B,OAAO,EAAE,CAAC,sBAAsB,CAAC;IACjC,OAAO,EAAE,CAAC,yDAAwB,EAAE,+DAA2B,EAAE,qDAA0B,CAAC;IAC5F,QAAQ,EAAE,CAAC,+CAAsB,EAAE,qCAAmB,CAAC;CACvD,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const dripAddSubscriberToCampaign: import("@activepieces/framework").Action;
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.dripAddSubscriberToCampaign = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const framework_1 = require("@activepieces/framework");
|
|
6
|
+
const common_1 = require("../common");
|
|
7
|
+
exports.dripAddSubscriberToCampaign = (0, framework_1.createAction)({
|
|
8
|
+
name: 'add_subscriber_to_campaign',
|
|
9
|
+
description: 'Add a subscriber to a campaign (Email series)',
|
|
10
|
+
displayName: 'Add a subscriber to a campaign',
|
|
11
|
+
props: {
|
|
12
|
+
authentication: common_1.dripCommon.authentication,
|
|
13
|
+
account_id: common_1.dripCommon.account_id,
|
|
14
|
+
campaign_id: framework_1.Property.Dropdown({
|
|
15
|
+
displayName: "Email Series Campaign",
|
|
16
|
+
refreshers: ["authentication", "account_id"],
|
|
17
|
+
required: true,
|
|
18
|
+
options: (props) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
19
|
+
if (!props['authentication']) {
|
|
20
|
+
return {
|
|
21
|
+
disabled: true,
|
|
22
|
+
options: [],
|
|
23
|
+
placeholder: "Please fill in API key first"
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
if (!props['account_id']) {
|
|
27
|
+
return {
|
|
28
|
+
disabled: true,
|
|
29
|
+
options: [],
|
|
30
|
+
placeholder: "Please select an account first"
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
const request = {
|
|
34
|
+
method: framework_1.HttpMethod.GET,
|
|
35
|
+
url: `${common_1.dripCommon.baseUrl(props['account_id'])}/campaigns`,
|
|
36
|
+
headers: {
|
|
37
|
+
Authorization: `Basic ${Buffer.from(props["authentication"]).toString("base64")}`,
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
const response = yield framework_1.httpClient.sendRequest(request);
|
|
41
|
+
const opts = response.body.campaigns.map((campaign) => {
|
|
42
|
+
return { value: campaign.id, label: campaign.name };
|
|
43
|
+
});
|
|
44
|
+
if (opts.length === 0) {
|
|
45
|
+
return {
|
|
46
|
+
disabled: false,
|
|
47
|
+
options: [],
|
|
48
|
+
placeholder: "Please create an email series campaign"
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
return {
|
|
52
|
+
disabled: false,
|
|
53
|
+
options: opts,
|
|
54
|
+
};
|
|
55
|
+
})
|
|
56
|
+
}),
|
|
57
|
+
subscriber: common_1.dripCommon.subscriber,
|
|
58
|
+
tags: common_1.dripCommon.tags,
|
|
59
|
+
custom_fields: common_1.dripCommon.custom_fields,
|
|
60
|
+
},
|
|
61
|
+
sampleData: {
|
|
62
|
+
"links": {
|
|
63
|
+
"subscribers.account": "https://api.getdrip.com/v2/accounts/{subscribers.account}"
|
|
64
|
+
},
|
|
65
|
+
"subscribers": [
|
|
66
|
+
{
|
|
67
|
+
"id": "1e0ukqg4yzqo1bxyy18f",
|
|
68
|
+
"href": "https://api.getdrip.com/v2/AAAAAAA/subscribers/AAAAAAA",
|
|
69
|
+
"status": "active",
|
|
70
|
+
"email": "yrdd@ggg.com",
|
|
71
|
+
"first_name": "joe",
|
|
72
|
+
"last_name": "doe",
|
|
73
|
+
"address1": "Iraq,Baghdad",
|
|
74
|
+
"address2": "Amman,Jordan",
|
|
75
|
+
"city": "Baghdad",
|
|
76
|
+
"state": "Baghdad",
|
|
77
|
+
"zip": "10011",
|
|
78
|
+
"phone": "079123123123",
|
|
79
|
+
"country": "Iraq",
|
|
80
|
+
"time_zone": "Baghdad GMT+3",
|
|
81
|
+
"utc_offset": 3,
|
|
82
|
+
"visitor_uuid": null,
|
|
83
|
+
"custom_fields": {},
|
|
84
|
+
"tags": [],
|
|
85
|
+
"created_at": "2023-01-30T07:42:12Z",
|
|
86
|
+
"ip_address": "000.000.00",
|
|
87
|
+
"user_agent": "Mozilla Firefox",
|
|
88
|
+
"lifetime_value": null,
|
|
89
|
+
"original_referrer": null,
|
|
90
|
+
"landing_url": null,
|
|
91
|
+
"prospect": false,
|
|
92
|
+
"base_lead_score": null,
|
|
93
|
+
"eu_consent": "unknown",
|
|
94
|
+
"sms_number": "079123123123",
|
|
95
|
+
"sms_consent": false,
|
|
96
|
+
"lead_score": null,
|
|
97
|
+
"user_id": null,
|
|
98
|
+
"links": {
|
|
99
|
+
"account": "00000000"
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
]
|
|
103
|
+
},
|
|
104
|
+
run(context) {
|
|
105
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
106
|
+
const request = {
|
|
107
|
+
method: framework_1.HttpMethod.POST,
|
|
108
|
+
url: `${common_1.dripCommon.baseUrl(context.propsValue["account_id"])}/campaigns/${context.propsValue["campaign_id"]}/subscribers`,
|
|
109
|
+
body: {
|
|
110
|
+
subscribers: [{
|
|
111
|
+
email: context.propsValue["subscriber"],
|
|
112
|
+
tags: context.propsValue["tags"],
|
|
113
|
+
custom_fields: context.propsValue["custom_fields"]
|
|
114
|
+
}]
|
|
115
|
+
},
|
|
116
|
+
headers: {
|
|
117
|
+
'Authorization': common_1.dripCommon.authorizationHeader(context.propsValue["authentication"])
|
|
118
|
+
},
|
|
119
|
+
queryParams: {},
|
|
120
|
+
};
|
|
121
|
+
return yield framework_1.httpClient.sendRequest(request);
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
//# sourceMappingURL=add-subscriber-to-campaign.action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-subscriber-to-campaign.action.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/drip/src/lib/actions/add-subscriber-to-campaign.action.ts"],"names":[],"mappings":";;;;AAAA,uDAAsG;AACtG,sCAAuC;AAE1B,QAAA,2BAA2B,GAAG,IAAA,wBAAY,EAAC;IACpD,IAAI,EAAE,4BAA4B;IAClC,WAAW,EAAE,+CAA+C;IAC5D,WAAW,EAAE,gCAAgC;IAC7C,KAAK,EAAE;QACH,cAAc,EAAE,mBAAU,CAAC,cAAc;QACzC,UAAU,EAAE,mBAAU,CAAC,UAAU;QACjC,WAAW,EAAE,oBAAQ,CAAC,QAAQ,CAAC;YAC3B,WAAW,EAAE,uBAAuB;YACpC,UAAU,EAAE,CAAC,gBAAgB,EAAE,YAAY,CAAC;YAC5C,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE,CAAO,KAAK,EAAE,EAAE;gBACrB,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,EAAE;oBAC1B,OAAO;wBACH,QAAQ,EAAE,IAAI;wBACd,OAAO,EAAE,EAAE;wBACX,WAAW,EAAE,8BAA8B;qBAC9C,CAAA;iBACJ;gBACD,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,EAAE;oBACtB,OAAO;wBACH,QAAQ,EAAE,IAAI;wBACd,OAAO,EAAE,EAAE;wBACX,WAAW,EAAE,gCAAgC;qBAChD,CAAA;iBACJ;gBACD,MAAM,OAAO,GAAgB;oBACzB,MAAM,EAAE,sBAAU,CAAC,GAAG;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ACD,WAAW,EAAE,EAAE;aAClB,CAAC;YACF,OAAO,MAAM,sBAAU,CAAC,WAAW,CAAwB,OAAO,CAAC,CAAC;QACxE,CAAC;KAAA;CACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const dripApplyTagToSubscriber: import("@activepieces/framework").Action;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.dripApplyTagToSubscriber = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const framework_1 = require("@activepieces/framework");
|
|
6
|
+
const common_1 = require("../common");
|
|
7
|
+
exports.dripApplyTagToSubscriber = (0, framework_1.createAction)({
|
|
8
|
+
name: 'apply_tag_to_subscriber',
|
|
9
|
+
description: 'Apply a tag to a subscriber',
|
|
10
|
+
displayName: 'Apply a tag to subscriber',
|
|
11
|
+
props: {
|
|
12
|
+
authentication: common_1.dripCommon.authentication,
|
|
13
|
+
account_id: common_1.dripCommon.account_id,
|
|
14
|
+
subscriber: common_1.dripCommon.subscriber,
|
|
15
|
+
tag: framework_1.Property.ShortText({
|
|
16
|
+
displayName: "Tag",
|
|
17
|
+
required: true,
|
|
18
|
+
description: "Tag to apply"
|
|
19
|
+
})
|
|
20
|
+
},
|
|
21
|
+
sampleData: {},
|
|
22
|
+
run(context) {
|
|
23
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
const request = {
|
|
25
|
+
method: framework_1.HttpMethod.POST,
|
|
26
|
+
url: `${common_1.dripCommon.baseUrl(context.propsValue["account_id"])}/tags`,
|
|
27
|
+
body: {
|
|
28
|
+
tags: [{
|
|
29
|
+
email: context.propsValue["subscriber"],
|
|
30
|
+
tag: context.propsValue["tag"]
|
|
31
|
+
}]
|
|
32
|
+
},
|
|
33
|
+
headers: {
|
|
34
|
+
'Authorization': common_1.dripCommon.authorizationHeader(context.propsValue["authentication"])
|
|
35
|
+
},
|
|
36
|
+
queryParams: {},
|
|
37
|
+
};
|
|
38
|
+
return yield framework_1.httpClient.sendRequest(request);
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
//# sourceMappingURL=apply-tag-to-subscriber.action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply-tag-to-subscriber.action.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/drip/src/lib/actions/apply-tag-to-subscriber.action.ts"],"names":[],"mappings":";;;;AAAA,uDAAsG;AACtG,sCAAuC;AAE1B,QAAA,wBAAwB,GAAG,IAAA,wBAAY,EAAC;IACjD,IAAI,EAAE,yBAAyB;IAC/B,WAAW,EAAE,6BAA6B;IAC1C,WAAW,EAAE,2BAA2B;IACxC,KAAK,EAAE;QACH,cAAc,EAAE,mBAAU,CAAC,cAAc;QACzC,UAAU,EAAE,mBAAU,CAAC,UAAU;QACjC,UAAU,EAAE,mBAAU,CAAC,UAAU;QACjC,GAAG,EAAE,oBAAQ,CAAC,SAAS,CAAC;YACpB,WAAW,EAAE,KAAK;YAClB,QAAQ,EAAE,IAAI;YACd,WAAW,EAAE,cAAc;SAC9B,CAAC;KACL;IACD,UAAU,EAAE,EAAE;IACR,GAAG,CAAC,OAAO;;YACb,MAAM,OAAO,GAAgB;gBACzB,MAAM,EAAE,sBAAU,CAAC,IAAI;gBACvB,GAAG,EAAE,GAAG,mBAAU,CAAC,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,YAAY,CAAE,CAAC,OAAO;gBACpE,IAAI,EAAE;oBACF,IAAI,EAAE,CAAC;4BACH,KAAK,EAAE,OAAO,CAAC,UAAU,CAAC,YAAY,CAAC;4BACvC,GAAG,EAAE,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC;yBACjC,CAAC;iBAEL;gBACD,OAAO,EAAE;oBACL,eAAe,EAAE,mBAAU,CAAC,mBAAmB,CAAC,OAAO,CAAC,UAAU,CAAC,gBAAgB,CAAE,CAAC;iBACzF;gBACD,WAAW,EAAE,EAAE;aAClB,CAAC;YACF,OAAO,MAAM,sBAAU,CAAC,WAAW,CAAwB,OAAO,CAAC,CAAC;QACxE,CAAC;KAAA;CACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const dripUpsertSubscriberAction: import("@activepieces/framework").Action;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.dripUpsertSubscriberAction = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const framework_1 = require("@activepieces/framework");
|
|
6
|
+
const common_1 = require("../common");
|
|
7
|
+
exports.dripUpsertSubscriberAction = (0, framework_1.createAction)({
|
|
8
|
+
name: 'upsert_subscriber',
|
|
9
|
+
description: 'Create or Update Subscriber',
|
|
10
|
+
displayName: 'Create or Update Subscriber',
|
|
11
|
+
props: {
|
|
12
|
+
authentication: common_1.dripCommon.authentication,
|
|
13
|
+
account_id: common_1.dripCommon.account_id,
|
|
14
|
+
subscriber: common_1.dripCommon.subscriber,
|
|
15
|
+
tags: common_1.dripCommon.tags,
|
|
16
|
+
custom_fields: common_1.dripCommon.custom_fields,
|
|
17
|
+
first_name: framework_1.Property.ShortText({ displayName: "First Name", required: false }),
|
|
18
|
+
last_name: framework_1.Property.ShortText({ displayName: "Last Name", required: false }),
|
|
19
|
+
zip: framework_1.Property.ShortText({ displayName: 'Zip Code', description: "Postal code in which the subscriber resides", required: false }),
|
|
20
|
+
country: framework_1.Property.ShortText({ displayName: 'Country', description: "The country in which the subscriber resides", required: false }),
|
|
21
|
+
state: framework_1.Property.ShortText({ displayName: 'State', description: "The region in which the subscriber resides", required: false }),
|
|
22
|
+
city: framework_1.Property.ShortText({ displayName: 'City', description: "The city in which the subscriber resides", required: false }),
|
|
23
|
+
phone: framework_1.Property.ShortText({ displayName: 'Phone', description: "The subscriber's primary phone number", required: false }),
|
|
24
|
+
address: framework_1.Property.ShortText({ displayName: 'Address', description: "The subscriber's mailing address", required: false }),
|
|
25
|
+
},
|
|
26
|
+
sampleData: {
|
|
27
|
+
"links": {
|
|
28
|
+
"subscribers.account": "https://api.getdrip.com/v2/accounts/{subscribers.account}"
|
|
29
|
+
},
|
|
30
|
+
"subscribers": [
|
|
31
|
+
{
|
|
32
|
+
"id": "1e0ukqg4yzqo1bxyy18f",
|
|
33
|
+
"href": "https://api.getdrip.com/v2/AAAAAAA/subscribers/AAAAAAA",
|
|
34
|
+
"status": "active",
|
|
35
|
+
"email": "yrdd@ggg.com",
|
|
36
|
+
"first_name": "joe",
|
|
37
|
+
"last_name": "doe",
|
|
38
|
+
"address1": "Iraq,Baghdad",
|
|
39
|
+
"address2": "Amman,Jordan",
|
|
40
|
+
"city": "Baghdad",
|
|
41
|
+
"state": "Baghdad",
|
|
42
|
+
"zip": "10011",
|
|
43
|
+
"phone": "079123123123",
|
|
44
|
+
"country": "Iraq",
|
|
45
|
+
"time_zone": "Baghdad GMT+3",
|
|
46
|
+
"utc_offset": 3,
|
|
47
|
+
"visitor_uuid": null,
|
|
48
|
+
"custom_fields": {},
|
|
49
|
+
"tags": [],
|
|
50
|
+
"created_at": "2023-01-30T07:42:12Z",
|
|
51
|
+
"ip_address": "000.000.00",
|
|
52
|
+
"user_agent": "Mozilla Firefox",
|
|
53
|
+
"lifetime_value": null,
|
|
54
|
+
"original_referrer": null,
|
|
55
|
+
"landing_url": null,
|
|
56
|
+
"prospect": false,
|
|
57
|
+
"base_lead_score": null,
|
|
58
|
+
"eu_consent": "unknown",
|
|
59
|
+
"sms_number": "079123123123",
|
|
60
|
+
"sms_consent": false,
|
|
61
|
+
"lead_score": null,
|
|
62
|
+
"user_id": null,
|
|
63
|
+
"links": {
|
|
64
|
+
"account": "00000000"
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
]
|
|
68
|
+
},
|
|
69
|
+
run(context) {
|
|
70
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
71
|
+
const request = {
|
|
72
|
+
method: framework_1.HttpMethod.POST,
|
|
73
|
+
url: `${common_1.dripCommon.baseUrl(context.propsValue["account_id"])}/subscribers`,
|
|
74
|
+
body: {
|
|
75
|
+
subscribers: [{
|
|
76
|
+
email: context.propsValue["subscriber"],
|
|
77
|
+
tags: context.propsValue["tags"],
|
|
78
|
+
custom_fields: context.propsValue["custom_fields"],
|
|
79
|
+
country: context.propsValue["country"],
|
|
80
|
+
address1: context.propsValue["address"],
|
|
81
|
+
city: context.propsValue["city"],
|
|
82
|
+
state: context.propsValue["state"],
|
|
83
|
+
zip: context.propsValue["zip"],
|
|
84
|
+
phone: context.propsValue["phone"],
|
|
85
|
+
first_name: context.propsValue["first_name"],
|
|
86
|
+
last_name: context.propsValue["last_name"]
|
|
87
|
+
}]
|
|
88
|
+
},
|
|
89
|
+
headers: {
|
|
90
|
+
'Authorization': common_1.dripCommon.authorizationHeader(context.propsValue["authentication"])
|
|
91
|
+
},
|
|
92
|
+
queryParams: {},
|
|
93
|
+
};
|
|
94
|
+
return yield framework_1.httpClient.sendRequest(request);
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
//# sourceMappingURL=upsert-subscriber.action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upsert-subscriber.action.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/drip/src/lib/actions/upsert-subscriber.action.ts"],"names":[],"mappings":";;;;AAAA,uDAAsG;AACtG,sCAAuC;AAE1B,QAAA,0BAA0B,GAAG,IAAA,wBAAY,EAAC;IACnD,IAAI,EAAE,mBAAmB;IACzB,WAAW,EAAE,6BAA6B;IAC1C,WAAW,EAAE,6BAA6B;IAC1C,KAAK,EAAE;QACH,cAAc,EAAE,mBAAU,CAAC,cAAc;QACzC,UAAU,EAAE,mBAAU,CAAC,UAAU;QACjC,UAAU,EAAE,mBAAU,CAAC,UAAU;QACjC,IAAI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,CAAC,UAAU,CAAC,SAAS,CAAC;4BACtC,QAAQ,EAAE,OAAO,CAAC,UAAU,CAAC,SAAS,CAAC;4BACvC,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC;4BAChC,KAAK,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC;4BAClC,GAAG,EAAE,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC;4BAC9B,KAAK,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC;4BAClC,UAAU,EAAE,OAAO,CAAC,UAAU,CAAC,YAAY,CAAC;4BAC5C,SAAS,EAAE,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC;yBAC7C,CAAC;iBAEL;gBACD,OAAO,EAAE;oBACL,eAAe,EAAE,mBAAU,CAAC,mBAAmB,CAAC,OAAO,CAAC,UAAU,CAAC,gBAAgB,CAAE,CAAC;iBACzF;gBACD,WAAW,EAAE,EAAE;aAClB,CAAC;YACF,OAAO,MAAM,sBAAU,CAAC,WAAW,CAAwB,OAAO,CAAC,CAAC;QACxE,CAAC;KAAA;CACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const dripCommon: {
|
|
2
|
+
baseUrl: (accountId: string) => string;
|
|
3
|
+
authentication: import("@activepieces/framework").SecretTextProperty<true>;
|
|
4
|
+
account_id: import("@activepieces/framework").DropdownProperty<string, true>;
|
|
5
|
+
subscriber: import("@activepieces/framework").ShortTextProperty<true>;
|
|
6
|
+
tags: import("@activepieces/framework").ArrayProperty<false>;
|
|
7
|
+
custom_fields: import("@activepieces/framework").ObjectProperty<false>;
|
|
8
|
+
authorizationHeader: (apiKey: string) => string;
|
|
9
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.dripCommon = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const framework_1 = require("@activepieces/framework");
|
|
6
|
+
exports.dripCommon = {
|
|
7
|
+
baseUrl: (accountId) => { return `https://api.getdrip.com/v2/${accountId}`; },
|
|
8
|
+
authentication: framework_1.Property.SecretText({
|
|
9
|
+
displayName: "API Key",
|
|
10
|
+
required: true,
|
|
11
|
+
description: "Get it from https://www.getdrip.com/user/edit"
|
|
12
|
+
}),
|
|
13
|
+
account_id: framework_1.Property.Dropdown({
|
|
14
|
+
displayName: 'Account',
|
|
15
|
+
required: true,
|
|
16
|
+
refreshers: ["authentication"],
|
|
17
|
+
options: (props) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
18
|
+
if (!props['authentication']) {
|
|
19
|
+
return {
|
|
20
|
+
disabled: true,
|
|
21
|
+
options: [],
|
|
22
|
+
placeholder: "Please fill in API key first"
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
const request = {
|
|
26
|
+
method: framework_1.HttpMethod.GET,
|
|
27
|
+
url: "https://api.getdrip.com/v2/accounts",
|
|
28
|
+
headers: {
|
|
29
|
+
Authorization: `Basic ${Buffer.from(props["authentication"]).toString("base64")}`,
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
const response = yield framework_1.httpClient.sendRequest(request);
|
|
33
|
+
const opts = response.body.accounts.map((acc) => {
|
|
34
|
+
return { value: acc.id, label: acc.name };
|
|
35
|
+
});
|
|
36
|
+
return {
|
|
37
|
+
disabled: false,
|
|
38
|
+
options: opts,
|
|
39
|
+
};
|
|
40
|
+
})
|
|
41
|
+
}),
|
|
42
|
+
subscriber: framework_1.Property.ShortText({ required: true, displayName: "Subscriber Email", description: "Email of the subscriber" }),
|
|
43
|
+
tags: framework_1.Property.Array({
|
|
44
|
+
displayName: "tags",
|
|
45
|
+
required: false,
|
|
46
|
+
description: "Tags to apply to subscriber"
|
|
47
|
+
}),
|
|
48
|
+
custom_fields: framework_1.Property.Object({
|
|
49
|
+
displayName: "Custom Fields",
|
|
50
|
+
required: false,
|
|
51
|
+
description: "Custom field data about the subscriber"
|
|
52
|
+
}),
|
|
53
|
+
authorizationHeader: (apiKey) => `Basic ${Buffer.from(apiKey).toString('base64')}`
|
|
54
|
+
};
|
|
55
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/drip/src/lib/common/index.ts"],"names":[],"mappings":";;;;AAAA,uDAAwF;AAE3E,QAAA,UAAU,GAAG;IACtB,OAAO,EAAE,CAAC,SAAiB,EAAE,EAAE,GAAG,OAAO,8BAA8B,SAAS,EAAE,CAAA,CAAC,CAAC;IACpF,cAAc,EAAE,oBAAQ,CAAC,UAAU,CAAC;QAChC,WAAW,EAAE,SAAS;QACtB,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,+CAA+C;KAC/D,CAAC;IACF,UAAU,EAAE,oBAAQ,CAAC,QAAQ,CAAC;QAC1B,WAAW,EAAE,SAAS;QACtB,QAAQ,EAAE,IAAI;QACd,UAAU,EAAE,CAAC,gBAAgB,CAAC;QAC9B,OAAO,EAAE,CAAO,KAAK,EAAE,EAAE;YACrB,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,EAAE;gBAC1B,OAAO;oBACH,QAAQ,EAAE,IAAI;oBACd,OAAO,EAAE,EAAE;oBACX,WAAW,EAAE,8BAA8B;iBAC9C,CAAA;aACJ;YAED,MAAM,OAAO,GAAgB;gBACzB,MAAM,EAAE,sBAAU,CAAC,GAAG;gBACtB,GAAG,EAAE,qCAAqC;gBAC1C,OAAO,EAAE;oBACL,aAAa,EAAE,SAAS,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAW,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE;iBAC9F;aACJ,CAAC;YACF,MAAM,QAAQ,GAAG,MAAM,sBAAU,CAAC,WAAW,CAA+C,OAAO,CAAC,CAAC;YACrG,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;gBAC5C,OAAO,EAAE,KAAK,EAAE,GAAG,CAAC,EAAE,EAAE,KAAK,EAAE,GAAG,CAAC,IAAI,EAAE,CAAC;YAC9C,CAAC,CAAC,CAAC;YACH,OAAO;gBACH,QAAQ,EAAE,KAAK;gBACf,OAAO,EAAE,IAAI;aAChB,CAAA;QACL,CAAC,CAAA;KAEJ,CAAC;IACF,UAAU,EAAE,oBAAQ,CAAC,SAAS,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,kBAAkB,EAAE,WAAW,EAAE,yBAAyB,EAAE,CAAC;IAC3H,IAAI,EAAE,oBAAQ,CAAC,KAAK,CAAC;QACjB,WAAW,EAAE,MAAM;QACnB,QAAQ,EAAE,KAAK;QACf,WAAW,EAAE,6BAA6B;KAC7C,CAAC;IACF,aAAa,EAAE,oBAAQ,CAAC,MAAM,CAAC;QAC3B,WAAW,EAAE,eAAe;QAC5B,QAAQ,EAAE,KAAK;QACf,WAAW,EAAE,wCAAwC;KACxD,CAAC;IACF,mBAAmB,EAAE,CAAC,MAAc,EAAE,EAAE,CAAC,SAAS,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE;CAE7F,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const dripNewSubscriberEvent: import("@activepieces/framework").Trigger;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.dripNewSubscriberEvent = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const framework_1 = require("@activepieces/framework");
|
|
6
|
+
const common_1 = require("../common");
|
|
7
|
+
const triggerNameInStore = 'drip_new_subscriber_trigger';
|
|
8
|
+
exports.dripNewSubscriberEvent = (0, framework_1.createTrigger)({
|
|
9
|
+
name: 'new_subscriber',
|
|
10
|
+
displayName: 'New Subscriber',
|
|
11
|
+
description: 'Triggers when a subscriber is created in your Drip account.',
|
|
12
|
+
props: {
|
|
13
|
+
authentication: common_1.dripCommon.authentication,
|
|
14
|
+
account_id: common_1.dripCommon.account_id
|
|
15
|
+
},
|
|
16
|
+
sampleData: {
|
|
17
|
+
"event": "subscriber.created",
|
|
18
|
+
"data": {
|
|
19
|
+
"account_id": "9999999",
|
|
20
|
+
"subscriber": {}
|
|
21
|
+
},
|
|
22
|
+
"occurred_at": "2013-06-21T10:31:58Z"
|
|
23
|
+
},
|
|
24
|
+
type: framework_1.TriggerStrategy.WEBHOOK,
|
|
25
|
+
onEnable(context) {
|
|
26
|
+
var _a;
|
|
27
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
28
|
+
const request = {
|
|
29
|
+
method: framework_1.HttpMethod.POST,
|
|
30
|
+
url: `${common_1.dripCommon.baseUrl(context.propsValue["account_id"])}/webhooks`,
|
|
31
|
+
body: {
|
|
32
|
+
webhooks: [{ post_url: context.webhookUrl, events: ["subscriber.created"] }],
|
|
33
|
+
},
|
|
34
|
+
headers: {
|
|
35
|
+
'Authorization': common_1.dripCommon.authorizationHeader(context.propsValue["authentication"])
|
|
36
|
+
},
|
|
37
|
+
queryParams: {},
|
|
38
|
+
};
|
|
39
|
+
const { body } = yield framework_1.httpClient.sendRequest(request);
|
|
40
|
+
yield ((_a = context.store) === null || _a === void 0 ? void 0 : _a.put(triggerNameInStore, {
|
|
41
|
+
webhookId: body.webhooks[0].id,
|
|
42
|
+
userId: context.propsValue["account_id"]
|
|
43
|
+
}));
|
|
44
|
+
});
|
|
45
|
+
},
|
|
46
|
+
onDisable(context) {
|
|
47
|
+
var _a;
|
|
48
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
49
|
+
const response = yield ((_a = context.store) === null || _a === void 0 ? void 0 : _a.get(triggerNameInStore));
|
|
50
|
+
if (response !== null && response !== undefined) {
|
|
51
|
+
const request = {
|
|
52
|
+
method: framework_1.HttpMethod.DELETE,
|
|
53
|
+
url: `${common_1.dripCommon.baseUrl(response.userId)}/webhooks/${response.webhookId}`,
|
|
54
|
+
headers: {
|
|
55
|
+
'Authorization': common_1.dripCommon.authorizationHeader(context.propsValue["authentication"])
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
yield framework_1.httpClient.sendRequest(request);
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
},
|
|
62
|
+
run(context) {
|
|
63
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
64
|
+
return [context.payload.body];
|
|
65
|
+
});
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
//# sourceMappingURL=new-subscriber.trigger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"new-subscriber.trigger.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/drip/src/lib/trigger/new-subscriber.trigger.ts"],"names":[],"mappings":";;;;AAAA,uDAA8G;AAC9G,sCAAuC;AAEvC,MAAM,kBAAkB,GAAG,6BAA6B,CAAC;AAC5C,QAAA,sBAAsB,GAAG,IAAA,yBAAa,EAAC;IAClD,IAAI,EAAE,gBAAgB;IACtB,WAAW,EAAE,gBAAgB;IAC7B,WAAW,EAAE,6DAA6D;IAC1E,KAAK,EAAE;QACL,cAAc,EAAE,mBAAU,CAAC,cAAc;QACzC,UAAU,EAAE,mBAAU,CAAC,UAAU;KAClC;IACD,UAAU,EAAE;QACV,OAAO,EAAE,oBAAoB;QAC7B,MAAM,EAAE;YACN,YAAY,EAAE,SAAS;YACvB,YAAY,EAAE,EAAE;SACjB;QACD,aAAa,EAAE,sBAAsB;KACtC;IACD,IAAI,EAAE,2BAAe,CAAC,OAAO;IACvB,QAAQ,CAAC,OAAO;;;YAEpB,MAAM,OAAO,GAAgB;gBAC3B,MAAM,EAAE,sBAAU,CAAC,IAAI;gBACvB,GAAG,EAAE,GAAG,mBAAU,CAAC,OAAO,CAAC,OA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,GAAG,CAAC,OAAO;;YACf,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAChC,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const dripTagAppliedEvent: import("@activepieces/framework").Trigger;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.dripTagAppliedEvent = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const framework_1 = require("@activepieces/framework");
|
|
6
|
+
const common_1 = require("../common");
|
|
7
|
+
const triggerNameInStore = 'drip_tag_applied_to_subscriber_trigger';
|
|
8
|
+
exports.dripTagAppliedEvent = (0, framework_1.createTrigger)({
|
|
9
|
+
name: 'tag_applied_to_subscribers',
|
|
10
|
+
displayName: 'Tag Applied',
|
|
11
|
+
description: 'Triggers when a tag is applied.',
|
|
12
|
+
props: {
|
|
13
|
+
authentication: common_1.dripCommon.authentication,
|
|
14
|
+
account_id: common_1.dripCommon.account_id
|
|
15
|
+
},
|
|
16
|
+
sampleData: {
|
|
17
|
+
"event": "subscriber.applied_tag",
|
|
18
|
+
"data": {
|
|
19
|
+
"account_id": "9999999",
|
|
20
|
+
"subscriber": {},
|
|
21
|
+
"properties": {
|
|
22
|
+
"tag": "Customer"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"occurred_at": "2013-06-21T10:31:58Z"
|
|
26
|
+
},
|
|
27
|
+
type: framework_1.TriggerStrategy.WEBHOOK,
|
|
28
|
+
onEnable(context) {
|
|
29
|
+
var _a;
|
|
30
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
31
|
+
const request = {
|
|
32
|
+
method: framework_1.HttpMethod.POST,
|
|
33
|
+
url: `${common_1.dripCommon.baseUrl(context.propsValue["account_id"])}/webhooks`,
|
|
34
|
+
body: {
|
|
35
|
+
webhooks: [{ post_url: context.webhookUrl, events: ["subscriber.applied_tag"] }],
|
|
36
|
+
},
|
|
37
|
+
headers: {
|
|
38
|
+
'Authorization': common_1.dripCommon.authorizationHeader(context.propsValue["authentication"])
|
|
39
|
+
},
|
|
40
|
+
queryParams: {},
|
|
41
|
+
};
|
|
42
|
+
const { body } = yield framework_1.httpClient.sendRequest(request);
|
|
43
|
+
yield ((_a = context.store) === null || _a === void 0 ? void 0 : _a.put(triggerNameInStore, {
|
|
44
|
+
webhookId: body.webhooks[0].id,
|
|
45
|
+
userId: context.propsValue["account_id"]
|
|
46
|
+
}));
|
|
47
|
+
});
|
|
48
|
+
},
|
|
49
|
+
onDisable(context) {
|
|
50
|
+
var _a;
|
|
51
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
52
|
+
const response = yield ((_a = context.store) === null || _a === void 0 ? void 0 : _a.get(triggerNameInStore));
|
|
53
|
+
if (response !== null && response !== undefined) {
|
|
54
|
+
const request = {
|
|
55
|
+
method: framework_1.HttpMethod.DELETE,
|
|
56
|
+
url: `${common_1.dripCommon.baseUrl(response.userId)}/webhooks/${response.webhookId}`,
|
|
57
|
+
headers: {
|
|
58
|
+
'Authorization': common_1.dripCommon.authorizationHeader(context.propsValue["authentication"])
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
yield framework_1.httpClient.sendRequest(request);
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
},
|
|
65
|
+
run(context) {
|
|
66
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
67
|
+
return [context.payload.body];
|
|
68
|
+
});
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
|
+
//# sourceMappingURL=new-tag.trigger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"new-tag.trigger.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/drip/src/lib/trigger/new-tag.trigger.ts"],"names":[],"mappings":";;;;AAAA,uDAA8G;AAC9G,sCAAuC;AAEvC,M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