@activepieces/piece-getresponse 0.0.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 +17 -0
- package/src/i18n/translation.json +65 -0
- package/src/index.d.ts +6 -0
- package/src/index.d.ts.map +1 -0
- package/src/index.js +42 -0
- package/src/index.js.map +1 -0
- package/src/lib/actions/create-contact.d.ts +12 -0
- package/src/lib/actions/create-contact.d.ts.map +1 -0
- package/src/lib/actions/create-contact.js +42 -0
- package/src/lib/actions/create-contact.js.map +1 -0
- package/src/lib/actions/create-newsletter.d.ts +24 -0
- package/src/lib/actions/create-newsletter.d.ts.map +1 -0
- package/src/lib/actions/create-newsletter.js +74 -0
- package/src/lib/actions/create-newsletter.js.map +1 -0
- package/src/lib/actions/create-or-update-contact.d.ts +12 -0
- package/src/lib/actions/create-or-update-contact.d.ts.map +1 -0
- package/src/lib/actions/create-or-update-contact.js +67 -0
- package/src/lib/actions/create-or-update-contact.js.map +1 -0
- package/src/lib/actions/find-campaign-list.d.ts +7 -0
- package/src/lib/actions/find-campaign-list.d.ts.map +1 -0
- package/src/lib/actions/find-campaign-list.js +34 -0
- package/src/lib/actions/find-campaign-list.js.map +1 -0
- package/src/lib/actions/find-contact.d.ts +11 -0
- package/src/lib/actions/find-contact.d.ts.map +1 -0
- package/src/lib/actions/find-contact.js +42 -0
- package/src/lib/actions/find-contact.js.map +1 -0
- package/src/lib/common/auth.d.ts +14 -0
- package/src/lib/common/auth.d.ts.map +1 -0
- package/src/lib/common/auth.js +47 -0
- package/src/lib/common/auth.js.map +1 -0
- package/src/lib/common/client.d.ts +125 -0
- package/src/lib/common/client.d.ts.map +1 -0
- package/src/lib/common/client.js +199 -0
- package/src/lib/common/client.js.map +1 -0
- package/src/lib/common/props.d.ts +13 -0
- package/src/lib/common/props.d.ts.map +1 -0
- package/src/lib/common/props.js +79 -0
- package/src/lib/common/props.js.map +1 -0
- package/src/lib/common/utils.d.ts +2 -0
- package/src/lib/common/utils.d.ts.map +1 -0
- package/src/lib/common/utils.js +10 -0
- package/src/lib/common/utils.js.map +1 -0
package/package.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@activepieces/piece-getresponse",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"type": "commonjs",
|
|
5
|
+
"main": "./src/index.js",
|
|
6
|
+
"types": "./src/index.d.ts",
|
|
7
|
+
"dependencies": {
|
|
8
|
+
"@activepieces/pieces-common": "0.12.0",
|
|
9
|
+
"@activepieces/pieces-framework": "0.26.0",
|
|
10
|
+
"@activepieces/shared": "0.47.0",
|
|
11
|
+
"tslib": "^2.3.0"
|
|
12
|
+
},
|
|
13
|
+
"scripts": {
|
|
14
|
+
"build": "tsc -p tsconfig.lib.json && cp package.json dist/",
|
|
15
|
+
"lint": "eslint 'src/**/*.ts'"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
{
|
|
2
|
+
"GetResponse": "GetResponse",
|
|
3
|
+
"Email marketing and automation platform for contacts, campaigns, and newsletters.": "Email marketing and automation platform for contacts, campaigns, and newsletters.",
|
|
4
|
+
"API Key": "API Key",
|
|
5
|
+
"To get your API key:\n1. Sign in to your GetResponse account.\n2. Open **Tools > Integrations and API > API**.\n3. Create or copy an API key.\n4. Paste the key here.\n\nThe key will be sent as `X-Auth-Token: api-key <your_key>`.": "To get your API key:\n1. Sign in to your GetResponse account.\n2. Open **Tools > Integrations and API > API**.\n3. Create or copy an API key.\n4. Paste the key here.\n\nThe key will be sent as `X-Auth-Token: api-key <your_key>`.",
|
|
6
|
+
"Create Contact": "Create Contact",
|
|
7
|
+
"Create or Update Contact": "Create or Update Contact",
|
|
8
|
+
"Find Contact": "Find Contact",
|
|
9
|
+
"Create Newsletter": "Create Newsletter",
|
|
10
|
+
"Find Campaign List": "Find Campaign List",
|
|
11
|
+
"Custom API Call": "Custom API Call",
|
|
12
|
+
"Creates a new contact in a GetResponse campaign.": "Creates a new contact in a GetResponse campaign.",
|
|
13
|
+
"Creates a contact or updates the existing contact with the same email in the selected campaign.": "Creates a contact or updates the existing contact with the same email in the selected campaign.",
|
|
14
|
+
"Finds a contact by email address.": "Finds a contact by email address.",
|
|
15
|
+
"Creates a newsletter and queues it to send to the selected campaign.": "Creates a newsletter and queues it to send to the selected campaign.",
|
|
16
|
+
"Finds campaign lists by name.": "Finds campaign lists by name.",
|
|
17
|
+
"Make a custom API call to a specific endpoint": "Make a custom API call to a specific endpoint",
|
|
18
|
+
"Campaign": "Campaign",
|
|
19
|
+
"From Address": "From Address",
|
|
20
|
+
"Reply-to Address": "Reply-to Address",
|
|
21
|
+
"Email Address": "Email Address",
|
|
22
|
+
"Name": "Name",
|
|
23
|
+
"Subject": "Subject",
|
|
24
|
+
"Newsletter Name": "Newsletter Name",
|
|
25
|
+
"HTML Content": "HTML Content",
|
|
26
|
+
"Plain Text Content": "Plain Text Content",
|
|
27
|
+
"Campaign Name": "Campaign Name",
|
|
28
|
+
"Limit": "Limit",
|
|
29
|
+
"Select the campaign list to use.": "Select the campaign list to use.",
|
|
30
|
+
"Select the verified sender address to use.": "Select the verified sender address to use.",
|
|
31
|
+
"The email address of the contact to create.": "The email address of the contact to create.",
|
|
32
|
+
"The contact name as it should appear in GetResponse.": "The contact name as it should appear in GetResponse.",
|
|
33
|
+
"The email address used to find or create the contact.": "The email address used to find or create the contact.",
|
|
34
|
+
"The email address of the contact to find.": "The email address of the contact to find.",
|
|
35
|
+
"The subject line for the newsletter.": "The subject line for the newsletter.",
|
|
36
|
+
"An internal name for the newsletter inside GetResponse. Leave empty to use the subject.": "An internal name for the newsletter inside GetResponse. Leave empty to use the subject.",
|
|
37
|
+
"The newsletter content in HTML format.": "The newsletter content in HTML format.",
|
|
38
|
+
"The plain text version of the newsletter content.": "The plain text version of the newsletter content.",
|
|
39
|
+
"Enter part or all of the campaign list name. Leave empty to return the first lists in the account.": "Enter part or all of the campaign list name. Leave empty to return the first lists in the account.",
|
|
40
|
+
"The maximum number of campaign lists to return.": "The maximum number of campaign lists to return.",
|
|
41
|
+
"Connect your account first": "Connect your account first",
|
|
42
|
+
"No campaigns found. Create one in GetResponse first.": "No campaigns found. Create one in GetResponse first.",
|
|
43
|
+
"No active sender addresses found in GetResponse.": "No active sender addresses found in GetResponse.",
|
|
44
|
+
"Method": "Method",
|
|
45
|
+
"Headers": "Headers",
|
|
46
|
+
"Query Parameters": "Query Parameters",
|
|
47
|
+
"Body Type": "Body Type",
|
|
48
|
+
"Body": "Body",
|
|
49
|
+
"Response is Binary ?": "Response is Binary ?",
|
|
50
|
+
"No Error on Failure": "No Error on Failure",
|
|
51
|
+
"Timeout (in seconds)": "Timeout (in seconds)",
|
|
52
|
+
"Follow redirects": "Follow redirects",
|
|
53
|
+
"Authorization headers are injected automatically from your connection.": "Authorization headers are injected automatically from your connection.",
|
|
54
|
+
"Enable for files like PDFs, images, etc.": "Enable for files like PDFs, images, etc.",
|
|
55
|
+
"GET": "GET",
|
|
56
|
+
"POST": "POST",
|
|
57
|
+
"PATCH": "PATCH",
|
|
58
|
+
"PUT": "PUT",
|
|
59
|
+
"DELETE": "DELETE",
|
|
60
|
+
"HEAD": "HEAD",
|
|
61
|
+
"None": "None",
|
|
62
|
+
"JSON": "JSON",
|
|
63
|
+
"Form Data": "Form Data",
|
|
64
|
+
"Raw": "Raw"
|
|
65
|
+
}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { getresponseAuth } from './lib/common/auth';
|
|
2
|
+
export declare const getresponse: import("@activepieces/pieces-framework").Piece<(import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
3
|
+
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
4
|
+
}>)[]>;
|
|
5
|
+
export { getresponseAuth };
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,eAAO,MAAM,WAAW;;MA2BtB,CAAC;AAEH,OAAO,EAAE,eAAe,EAAE,CAAC"}
|
package/src/index.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getresponseAuth = exports.getresponse = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
6
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
7
|
+
const shared_1 = require("@activepieces/shared");
|
|
8
|
+
const create_contact_1 = require("./lib/actions/create-contact");
|
|
9
|
+
const create_newsletter_1 = require("./lib/actions/create-newsletter");
|
|
10
|
+
const create_or_update_contact_1 = require("./lib/actions/create-or-update-contact");
|
|
11
|
+
const find_campaign_list_1 = require("./lib/actions/find-campaign-list");
|
|
12
|
+
const find_contact_1 = require("./lib/actions/find-contact");
|
|
13
|
+
const auth_1 = require("./lib/common/auth");
|
|
14
|
+
Object.defineProperty(exports, "getresponseAuth", { enumerable: true, get: function () { return auth_1.getresponseAuth; } });
|
|
15
|
+
exports.getresponse = (0, pieces_framework_1.createPiece)({
|
|
16
|
+
displayName: 'GetResponse',
|
|
17
|
+
description: 'Email marketing and automation platform for contacts, campaigns, and newsletters.',
|
|
18
|
+
minimumSupportedRelease: '0.36.1',
|
|
19
|
+
logoUrl: 'https://us-ws.gr-cdn.com/images/global/getresponse.png',
|
|
20
|
+
categories: [shared_1.PieceCategory.MARKETING],
|
|
21
|
+
authors: ['veri5ied'],
|
|
22
|
+
auth: auth_1.getresponseAuth,
|
|
23
|
+
actions: [
|
|
24
|
+
create_contact_1.createContactAction,
|
|
25
|
+
create_or_update_contact_1.createOrUpdateContactAction,
|
|
26
|
+
find_contact_1.findContactAction,
|
|
27
|
+
create_newsletter_1.createNewsletterAction,
|
|
28
|
+
find_campaign_list_1.findCampaignListAction,
|
|
29
|
+
(0, pieces_common_1.createCustomApiCallAction)({
|
|
30
|
+
auth: auth_1.getresponseAuth,
|
|
31
|
+
baseUrl: () => 'https://api.getresponse.com/v3',
|
|
32
|
+
authMapping: (auth) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
33
|
+
if (auth.type === shared_1.AppConnectionType.OAUTH2) {
|
|
34
|
+
return { Authorization: `Bearer ${auth.access_token}` };
|
|
35
|
+
}
|
|
36
|
+
return { 'X-Auth-Token': `api-key ${auth.props.apiKey}` };
|
|
37
|
+
}),
|
|
38
|
+
}),
|
|
39
|
+
],
|
|
40
|
+
triggers: [],
|
|
41
|
+
});
|
|
42
|
+
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;AAAA,+DAAwE;AACxE,qEAA6D;AAC7D,iDAAwE;AAExE,iEAAmE;AACnE,uEAAyE;AACzE,qFAAqF;AACrF,yEAA0E;AAC1E,6DAA+D;AAC/D,4CAAoD;AA+B3C,gGA/BA,sBAAe,OA+BA;AA7BX,QAAA,WAAW,GAAG,IAAA,8BAAW,EAAC;IACrC,WAAW,EAAE,aAAa;IAC1B,WAAW,EACT,mFAAmF;IACrF,uBAAuB,EAAE,QAAQ;IACjC,OAAO,EAAE,wDAAwD;IACjE,UAAU,EAAE,CAAC,sBAAa,CAAC,SAAS,CAAC;IACrC,OAAO,EAAE,CAAC,UAAU,CAAC;IACrB,IAAI,EAAE,sBAAe;IACrB,OAAO,EAAE;QACP,oCAAmB;QACnB,sDAA2B;QAC3B,gCAAiB;QACjB,0CAAsB;QACtB,2CAAsB;QACtB,IAAA,yCAAyB,EAAC;YACxB,IAAI,EAAE,sBAAe;YACrB,OAAO,EAAE,GAAG,EAAE,CAAC,gCAAgC;YAC/C,WAAW,EAAE,CAAO,IAAI,EAAE,EAAE;gBAC1B,IAAI,IAAI,CAAC,IAAI,KAAK,0BAAiB,CAAC,MAAM,EAAE,CAAC;oBAC3C,OAAO,EAAE,aAAa,EAAE,UAAU,IAAI,CAAC,YAAY,EAAE,EAAE,CAAC;gBAC1D,CAAC;gBACD,OAAO,EAAE,cAAc,EAAE,WAAW,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC;YAC5D,CAAC,CAAA;SACF,CAAC;KACH;IACD,QAAQ,EAAE,EAAE;CACb,CAAC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const createContactAction: import("@activepieces/pieces-framework").IAction<(import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
3
|
+
}>)[], {
|
|
4
|
+
campaignId: import("@activepieces/pieces-framework").DropdownProperty<string, false, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
5
|
+
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
6
|
+
}>)[]> | import("@activepieces/pieces-framework").DropdownProperty<string, true, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
7
|
+
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
8
|
+
}>)[]>;
|
|
9
|
+
email: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
10
|
+
name: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
11
|
+
}>;
|
|
12
|
+
//# sourceMappingURL=create-contact.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-contact.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/create-contact.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,mBAAmB;;;;;;;;;;EAsC9B,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createContactAction = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const auth_1 = require("../common/auth");
|
|
7
|
+
const client_1 = require("../common/client");
|
|
8
|
+
const props_1 = require("../common/props");
|
|
9
|
+
const utils_1 = require("../common/utils");
|
|
10
|
+
exports.createContactAction = (0, pieces_framework_1.createAction)({
|
|
11
|
+
auth: auth_1.getresponseAuth,
|
|
12
|
+
name: 'create-contact',
|
|
13
|
+
displayName: 'Create Contact',
|
|
14
|
+
description: 'Creates a new contact in a GetResponse campaign.',
|
|
15
|
+
props: {
|
|
16
|
+
campaignId: props_1.getresponseProps.campaign(),
|
|
17
|
+
email: pieces_framework_1.Property.ShortText({
|
|
18
|
+
displayName: 'Email Address',
|
|
19
|
+
description: 'The email address of the contact to create.',
|
|
20
|
+
required: true,
|
|
21
|
+
}),
|
|
22
|
+
name: pieces_framework_1.Property.ShortText({
|
|
23
|
+
displayName: 'Name',
|
|
24
|
+
description: 'The contact name as it should appear in GetResponse.',
|
|
25
|
+
required: false,
|
|
26
|
+
}),
|
|
27
|
+
},
|
|
28
|
+
run(context) {
|
|
29
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
const campaignId = (0, utils_1.requireString)(context.propsValue.campaignId, 'Campaign');
|
|
31
|
+
const email = (0, utils_1.requireString)(context.propsValue.email, 'Email Address');
|
|
32
|
+
const contact = yield (0, client_1.createGetResponseContact)({
|
|
33
|
+
auth: context.auth,
|
|
34
|
+
request: Object.assign({ email, campaign: {
|
|
35
|
+
campaignId,
|
|
36
|
+
} }, (context.propsValue.name ? { name: context.propsValue.name } : {})),
|
|
37
|
+
});
|
|
38
|
+
return (0, client_1.flattenGetResponseContact)(contact);
|
|
39
|
+
});
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
//# sourceMappingURL=create-contact.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-contact.js","sourceRoot":"","sources":["../../../../src/lib/actions/create-contact.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AAExE,yCAAiD;AACjD,6CAG0B;AAC1B,2CAAmD;AACnD,2CAAgD;AAEnC,QAAA,mBAAmB,GAAG,IAAA,+BAAY,EAAC;IAC9C,IAAI,EAAE,sBAAe;IACrB,IAAI,EAAE,gBAAgB;IACtB,WAAW,EAAE,gBAAgB;IAC7B,WAAW,EAAE,kDAAkD;IAC/D,KAAK,EAAE;QACL,UAAU,EAAE,wBAAgB,CAAC,QAAQ,EAAE;QACvC,KAAK,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACxB,WAAW,EAAE,eAAe;YAC5B,WAAW,EAAE,6CAA6C;YAC1D,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,IAAI,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACvB,WAAW,EAAE,MAAM;YACnB,WAAW,EAAE,sDAAsD;YACnE,QAAQ,EAAE,KAAK;SAChB,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,UAAU,GAAG,IAAA,qBAAa,EAC9B,OAAO,CAAC,UAAU,CAAC,UAAU,EAC7B,UAAU,CACX,CAAC;YACF,MAAM,KAAK,GAAG,IAAA,qBAAa,EAAC,OAAO,CAAC,UAAU,CAAC,KAAK,EAAE,eAAe,CAAC,CAAC;YAEvE,MAAM,OAAO,GAAG,MAAM,IAAA,iCAAwB,EAAC;gBAC7C,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,OAAO,kBACL,KAAK,EACL,QAAQ,EAAE;wBACR,UAAU;qBACX,IACE,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CACtE;aACF,CAAC,CAAC;YAEH,OAAO,IAAA,kCAAyB,EAAC,OAAO,CAAC,CAAC;QAC5C,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare const createNewsletterAction: import("@activepieces/pieces-framework").IAction<(import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
3
|
+
}>)[], {
|
|
4
|
+
campaignId: import("@activepieces/pieces-framework").DropdownProperty<string, false, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
5
|
+
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
6
|
+
}>)[]> | import("@activepieces/pieces-framework").DropdownProperty<string, true, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
7
|
+
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
8
|
+
}>)[]>;
|
|
9
|
+
fromFieldId: import("@activepieces/pieces-framework").DropdownProperty<string, false, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
10
|
+
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
11
|
+
}>)[]> | import("@activepieces/pieces-framework").DropdownProperty<string, true, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
12
|
+
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
13
|
+
}>)[]>;
|
|
14
|
+
replyToFieldId: import("@activepieces/pieces-framework").DropdownProperty<string, false, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
15
|
+
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
16
|
+
}>)[]> | import("@activepieces/pieces-framework").DropdownProperty<string, true, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
17
|
+
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
18
|
+
}>)[]>;
|
|
19
|
+
subject: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
20
|
+
name: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
21
|
+
htmlContent: import("@activepieces/pieces-framework").LongTextProperty<false>;
|
|
22
|
+
plainContent: import("@activepieces/pieces-framework").LongTextProperty<false>;
|
|
23
|
+
}>;
|
|
24
|
+
//# sourceMappingURL=create-newsletter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-newsletter.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/create-newsletter.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;EAoFjC,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createNewsletterAction = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const auth_1 = require("../common/auth");
|
|
7
|
+
const client_1 = require("../common/client");
|
|
8
|
+
const props_1 = require("../common/props");
|
|
9
|
+
const utils_1 = require("../common/utils");
|
|
10
|
+
exports.createNewsletterAction = (0, pieces_framework_1.createAction)({
|
|
11
|
+
auth: auth_1.getresponseAuth,
|
|
12
|
+
name: 'create-newsletter',
|
|
13
|
+
displayName: 'Create Newsletter',
|
|
14
|
+
description: 'Creates a newsletter and queues it to send to the selected campaign.',
|
|
15
|
+
props: {
|
|
16
|
+
campaignId: props_1.getresponseProps.campaign(),
|
|
17
|
+
fromFieldId: props_1.getresponseProps.fromField(),
|
|
18
|
+
replyToFieldId: props_1.getresponseProps.fromField(false, 'Reply-to Address'),
|
|
19
|
+
subject: pieces_framework_1.Property.ShortText({
|
|
20
|
+
displayName: 'Subject',
|
|
21
|
+
description: 'The subject line for the newsletter.',
|
|
22
|
+
required: true,
|
|
23
|
+
}),
|
|
24
|
+
name: pieces_framework_1.Property.ShortText({
|
|
25
|
+
displayName: 'Newsletter Name',
|
|
26
|
+
description: 'An internal name for the newsletter inside GetResponse. Leave empty to use the subject.',
|
|
27
|
+
required: false,
|
|
28
|
+
}),
|
|
29
|
+
htmlContent: pieces_framework_1.Property.LongText({
|
|
30
|
+
displayName: 'HTML Content',
|
|
31
|
+
description: 'The newsletter content in HTML format.',
|
|
32
|
+
required: false,
|
|
33
|
+
}),
|
|
34
|
+
plainContent: pieces_framework_1.Property.LongText({
|
|
35
|
+
displayName: 'Plain Text Content',
|
|
36
|
+
description: 'The plain text version of the newsletter content.',
|
|
37
|
+
required: false,
|
|
38
|
+
}),
|
|
39
|
+
},
|
|
40
|
+
run(context) {
|
|
41
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
42
|
+
const campaignId = (0, utils_1.requireString)(context.propsValue.campaignId, 'Campaign');
|
|
43
|
+
const fromFieldId = (0, utils_1.requireString)(context.propsValue.fromFieldId, 'From Address');
|
|
44
|
+
const subject = (0, utils_1.requireString)(context.propsValue.subject, 'Subject');
|
|
45
|
+
if (!context.propsValue.htmlContent && !context.propsValue.plainContent) {
|
|
46
|
+
throw new Error('Provide HTML Content, Plain Text Content, or both before creating the newsletter.');
|
|
47
|
+
}
|
|
48
|
+
const newsletter = yield (0, client_1.createGetResponseNewsletter)({
|
|
49
|
+
auth: context.auth,
|
|
50
|
+
request: Object.assign(Object.assign({ subject, fromField: {
|
|
51
|
+
fromFieldId,
|
|
52
|
+
}, campaign: {
|
|
53
|
+
campaignId,
|
|
54
|
+
}, content: Object.assign(Object.assign({}, (context.propsValue.htmlContent
|
|
55
|
+
? { html: context.propsValue.htmlContent }
|
|
56
|
+
: {})), (context.propsValue.plainContent
|
|
57
|
+
? { plain: context.propsValue.plainContent }
|
|
58
|
+
: {})), sendSettings: {
|
|
59
|
+
selectedCampaigns: [campaignId],
|
|
60
|
+
} }, (context.propsValue.name
|
|
61
|
+
? { name: context.propsValue.name }
|
|
62
|
+
: {})), (context.propsValue.replyToFieldId
|
|
63
|
+
? {
|
|
64
|
+
replyTo: {
|
|
65
|
+
fromFieldId: context.propsValue.replyToFieldId,
|
|
66
|
+
},
|
|
67
|
+
}
|
|
68
|
+
: {})),
|
|
69
|
+
});
|
|
70
|
+
return (0, client_1.flattenGetResponseNewsletter)(newsletter);
|
|
71
|
+
});
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
//# sourceMappingURL=create-newsletter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-newsletter.js","sourceRoot":"","sources":["../../../../src/lib/actions/create-newsletter.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AAExE,yCAAiD;AACjD,6CAG0B;AAC1B,2CAAmD;AACnD,2CAAgD;AAEnC,QAAA,sBAAsB,GAAG,IAAA,+BAAY,EAAC;IACjD,IAAI,EAAE,sBAAe;IACrB,IAAI,EAAE,mBAAmB;IACzB,WAAW,EAAE,mBAAmB;IAChC,WAAW,EAAE,sEAAsE;IACnF,KAAK,EAAE;QACL,UAAU,EAAE,wBAAgB,CAAC,QAAQ,EAAE;QACvC,WAAW,E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AAO,EACP,SAAS,EAAE;wBACT,WAAW;qBACZ,EACD,QAAQ,EAAE;wBACR,UAAU;qBACX,EACD,OAAO,kCACF,CAAC,OAAO,CAAC,UAAU,CAAC,WAAW;wBAChC,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC,WAAW,EAAE;wBAC1C,CAAC,CAAC,EAAE,CAAC,GACJ,CAAC,OAAO,CAAC,UAAU,CAAC,YAAY;wBACjC,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,UAAU,CAAC,YAAY,EAAE;wBAC5C,CAAC,CAAC,EAAE,CAAC,GAET,YAAY,EAAE;wBACZ,iBAAiB,EAAE,CAAC,UAAU,CAAC;qBAChC,IACE,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI;oBACzB,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC,IAAI,EAAE;oBACnC,CAAC,CAAC,EAAE,CAAC,GACJ,CAAC,OAAO,CAAC,UAAU,CAAC,cAAc;oBACnC,CAAC,CAAC;wBACE,OAAO,EAAE;4BACP,WAAW,EAAE,OAAO,CAAC,UAAU,CAAC,cAAc;yBAC/C;qBACF;oBACH,CAAC,CAAC,EAAE,CAAC,CACR;aACF,CAAC,CAAC;YAEH,OAAO,IAAA,qCAA4B,EAAC,UAAU,CAAC,CAAC;QAClD,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const createOrUpdateContactAction: import("@activepieces/pieces-framework").IAction<(import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
3
|
+
}>)[], {
|
|
4
|
+
campaignId: import("@activepieces/pieces-framework").DropdownProperty<string, false, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
5
|
+
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
6
|
+
}>)[]> | import("@activepieces/pieces-framework").DropdownProperty<string, true, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
7
|
+
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
8
|
+
}>)[]>;
|
|
9
|
+
email: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
10
|
+
name: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
11
|
+
}>;
|
|
12
|
+
//# sourceMappingURL=create-or-update-contact.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-or-update-contact.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/create-or-update-contact.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,2BAA2B;;;;;;;;;;EAmEtC,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createOrUpdateContactAction = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const auth_1 = require("../common/auth");
|
|
7
|
+
const client_1 = require("../common/client");
|
|
8
|
+
const props_1 = require("../common/props");
|
|
9
|
+
const utils_1 = require("../common/utils");
|
|
10
|
+
exports.createOrUpdateContactAction = (0, pieces_framework_1.createAction)({
|
|
11
|
+
auth: auth_1.getresponseAuth,
|
|
12
|
+
name: 'create-or-update-contact',
|
|
13
|
+
displayName: 'Create or Update Contact',
|
|
14
|
+
description: 'Creates a contact or updates the existing contact with the same email in the selected campaign.',
|
|
15
|
+
props: {
|
|
16
|
+
campaignId: props_1.getresponseProps.campaign(),
|
|
17
|
+
email: pieces_framework_1.Property.ShortText({
|
|
18
|
+
displayName: 'Email Address',
|
|
19
|
+
description: 'The email address used to find or create the contact.',
|
|
20
|
+
required: true,
|
|
21
|
+
}),
|
|
22
|
+
name: pieces_framework_1.Property.ShortText({
|
|
23
|
+
displayName: 'Name',
|
|
24
|
+
description: 'The contact name as it should appear in GetResponse.',
|
|
25
|
+
required: false,
|
|
26
|
+
}),
|
|
27
|
+
},
|
|
28
|
+
run(context) {
|
|
29
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
const campaignId = (0, utils_1.requireString)(context.propsValue.campaignId, 'Campaign');
|
|
31
|
+
const email = (0, utils_1.requireString)(context.propsValue.email, 'Email Address');
|
|
32
|
+
const existingContact = yield findExactContact({
|
|
33
|
+
auth: context.auth,
|
|
34
|
+
email,
|
|
35
|
+
campaignId,
|
|
36
|
+
});
|
|
37
|
+
if (!existingContact) {
|
|
38
|
+
const createdContact = yield (0, client_1.createGetResponseContact)({
|
|
39
|
+
auth: context.auth,
|
|
40
|
+
request: Object.assign({ email, campaign: {
|
|
41
|
+
campaignId,
|
|
42
|
+
} }, (context.propsValue.name ? { name: context.propsValue.name } : {})),
|
|
43
|
+
});
|
|
44
|
+
return Object.assign({ operation: 'created' }, (0, client_1.flattenGetResponseContact)(createdContact));
|
|
45
|
+
}
|
|
46
|
+
const updatedContact = yield (0, client_1.updateGetResponseContact)({
|
|
47
|
+
auth: context.auth,
|
|
48
|
+
contactId: existingContact.contactId,
|
|
49
|
+
request: Object.assign({ email, campaign: {
|
|
50
|
+
campaignId,
|
|
51
|
+
} }, (context.propsValue.name ? { name: context.propsValue.name } : {})),
|
|
52
|
+
});
|
|
53
|
+
return Object.assign({ operation: 'updated' }, (0, client_1.flattenGetResponseContact)(updatedContact));
|
|
54
|
+
});
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
function findExactContact(_a) {
|
|
58
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, email, campaignId, }) {
|
|
59
|
+
const contacts = yield (0, client_1.listGetResponseContacts)({
|
|
60
|
+
auth,
|
|
61
|
+
email,
|
|
62
|
+
campaignId,
|
|
63
|
+
});
|
|
64
|
+
return contacts.find((contact) => contact.email.toLowerCase() === email.toLowerCase());
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=create-or-update-contact.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-or-update-contact.js","sourceRoot":"","sources":["../../../../src/lib/actions/create-or-update-contact.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AAExE,yCAAuE;AACvE,6CAK0B;AAC1B,2CAAmD;AACnD,2CAAgD;AAEnC,QAAA,2BAA2B,GAAG,IAAA,+BAAY,EAAC;IACtD,IAAI,EAAE,sBAAe;IACrB,IAAI,EAAE,0BAA0B;IAChC,WAAW,EAAE,0BAA0B;IACvC,WAAW,EACT,iGAAiG;IACnG,KAAK,EAAE;QACL,UAAU,EAAE,wBAAgB,CAAC,QAAQ,EAAE;QACvC,KAAK,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACxB,WAAW,EAAE,eAAe;YAC5B,WAAW,EAAE,uDAAuD;YACpE,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,IAAI,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACvB,WAAW,EAAE,MAAM;YACnB,WAAW,EAAE,sDAAsD;YACnE,QAAQ,EAAE,KAAK;SAChB,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,UAAU,GAAG,IAAA,qBAAa,EAC9B,OAAO,CAAC,UAAU,CAAC,UAAU,EAC7B,UAAU,CACX,CAAC;YACF,MAAM,KAAK,GAAG,IAAA,qBAAa,EAAC,OAAO,CAAC,UAAU,CAAC,KAAK,EAAE,eAAe,CAAC,CAAC;YAEvE,MAAM,eAAe,GAAG,MAAM,gBAAgB,CAAC;gBAC7C,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,KAAK;gBACL,UAAU;aACX,CAAC,C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,CAAC;CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const findCampaignListAction: import("@activepieces/pieces-framework").IAction<(import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
3
|
+
}>)[], {
|
|
4
|
+
name: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
5
|
+
limit: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
6
|
+
}>;
|
|
7
|
+
//# sourceMappingURL=find-campaign-list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find-campaign-list.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/find-campaign-list.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,sBAAsB;;;;;EA4BjC,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.findCampaignListAction = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const auth_1 = require("../common/auth");
|
|
7
|
+
const client_1 = require("../common/client");
|
|
8
|
+
exports.findCampaignListAction = (0, pieces_framework_1.createAction)({
|
|
9
|
+
auth: auth_1.getresponseAuth,
|
|
10
|
+
name: 'find-campaign-list',
|
|
11
|
+
displayName: 'Find Campaign List',
|
|
12
|
+
description: 'Finds campaign lists by name.',
|
|
13
|
+
props: {
|
|
14
|
+
name: pieces_framework_1.Property.ShortText({
|
|
15
|
+
displayName: 'Campaign Name',
|
|
16
|
+
description: 'Enter part or all of the campaign list name. Leave empty to return the first lists in the account.',
|
|
17
|
+
required: false,
|
|
18
|
+
}),
|
|
19
|
+
limit: pieces_framework_1.Property.Number({
|
|
20
|
+
displayName: 'Limit',
|
|
21
|
+
description: 'The maximum number of campaign lists to return.',
|
|
22
|
+
required: false,
|
|
23
|
+
defaultValue: 100,
|
|
24
|
+
}),
|
|
25
|
+
},
|
|
26
|
+
run(context) {
|
|
27
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
28
|
+
var _a;
|
|
29
|
+
const campaigns = yield (0, client_1.listGetResponseCampaigns)(Object.assign({ auth: context.auth, limit: (_a = context.propsValue.limit) !== null && _a !== void 0 ? _a : 100 }, (context.propsValue.name ? { name: context.propsValue.name } : {})));
|
|
30
|
+
return campaigns.map(client_1.flattenGetResponseCampaign);
|
|
31
|
+
});
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
//# sourceMappingURL=find-campaign-list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find-campaign-list.js","sourceRoot":"","sources":["../../../../src/lib/actions/find-campaign-list.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AAExE,yCAAiD;AACjD,6CAG0B;AAEb,QAAA,sBAAsB,GAAG,IAAA,+BAAY,EAAC;IACjD,IAAI,EAAE,sBAAe;IACrB,IAAI,EAAE,oBAAoB;IAC1B,WAAW,EAAE,oBAAoB;IACjC,WAAW,EAAE,+BAA+B;IAC5C,KAAK,EAAE;QACL,IAAI,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACvB,WAAW,EAAE,eAAe;YAC5B,WAAW,EACT,oGAAoG;YACtG,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,KAAK,EAAE,2BAAQ,CAAC,MAAM,CAAC;YACrB,WAAW,EAAE,OAAO;YACpB,WAAW,EAAE,iDAAiD;YAC9D,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,GAAG;SAClB,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;;YACf,MAAM,SAAS,GAAG,MAAM,IAAA,iCAAwB,kBAC9C,IAAI,EAAE,OAAO,CAAC,IAAI,EAClB,KAAK,EAAE,MAAA,OAAO,CAAC,UAAU,CAAC,KAAK,mCAAI,GAAG,IACnC,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EACrE,CAAC;YAEH,OAAO,SAAS,CAAC,GAAG,CAAC,mCAA0B,CAAC,CAAC;QACnD,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const findContactAction: import("@activepieces/pieces-framework").IAction<(import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
3
|
+
}>)[], {
|
|
4
|
+
email: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
5
|
+
campaignId: import("@activepieces/pieces-framework").DropdownProperty<string, false, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
6
|
+
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
7
|
+
}>)[]> | import("@activepieces/pieces-framework").DropdownProperty<string, true, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
8
|
+
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
9
|
+
}>)[]>;
|
|
10
|
+
}>;
|
|
11
|
+
//# sourceMappingURL=find-contact.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find-contact.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/find-contact.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,iBAAiB;;;;;;;;;EAsC5B,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.findContactAction = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const auth_1 = require("../common/auth");
|
|
7
|
+
const client_1 = require("../common/client");
|
|
8
|
+
const props_1 = require("../common/props");
|
|
9
|
+
exports.findContactAction = (0, pieces_framework_1.createAction)({
|
|
10
|
+
auth: auth_1.getresponseAuth,
|
|
11
|
+
name: 'find-contact',
|
|
12
|
+
displayName: 'Find Contact',
|
|
13
|
+
description: 'Finds a contact by email address.',
|
|
14
|
+
props: {
|
|
15
|
+
email: pieces_framework_1.Property.ShortText({
|
|
16
|
+
displayName: 'Email Address',
|
|
17
|
+
description: 'The email address of the contact to find.',
|
|
18
|
+
required: true,
|
|
19
|
+
}),
|
|
20
|
+
campaignId: props_1.getresponseProps.campaign(false),
|
|
21
|
+
},
|
|
22
|
+
run(context) {
|
|
23
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
var _a;
|
|
25
|
+
const contacts = yield (0, client_1.listGetResponseContacts)({
|
|
26
|
+
auth: context.auth,
|
|
27
|
+
email: context.propsValue.email,
|
|
28
|
+
campaignId: context.propsValue.campaignId,
|
|
29
|
+
});
|
|
30
|
+
const matchingContact = contacts.find((contact) => contact.email.toLowerCase() === context.propsValue.email.toLowerCase());
|
|
31
|
+
if (!matchingContact) {
|
|
32
|
+
return {
|
|
33
|
+
found: false,
|
|
34
|
+
email: context.propsValue.email,
|
|
35
|
+
campaign_id: (_a = context.propsValue.campaignId) !== null && _a !== void 0 ? _a : null,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
return Object.assign({ found: true }, (0, client_1.flattenGetResponseContact)(matchingContact));
|
|
39
|
+
});
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
//# sourceMappingURL=find-contact.js.map
|
|
@@ -0,0 +1 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C;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { AppConnectionType } from '@activepieces/shared';
|
|
2
|
+
export declare const getresponseAuth: (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
3
|
+
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
4
|
+
}>)[];
|
|
5
|
+
export type GetResponseAuthValue = {
|
|
6
|
+
type: AppConnectionType.OAUTH2;
|
|
7
|
+
access_token: string;
|
|
8
|
+
} | {
|
|
9
|
+
type: AppConnectionType.CUSTOM_AUTH;
|
|
10
|
+
props: {
|
|
11
|
+
apiKey: string;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../../src/lib/common/auth.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAIzD,eAAO,MAAM,eAAe;;KAqC3B,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAC5B;IAAE,IAAI,EAAE,iBAAiB,CAAC,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,GACxD;IAAE,IAAI,EAAE,iBAAiB,CAAC,WAAW,CAAC;IAAC,KAAK,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getresponseAuth = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const shared_1 = require("@activepieces/shared");
|
|
7
|
+
const client_1 = require("./client");
|
|
8
|
+
exports.getresponseAuth = [
|
|
9
|
+
pieces_framework_1.PieceAuth.OAuth2({
|
|
10
|
+
description: 'Connect your GetResponse account using OAuth2.',
|
|
11
|
+
authUrl: 'https://app.getresponse.com/oauth2_authorize.html',
|
|
12
|
+
tokenUrl: 'https://api.getresponse.com/v3/token',
|
|
13
|
+
required: true,
|
|
14
|
+
scope: [],
|
|
15
|
+
}),
|
|
16
|
+
pieces_framework_1.PieceAuth.CustomAuth({
|
|
17
|
+
displayName: 'API Key',
|
|
18
|
+
description: `Authenticate using a GetResponse API key.
|
|
19
|
+
|
|
20
|
+
To get your API key:
|
|
21
|
+
1. Sign in to your GetResponse account.
|
|
22
|
+
2. Go to **Tools > Integrations and API > API**.
|
|
23
|
+
3. Create or copy an API key.
|
|
24
|
+
4. Paste it below.`,
|
|
25
|
+
required: true,
|
|
26
|
+
props: {
|
|
27
|
+
apiKey: pieces_framework_1.PieceAuth.SecretText({
|
|
28
|
+
displayName: 'API Key',
|
|
29
|
+
description: 'Your GetResponse API key.',
|
|
30
|
+
required: true,
|
|
31
|
+
}),
|
|
32
|
+
},
|
|
33
|
+
validate: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
34
|
+
try {
|
|
35
|
+
yield (0, client_1.validateGetResponseAuth)({
|
|
36
|
+
type: shared_1.AppConnectionType.CUSTOM_AUTH,
|
|
37
|
+
props: { apiKey: auth.apiKey },
|
|
38
|
+
});
|
|
39
|
+
return { valid: true };
|
|
40
|
+
}
|
|
41
|
+
catch (_b) {
|
|
42
|
+
return { valid: false, error: 'Invalid API key.' };
|
|
43
|
+
}
|
|
44
|
+
}),
|
|
45
|
+
}),
|
|
46
|
+
];
|
|
47
|
+
//# sourceMappingURL=auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../../src/lib/common/auth.ts"],"names":[],"mappings":";;;;AAAA,qEAA2D;AAC3D,iDAAyD;AAEzD,qCAAmD;AAEtC,QAAA,eAAe,GAAG;IAC7B,4BAAS,CAAC,MAAM,CAAC;QACf,WAAW,EAAE,gDAAgD;QAC7D,OAAO,EAAE,mDAAmD;QAC5D,QAAQ,EAAE,sCAAsC;QAChD,QAAQ,EAAE,IAAI;QACd,KAAK,EAAE,EAAE;KACV,CAAC;IACF,4BAAS,CAAC,UAAU,CAAC;QACnB,WAAW,EAAE,SAAS;QACtB,WAAW,EAAE;;;;;;mBAME;QACf,QAAQ,EAAE,IAAI;QACd,KAAK,EAAE;YACL,MAAM,EAAE,4BAAS,CAAC,UAAU,CAAC;gBAC3B,WAAW,EAAE,SAAS;gBACtB,WAAW,EAAE,2BAA2B;gBACxC,QAAQ,EAAE,IAAI;aACf,CAAC;SACH;QACD,QAAQ,EAAE,KAAiB,EAAE,oDAAZ,EAAE,IAAI,EAAE;YACvB,IAAI,CAAC;gBACH,MAAM,IAAA,gCAAuB,EAAC;oBAC5B,IAAI,EAAE,0BAAiB,CAAC,WAAW;oBACnC,KAAK,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE;iBAC/B,CAAC,CAAC;gBACH,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;YACzB,CAAC;YAAC,WAAM,CAAC;gBACP,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,kBAAkB,EAAE,CAAC;YACrD,CAAC;QACH,CAAC,CAAA;KACF,CAAC;CACH,CAAC"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { GetResponseAuthValue } from './auth';
|
|
2
|
+
export declare function validateGetResponseAuth(auth: GetResponseAuthValue): Promise<void>;
|
|
3
|
+
export declare function listGetResponseCampaigns({ auth, limit, name, }: {
|
|
4
|
+
auth: GetResponseAuthValue;
|
|
5
|
+
limit?: number;
|
|
6
|
+
name?: string;
|
|
7
|
+
}): Promise<GetResponseCampaign[]>;
|
|
8
|
+
export declare function listGetResponseFromFields(auth: GetResponseAuthValue): Promise<GetResponseFromField[]>;
|
|
9
|
+
export declare function listGetResponseContacts({ auth, email, campaignId, }: {
|
|
10
|
+
auth: GetResponseAuthValue;
|
|
11
|
+
email: string;
|
|
12
|
+
campaignId?: string;
|
|
13
|
+
}): Promise<GetResponseContact[]>;
|
|
14
|
+
export declare function createGetResponseContact({ auth, request, }: {
|
|
15
|
+
auth: GetResponseAuthValue;
|
|
16
|
+
request: GetResponseNewContactRequest;
|
|
17
|
+
}): Promise<GetResponseContact>;
|
|
18
|
+
export declare function updateGetResponseContact({ auth, contactId, request, }: {
|
|
19
|
+
auth: GetResponseAuthValue;
|
|
20
|
+
contactId: string;
|
|
21
|
+
request: GetResponseUpdateContactRequest;
|
|
22
|
+
}): Promise<GetResponseContact>;
|
|
23
|
+
export declare function createGetResponseNewsletter({ auth, request, }: {
|
|
24
|
+
auth: GetResponseAuthValue;
|
|
25
|
+
request: GetResponseNewNewsletterRequest;
|
|
26
|
+
}): Promise<GetResponseNewsletter>;
|
|
27
|
+
export declare function flattenGetResponseCampaign(campaign: GetResponseCampaign): GetResponseFlatRecord;
|
|
28
|
+
export declare function flattenGetResponseContact(contact: GetResponseContact): GetResponseFlatRecord;
|
|
29
|
+
export declare function flattenGetResponseNewsletter(newsletter: GetResponseNewsletter): GetResponseFlatRecord;
|
|
30
|
+
export type GetResponseFlatRecord = Record<string, string | number | boolean | null>;
|
|
31
|
+
type GetResponseCampaign = {
|
|
32
|
+
campaignId: string;
|
|
33
|
+
name?: string | null;
|
|
34
|
+
description?: string | null;
|
|
35
|
+
languageCode?: string | null;
|
|
36
|
+
isDefault?: string | null;
|
|
37
|
+
createdOn?: string | null;
|
|
38
|
+
href?: string | null;
|
|
39
|
+
};
|
|
40
|
+
type GetResponseCampaignReference = {
|
|
41
|
+
campaignId: string;
|
|
42
|
+
name?: string | null;
|
|
43
|
+
href?: string | null;
|
|
44
|
+
};
|
|
45
|
+
type GetResponseContact = {
|
|
46
|
+
contactId: string;
|
|
47
|
+
name?: string | null;
|
|
48
|
+
email: string;
|
|
49
|
+
campaign?: GetResponseCampaignReference | null;
|
|
50
|
+
dayOfCycle?: string | null;
|
|
51
|
+
scoring?: number | null;
|
|
52
|
+
engagementScore?: number | null;
|
|
53
|
+
origin?: string | null;
|
|
54
|
+
timeZone?: string | null;
|
|
55
|
+
note?: string | null;
|
|
56
|
+
tags?: GetResponseContactTag[];
|
|
57
|
+
customFieldValues?: GetResponseContactCustomFieldValue[];
|
|
58
|
+
createdOn?: string | null;
|
|
59
|
+
changedOn?: string | null;
|
|
60
|
+
href?: string | null;
|
|
61
|
+
};
|
|
62
|
+
type GetResponseContactCustomFieldValue = {
|
|
63
|
+
customFieldId: string;
|
|
64
|
+
value: string[];
|
|
65
|
+
};
|
|
66
|
+
type GetResponseContactTag = {
|
|
67
|
+
tagId: string;
|
|
68
|
+
name?: string | null;
|
|
69
|
+
};
|
|
70
|
+
type GetResponseFromField = {
|
|
71
|
+
fromFieldId: string;
|
|
72
|
+
email: string;
|
|
73
|
+
name?: string | null;
|
|
74
|
+
isActive?: string | null;
|
|
75
|
+
isDefault?: string | null;
|
|
76
|
+
createdOn?: string | null;
|
|
77
|
+
href?: string | null;
|
|
78
|
+
};
|
|
79
|
+
type GetResponseFromFieldReference = {
|
|
80
|
+
fromFieldId: string;
|
|
81
|
+
href?: string | null;
|
|
82
|
+
};
|
|
83
|
+
type GetResponseMessageContent = {
|
|
84
|
+
html?: string;
|
|
85
|
+
plain?: string;
|
|
86
|
+
};
|
|
87
|
+
type GetResponseNewContactRequest = {
|
|
88
|
+
email: string;
|
|
89
|
+
campaign: GetResponseCampaignReference;
|
|
90
|
+
name?: string;
|
|
91
|
+
};
|
|
92
|
+
type GetResponseNewNewsletterRequest = {
|
|
93
|
+
subject: string;
|
|
94
|
+
fromField: GetResponseFromFieldReference;
|
|
95
|
+
campaign: GetResponseCampaignReference;
|
|
96
|
+
content: GetResponseMessageContent;
|
|
97
|
+
sendSettings: GetResponseNewsletterSendSettings;
|
|
98
|
+
name?: string;
|
|
99
|
+
replyTo?: GetResponseFromFieldReference;
|
|
100
|
+
};
|
|
101
|
+
type GetResponseNewsletter = {
|
|
102
|
+
newsletterId: string;
|
|
103
|
+
name?: string | null;
|
|
104
|
+
subject?: string | null;
|
|
105
|
+
type?: string | null;
|
|
106
|
+
status?: string | null;
|
|
107
|
+
campaign?: GetResponseCampaignReference | null;
|
|
108
|
+
fromField?: GetResponseFromFieldReference | null;
|
|
109
|
+
replyTo?: GetResponseFromFieldReference | null;
|
|
110
|
+
sendSettings?: GetResponseNewsletterSendSettings;
|
|
111
|
+
content?: GetResponseMessageContent | null;
|
|
112
|
+
sendOn?: string | null;
|
|
113
|
+
createdOn?: string | null;
|
|
114
|
+
href?: string | null;
|
|
115
|
+
};
|
|
116
|
+
type GetResponseNewsletterSendSettings = {
|
|
117
|
+
selectedCampaigns: string[];
|
|
118
|
+
};
|
|
119
|
+
type GetResponseUpdateContactRequest = {
|
|
120
|
+
campaign?: GetResponseCampaignReference;
|
|
121
|
+
email?: string;
|
|
122
|
+
name?: string;
|
|
123
|
+
};
|
|
124
|
+
export {};
|
|
125
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../src/lib/common/client.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,oBAAoB,EAAE,MAAM,QAAQ,CAAC;AAE9C,wBAAsB,uBAAuB,CAAC,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,CASvF;AAED,wBAAsB,wBAAwB,CAAC,EAC7C,IAAI,EACJ,KAAY,EACZ,IAAI,GACL,EAAE;IACD,IAAI,EAAE,oBAAoB,CAAC;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,GAAG,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAUjC;AAED,wBAAsB,yBAAyB,CAC7C,IAAI,EAAE,oBAAoB,GACzB,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AAM,GAAG,IAAI,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,QAAQ,CAAC,EAAE,4BAA4B,GAAG,IAAI,CAAC;IAC/C,SAAS,CAAC,EAAE,6BAA6B,GAAG,IAAI,CAAC;IACjD,OAAO,CAAC,EAAE,6BAA6B,GAAG,IAAI,CAAC;IAC/C,YAAY,CAAC,EAAE,iCAAiC,CAAC;IACjD,OAAO,CAAC,EAAE,yBAAyB,GAAG,IAAI,CAAC;IAC3C,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB,CAAC;AAEF,KAAK,iCAAiC,GAAG;IACvC,iBAAiB,EAAE,MAAM,EAAE,CAAC;CAC7B,CAAC;AAIF,KAAK,+BAA+B,GAAG;IACrC,QAAQ,CAAC,EAAE,4BAA4B,CAAC;IACxC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC"}
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateGetResponseAuth = validateGetResponseAuth;
|
|
4
|
+
exports.listGetResponseCampaigns = listGetResponseCampaigns;
|
|
5
|
+
exports.listGetResponseFromFields = listGetResponseFromFields;
|
|
6
|
+
exports.listGetResponseContacts = listGetResponseContacts;
|
|
7
|
+
exports.createGetResponseContact = createGetResponseContact;
|
|
8
|
+
exports.updateGetResponseContact = updateGetResponseContact;
|
|
9
|
+
exports.createGetResponseNewsletter = createGetResponseNewsletter;
|
|
10
|
+
exports.flattenGetResponseCampaign = flattenGetResponseCampaign;
|
|
11
|
+
exports.flattenGetResponseContact = flattenGetResponseContact;
|
|
12
|
+
exports.flattenGetResponseNewsletter = flattenGetResponseNewsletter;
|
|
13
|
+
const tslib_1 = require("tslib");
|
|
14
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
15
|
+
const shared_1 = require("@activepieces/shared");
|
|
16
|
+
function validateGetResponseAuth(auth) {
|
|
17
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
18
|
+
yield sendGetRequest({
|
|
19
|
+
auth,
|
|
20
|
+
path: '/campaigns',
|
|
21
|
+
queryParams: {
|
|
22
|
+
perPage: '1',
|
|
23
|
+
page: '1',
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
function listGetResponseCampaigns(_a) {
|
|
29
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, limit = 1000, name, }) {
|
|
30
|
+
return sendGetRequest({
|
|
31
|
+
auth,
|
|
32
|
+
path: '/campaigns',
|
|
33
|
+
queryParams: Object.assign({ perPage: String(Math.min(limit, 1000)), page: '1' }, (name ? { 'query[name]': name } : {})),
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
function listGetResponseFromFields(auth) {
|
|
38
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
return sendGetRequest({
|
|
40
|
+
auth,
|
|
41
|
+
path: '/from-fields',
|
|
42
|
+
queryParams: {
|
|
43
|
+
perPage: '1000',
|
|
44
|
+
page: '1',
|
|
45
|
+
'query[isActive]': 'true',
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
function listGetResponseContacts(_a) {
|
|
51
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, email, campaignId, }) {
|
|
52
|
+
return sendGetRequest({
|
|
53
|
+
auth,
|
|
54
|
+
path: '/contacts',
|
|
55
|
+
queryParams: Object.assign({ perPage: '1000', page: '1', 'query[email]': email }, (campaignId ? { 'query[campaignId]': campaignId } : {})),
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
function createGetResponseContact(_a) {
|
|
60
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, request, }) {
|
|
61
|
+
return sendPostRequest({
|
|
62
|
+
auth,
|
|
63
|
+
path: '/contacts',
|
|
64
|
+
body: request,
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
function updateGetResponseContact(_a) {
|
|
69
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, contactId, request, }) {
|
|
70
|
+
return sendPostRequest({
|
|
71
|
+
auth,
|
|
72
|
+
path: `/contacts/${contactId}`,
|
|
73
|
+
body: request,
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
function createGetResponseNewsletter(_a) {
|
|
78
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, request, }) {
|
|
79
|
+
return sendPostRequest({
|
|
80
|
+
auth,
|
|
81
|
+
path: '/newsletters',
|
|
82
|
+
body: request,
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
function flattenGetResponseCampaign(campaign) {
|
|
87
|
+
var _a, _b, _c, _d, _e, _f;
|
|
88
|
+
return {
|
|
89
|
+
campaign_id: campaign.campaignId,
|
|
90
|
+
name: (_a = campaign.name) !== null && _a !== void 0 ? _a : null,
|
|
91
|
+
description: (_b = campaign.description) !== null && _b !== void 0 ? _b : null,
|
|
92
|
+
language_code: (_c = campaign.languageCode) !== null && _c !== void 0 ? _c : null,
|
|
93
|
+
is_default: (_d = campaign.isDefault) !== null && _d !== void 0 ? _d : null,
|
|
94
|
+
created_on: (_e = campaign.createdOn) !== null && _e !== void 0 ? _e : null,
|
|
95
|
+
href: (_f = campaign.href) !== null && _f !== void 0 ? _f : null,
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
function flattenGetResponseContact(contact) {
|
|
99
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
100
|
+
return {
|
|
101
|
+
contact_id: contact.contactId,
|
|
102
|
+
name: (_a = contact.name) !== null && _a !== void 0 ? _a : null,
|
|
103
|
+
email: contact.email,
|
|
104
|
+
campaign_id: (_c = (_b = contact.campaign) === null || _b === void 0 ? void 0 : _b.campaignId) !== null && _c !== void 0 ? _c : null,
|
|
105
|
+
campaign_name: (_e = (_d = contact.campaign) === null || _d === void 0 ? void 0 : _d.name) !== null && _e !== void 0 ? _e : null,
|
|
106
|
+
day_of_cycle: (_f = contact.dayOfCycle) !== null && _f !== void 0 ? _f : null,
|
|
107
|
+
scoring: (_g = contact.scoring) !== null && _g !== void 0 ? _g : null,
|
|
108
|
+
engagement_score: (_h = contact.engagementScore) !== null && _h !== void 0 ? _h : null,
|
|
109
|
+
origin: (_j = contact.origin) !== null && _j !== void 0 ? _j : null,
|
|
110
|
+
time_zone: (_k = contact.timeZone) !== null && _k !== void 0 ? _k : null,
|
|
111
|
+
note: (_l = contact.note) !== null && _l !== void 0 ? _l : null,
|
|
112
|
+
tags: formatContactTags(contact.tags),
|
|
113
|
+
custom_field_values: formatContactCustomFieldValues(contact.customFieldValues),
|
|
114
|
+
created_on: (_m = contact.createdOn) !== null && _m !== void 0 ? _m : null,
|
|
115
|
+
changed_on: (_o = contact.changedOn) !== null && _o !== void 0 ? _o : null,
|
|
116
|
+
href: (_p = contact.href) !== null && _p !== void 0 ? _p : null,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
function flattenGetResponseNewsletter(newsletter) {
|
|
120
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
|
121
|
+
return {
|
|
122
|
+
newsletter_id: newsletter.newsletterId,
|
|
123
|
+
name: (_a = newsletter.name) !== null && _a !== void 0 ? _a : null,
|
|
124
|
+
subject: (_b = newsletter.subject) !== null && _b !== void 0 ? _b : null,
|
|
125
|
+
type: (_c = newsletter.type) !== null && _c !== void 0 ? _c : null,
|
|
126
|
+
status: (_d = newsletter.status) !== null && _d !== void 0 ? _d : null,
|
|
127
|
+
campaign_id: (_f = (_e = newsletter.campaign) === null || _e === void 0 ? void 0 : _e.campaignId) !== null && _f !== void 0 ? _f : null,
|
|
128
|
+
campaign_name: (_h = (_g = newsletter.campaign) === null || _g === void 0 ? void 0 : _g.name) !== null && _h !== void 0 ? _h : null,
|
|
129
|
+
from_field_id: (_k = (_j = newsletter.fromField) === null || _j === void 0 ? void 0 : _j.fromFieldId) !== null && _k !== void 0 ? _k : null,
|
|
130
|
+
reply_to_field_id: (_m = (_l = newsletter.replyTo) === null || _l === void 0 ? void 0 : _l.fromFieldId) !== null && _m !== void 0 ? _m : null,
|
|
131
|
+
selected_campaigns: (_p = (_o = newsletter.sendSettings) === null || _o === void 0 ? void 0 : _o.selectedCampaigns.join(', ')) !== null && _p !== void 0 ? _p : null,
|
|
132
|
+
content_html: (_r = (_q = newsletter.content) === null || _q === void 0 ? void 0 : _q.html) !== null && _r !== void 0 ? _r : null,
|
|
133
|
+
content_plain: (_t = (_s = newsletter.content) === null || _s === void 0 ? void 0 : _s.plain) !== null && _t !== void 0 ? _t : null,
|
|
134
|
+
send_on: (_u = newsletter.sendOn) !== null && _u !== void 0 ? _u : null,
|
|
135
|
+
created_on: (_v = newsletter.createdOn) !== null && _v !== void 0 ? _v : null,
|
|
136
|
+
href: (_w = newsletter.href) !== null && _w !== void 0 ? _w : null,
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
function sendGetRequest({ auth, path, queryParams, }) {
|
|
140
|
+
return sendRequest({
|
|
141
|
+
auth,
|
|
142
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
143
|
+
path,
|
|
144
|
+
queryParams,
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
function sendPostRequest({ auth, path, body, }) {
|
|
148
|
+
return sendRequest({
|
|
149
|
+
auth,
|
|
150
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
151
|
+
path,
|
|
152
|
+
body,
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
function sendRequest(_a) {
|
|
156
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, method, path, body, queryParams, }) {
|
|
157
|
+
const request = {
|
|
158
|
+
method,
|
|
159
|
+
url: `${GETRESPONSE_API_URL}${path}`,
|
|
160
|
+
headers: createHeaders(auth),
|
|
161
|
+
queryParams,
|
|
162
|
+
body,
|
|
163
|
+
};
|
|
164
|
+
const response = yield pieces_common_1.httpClient.sendRequest(request);
|
|
165
|
+
return response.body;
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
function createHeaders(auth) {
|
|
169
|
+
const headers = {
|
|
170
|
+
Accept: 'application/json',
|
|
171
|
+
'Content-Type': 'application/json',
|
|
172
|
+
};
|
|
173
|
+
if (auth.type === shared_1.AppConnectionType.OAUTH2) {
|
|
174
|
+
headers['Authorization'] = `Bearer ${auth.access_token}`;
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
headers['X-Auth-Token'] = `api-key ${auth.props.apiKey}`;
|
|
178
|
+
}
|
|
179
|
+
return headers;
|
|
180
|
+
}
|
|
181
|
+
function formatContactTags(tags) {
|
|
182
|
+
if (!tags || tags.length === 0) {
|
|
183
|
+
return null;
|
|
184
|
+
}
|
|
185
|
+
return tags.map((tag) => { var _a; return (_a = tag.name) !== null && _a !== void 0 ? _a : tag.tagId; }).join(', ');
|
|
186
|
+
}
|
|
187
|
+
function formatContactCustomFieldValues(customFieldValues) {
|
|
188
|
+
if (!customFieldValues || customFieldValues.length === 0) {
|
|
189
|
+
return null;
|
|
190
|
+
}
|
|
191
|
+
return customFieldValues
|
|
192
|
+
.map((customFieldValue) => {
|
|
193
|
+
const joinedValues = customFieldValue.value.join('|');
|
|
194
|
+
return `${customFieldValue.customFieldId}:${joinedValues}`;
|
|
195
|
+
})
|
|
196
|
+
.join(', ');
|
|
197
|
+
}
|
|
198
|
+
const GETRESPONSE_API_URL = 'https://api.getresponse.com/v3';
|
|
199
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../src/lib/common/client.ts"],"names":[],"mappings":";;AAKA,0DASC;AAED,4DAkBC;AAED,8DAYC;AAED,0DAmBC;AAED,4DAYC;AAED,4DAcC;AAED,kEAYC;AAED,gEAYC;AAED,8DAuBC;AAED,oEAoBC;;AA9KD,+DAAkF;AAClF,iDAAyD;AAIzD,SAAsB,uBAAuB,CAAC,IAA0B;;QACtE,MAAM,cAAc,CAAwB;YAC1C,IAAI;YACJ,IAAI,EAAE,YAAY;YAClB,WAAW,EAAE;gBACX,OAAO,EAAE,GAAG;gBACZ,IAAI,EAAE,GAAG;aACV;SACF,CAAC,CAAC;IACL,CAAC;CAAA;AAED,SAAsB,wBAAwB;iEAAC,EAC7C,IAAI,EACJ,KAAK,GAAG,IAAI,EACZ,IAAI,GAKL;QACC,OAAO,cAAc,CAAwB;YAC3C,IAAI;YACJ,IAAI,EAAE,YAAY;YAClB,WAAW,kBACT,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,EACtC,IAAI,EAAE,GAAG,IACN,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CACzC;SACF,CAAC,CAAC;IACL,CAAC;CAAA;AAED,SAAsB,yBAAyB,CAC7C,IAA0B;;QAE1B,OAAO,cAAc,CAAyB;YAC5C,IAAI;YACJ,IAAI,EAAE,cAAc;YACpB,WAAW,EAAE;gBACX,OAAO,EAAE,MAAM;gBACf,IAAI,EAAE,GAAG;gBACT,iBAAiB,EAAE,MAAM;aAC1B;SACF,CAAC,CAAC;IACL,CAAC;CAAA;AAED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AA8B,CACrC,iBAAmE;IAEnE,IAAI,CAAC,iBAAiB,IAAI,iBAAiB,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,iBAAiB;SACrB,GAAG,CAAC,CAAC,gBAAgB,EAAE,EAAE;QACxB,MAAM,YAAY,GAAG,gBAAgB,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACtD,OAAO,GAAG,gBAAgB,CAAC,aAAa,IAAI,YAAY,EAAE,CAAC;IAC7D,CAAC,CAAC;SACD,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC;AAED,MAAM,mBAAmB,GAAG,gCAAgC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const getresponseProps: {
|
|
2
|
+
campaign: (required?: boolean) => import("@activepieces/pieces-framework").DropdownProperty<string, false, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
3
|
+
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
4
|
+
}>)[]> | import("@activepieces/pieces-framework").DropdownProperty<string, true, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
5
|
+
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
6
|
+
}>)[]>;
|
|
7
|
+
fromField: (required?: boolean, displayName?: string) => import("@activepieces/pieces-framework").DropdownProperty<string, false, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
8
|
+
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
9
|
+
}>)[]> | import("@activepieces/pieces-framework").DropdownProperty<string, true, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
10
|
+
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
11
|
+
}>)[]>;
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=props.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../../../src/lib/common/props.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,gBAAgB;;;;;;;;;;;CA2E5B,CAAC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getresponseProps = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const auth_1 = require("./auth");
|
|
7
|
+
const client_1 = require("./client");
|
|
8
|
+
exports.getresponseProps = {
|
|
9
|
+
campaign: (required = true) => pieces_framework_1.Property.Dropdown({
|
|
10
|
+
auth: auth_1.getresponseAuth,
|
|
11
|
+
displayName: 'Campaign',
|
|
12
|
+
description: 'Select the campaign list to use.',
|
|
13
|
+
required,
|
|
14
|
+
refreshers: [],
|
|
15
|
+
options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
16
|
+
if (!auth) {
|
|
17
|
+
return {
|
|
18
|
+
disabled: true,
|
|
19
|
+
options: [],
|
|
20
|
+
placeholder: 'Connect your account first',
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
const campaigns = yield (0, client_1.listGetResponseCampaigns)({
|
|
24
|
+
auth: auth,
|
|
25
|
+
});
|
|
26
|
+
if (campaigns.length === 0) {
|
|
27
|
+
return {
|
|
28
|
+
disabled: false,
|
|
29
|
+
options: [],
|
|
30
|
+
placeholder: 'No campaigns found. Create one in GetResponse first.',
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
return {
|
|
34
|
+
disabled: false,
|
|
35
|
+
options: campaigns.map((campaign) => {
|
|
36
|
+
var _a;
|
|
37
|
+
return ({
|
|
38
|
+
label: (_a = campaign.name) !== null && _a !== void 0 ? _a : campaign.campaignId,
|
|
39
|
+
value: campaign.campaignId,
|
|
40
|
+
});
|
|
41
|
+
}),
|
|
42
|
+
};
|
|
43
|
+
}),
|
|
44
|
+
}),
|
|
45
|
+
fromField: (required = true, displayName = 'From Address') => pieces_framework_1.Property.Dropdown({
|
|
46
|
+
auth: auth_1.getresponseAuth,
|
|
47
|
+
displayName,
|
|
48
|
+
description: 'Select the verified sender address to use.',
|
|
49
|
+
required,
|
|
50
|
+
refreshers: [],
|
|
51
|
+
options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
52
|
+
if (!auth) {
|
|
53
|
+
return {
|
|
54
|
+
disabled: true,
|
|
55
|
+
options: [],
|
|
56
|
+
placeholder: 'Connect your account first',
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
const fromFields = yield (0, client_1.listGetResponseFromFields)(auth);
|
|
60
|
+
if (fromFields.length === 0) {
|
|
61
|
+
return {
|
|
62
|
+
disabled: false,
|
|
63
|
+
options: [],
|
|
64
|
+
placeholder: 'No active sender addresses found in GetResponse.',
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
return {
|
|
68
|
+
disabled: false,
|
|
69
|
+
options: fromFields.map((fromField) => ({
|
|
70
|
+
label: fromField.name
|
|
71
|
+
? `${fromField.name} (${fromField.email})`
|
|
72
|
+
: fromField.email,
|
|
73
|
+
value: fromField.fromFieldId,
|
|
74
|
+
})),
|
|
75
|
+
};
|
|
76
|
+
}),
|
|
77
|
+
}),
|
|
78
|
+
};
|
|
79
|
+
//# sourceMappingURL=props.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"props.js","sourceRoot":"","sources":["../../../../src/lib/common/props.ts"],"names":[],"mappings":";;;;AAAA,qEAA0D;AAE1D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,UAAU,EAAE,EAAE;QACd,OAAO,EAAE,KAAiB,EAAE,oDAAZ,EAAE,IAAI,EAAE;YACtB,IAAI,CAAC,IAAI,EAAE,CAAC;gBACV,OAAO;oBACL,QAAQ,EAAE,IAAI;oBACd,OAAO,EAAE,EAAE;oBACX,WAAW,EAAE,4BAA4B;iBAC1C,CAAC;YACJ,CAAC;YAED,MAAM,UAAU,GAAG,MAAM,IAAA,kCAAyB,EAAC,IAA4B,CAAC,CAAC;YAEjF,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBAC5B,OAAO;oBACL,QAAQ,EAAE,KAAK;oBACf,OAAO,EAAE,EAAE;oBACX,WAAW,EAAE,kDAAkD;iBAChE,CAAC;YACJ,CAAC;YAED,OAAO;gBACL,QAAQ,EAAE,KAAK;gBACf,OAAO,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;oBACtC,KAAK,EAAE,SAAS,CAAC,IAAI;wBACnB,CAAC,CAAC,GAAG,SAAS,CAAC,IAAI,KAAK,SAAS,CAAC,KAAK,GAAG;wBAC1C,CAAC,CAAC,SAAS,CAAC,KAAK;oBACnB,KAAK,EAAE,SAAS,CAAC,WAAW;iBAC7B,CAAC,CAAC;aACJ,CAAC;QACJ,CAAC,CAAA;KACF,CAAC;CACL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/lib/common/utils.ts"],"names":[],"mappings":"AAAA,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAKlF"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.requireString = requireString;
|
|
4
|
+
function requireString(value, fieldName) {
|
|
5
|
+
if (!value) {
|
|
6
|
+
throw new Error(`${fieldName} is required.`);
|
|
7
|
+
}
|
|
8
|
+
return value;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/lib/common/utils.ts"],"names":[],"mappings":";;AAAA,sCAKC;AALD,SAAgB,aAAa,CAAC,KAAyB,EAAE,SAAiB;IACxE,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,GAAG,SAAS,eAAe,CAAC,CAAC;IAC/C,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|