@segment/action-destinations 3.267.1-staging-dcda950e2 → 3.267.1-staging-70ddf3488
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/dist/destinations/dynamic-yield-audiences/syncAudience/types.d.ts +22 -0
- package/dist/destinations/dynamic-yield-audiences/syncAudience/types.js.map +1 -0
- package/dist/destinations/dynamic-yield-audiences/types.d.ts +8 -0
- package/dist/destinations/dynamic-yield-audiences/types.js +12 -0
- package/dist/destinations/dynamic-yield-audiences/types.js.map +1 -0
- package/dist/destinations/engage-messaging-sendgrid/index.d.ts +3 -4
- package/dist/destinations/engage-messaging-sendgrid/index.js +16 -68
- package/dist/destinations/engage-messaging-sendgrid/index.js.map +1 -1
- package/dist/destinations/engage-messaging-twilio/index.d.ts +3 -4
- package/dist/destinations/engage-messaging-twilio/index.js +15 -169
- package/dist/destinations/engage-messaging-twilio/index.js.map +1 -1
- package/dist/destinations/klaviyo/functions.d.ts +3 -1
- package/dist/destinations/klaviyo/functions.js +23 -2
- package/dist/destinations/klaviyo/functions.js.map +1 -1
- package/dist/destinations/klaviyo/types.d.ts +4 -0
- package/dist/destinations/klaviyo/types.js.map +1 -1
- package/dist/destinations/klaviyo/upsertProfile/generated-types.d.ts +1 -12
- package/dist/destinations/klaviyo/upsertProfile/index.js +15 -83
- package/dist/destinations/klaviyo/upsertProfile/index.js.map +1 -1
- package/dist/destinations/responsys/asyncMergePetRecords/generated-types.d.ts +14 -0
- package/dist/destinations/responsys/asyncMergePetRecords/generated-types.js.map +1 -0
- package/dist/destinations/responsys/asyncMergePetRecords/index.d.ts +5 -0
- package/dist/destinations/responsys/asyncMergePetRecords/index.js +113 -0
- package/dist/destinations/responsys/asyncMergePetRecords/index.js.map +1 -0
- package/dist/destinations/responsys/asyncMergeProfileListMembers/generated-types.d.ts +20 -0
- package/dist/destinations/responsys/asyncMergeProfileListMembers/generated-types.js +3 -0
- package/dist/destinations/responsys/asyncMergeProfileListMembers/generated-types.js.map +1 -0
- package/dist/destinations/responsys/asyncMergeProfileListMembers/index.d.ts +5 -0
- package/dist/destinations/responsys/asyncMergeProfileListMembers/index.js +174 -0
- package/dist/destinations/responsys/asyncMergeProfileListMembers/index.js.map +1 -0
- package/dist/destinations/responsys/rsp-operations.d.ts +14 -0
- package/dist/destinations/responsys/rsp-operations.js +33 -0
- package/dist/destinations/responsys/rsp-operations.js.map +1 -0
- package/dist/destinations/responsys/rsp-properties.d.ts +4 -0
- package/dist/destinations/responsys/rsp-properties.js +27 -0
- package/dist/destinations/responsys/rsp-properties.js.map +1 -0
- package/dist/destinations/responsys-cloud/generated-types.d.ts +20 -0
- package/dist/destinations/responsys-cloud/generated-types.js.map +1 -0
- package/dist/destinations/responsys-cloud/index.d.ts +4 -0
- package/dist/destinations/responsys-cloud/index.js +207 -0
- package/dist/destinations/responsys-cloud/index.js.map +1 -0
- package/dist/destinations/responsys-cloud/sendAudience/generated-types.d.ts +16 -0
- package/dist/destinations/responsys-cloud/sendAudience/generated-types.js.map +1 -0
- package/dist/destinations/{engage-messaging-sendgrid/previewApiLookup → responsys-cloud/sendAudience}/index.d.ts +2 -2
- package/dist/destinations/responsys-cloud/sendAudience/index.js +109 -0
- package/dist/destinations/responsys-cloud/sendAudience/index.js.map +1 -0
- package/dist/destinations/responsys-cloud/sendCustomTraits/generated-types.d.ts +11 -0
- package/dist/destinations/responsys-cloud/sendCustomTraits/generated-types.js.map +1 -0
- package/dist/destinations/{engage-messaging-sendgrid/sendEmail → responsys-cloud/sendCustomTraits}/index.d.ts +2 -2
- package/dist/destinations/responsys-cloud/sendCustomTraits/index.js +72 -0
- package/dist/destinations/responsys-cloud/sendCustomTraits/index.js.map +1 -0
- package/dist/destinations/responsys-cloud/shared_properties.d.ts +3 -0
- package/dist/destinations/responsys-cloud/shared_properties.js +19 -0
- package/dist/destinations/responsys-cloud/shared_properties.js.map +1 -0
- package/dist/destinations/responsys-cloud/types.d.ts +38 -0
- package/dist/destinations/{engage-messaging-sendgrid/sendEmail/UnlayerResponse.js → responsys-cloud/types.js} +1 -1
- package/dist/destinations/responsys-cloud/types.js.map +1 -0
- package/dist/destinations/responsys-cloud/upsertListMember/generated-types.d.ts +14 -0
- package/dist/destinations/responsys-cloud/upsertListMember/generated-types.js.map +1 -0
- package/dist/destinations/responsys-cloud/upsertListMember/index.d.ts +5 -0
- package/dist/destinations/responsys-cloud/upsertListMember/index.js +85 -0
- package/dist/destinations/responsys-cloud/upsertListMember/index.js.map +1 -0
- package/dist/destinations/responsys-cloud/utils.d.ts +20 -0
- package/dist/destinations/responsys-cloud/utils.js +179 -0
- package/dist/destinations/responsys-cloud/utils.js.map +1 -0
- package/dist/destinations/snap-conversions-api/_tests_/capiV2tests.d.ts +1 -0
- package/dist/destinations/snap-conversions-api/_tests_/capiV2tests.js +381 -0
- package/dist/destinations/snap-conversions-api/_tests_/capiV2tests.js.map +1 -0
- package/dist/destinations/snap-conversions-api/_tests_/capiV3tests.d.ts +1 -0
- package/dist/destinations/snap-conversions-api/_tests_/capiV3tests.js +581 -0
- package/dist/destinations/snap-conversions-api/_tests_/capiV3tests.js.map +1 -0
- package/dist/destinations/snap-conversions-api/reportConversionEvent/snap-capi-v2.d.ts +4 -0
- package/dist/destinations/snap-conversions-api/reportConversionEvent/snap-capi-v2.js +97 -0
- package/dist/destinations/snap-conversions-api/reportConversionEvent/snap-capi-v2.js.map +1 -0
- package/dist/destinations/snap-conversions-api/snap-capi-properties.d.ts +30 -0
- package/dist/destinations/snap-conversions-api/snap-capi-properties.js +316 -0
- package/dist/destinations/snap-conversions-api/snap-capi-properties.js.map +1 -0
- package/dist/destinations/tiktok-conversions/reportWebEvent/formatter.d.ts +3 -0
- package/dist/destinations/tiktok-conversions/reportWebEvent/formatter.js +34 -0
- package/dist/destinations/tiktok-conversions/reportWebEvent/formatter.js.map +1 -0
- package/dist/destinations/tiktok-offline-conversions/reportOfflineEvent/formatter.d.ts +3 -0
- package/dist/destinations/tiktok-offline-conversions/reportOfflineEvent/formatter.js +43 -0
- package/dist/destinations/tiktok-offline-conversions/reportOfflineEvent/formatter.js.map +1 -0
- package/package.json +1 -1
- package/dist/destinations/engage-messaging-sendgrid/previewApiLookup/apiLookups.d.ts +0 -22
- package/dist/destinations/engage-messaging-sendgrid/previewApiLookup/apiLookups.js +0 -189
- package/dist/destinations/engage-messaging-sendgrid/previewApiLookup/apiLookups.js.map +0 -1
- package/dist/destinations/engage-messaging-sendgrid/previewApiLookup/generated-types.d.ts +0 -16
- package/dist/destinations/engage-messaging-sendgrid/previewApiLookup/generated-types.js.map +0 -1
- package/dist/destinations/engage-messaging-sendgrid/previewApiLookup/index.js +0 -29
- package/dist/destinations/engage-messaging-sendgrid/previewApiLookup/index.js.map +0 -1
- package/dist/destinations/engage-messaging-sendgrid/sendEmail/SendEmailPerformer.d.ts +0 -43
- package/dist/destinations/engage-messaging-sendgrid/sendEmail/SendEmailPerformer.js +0 -419
- package/dist/destinations/engage-messaging-sendgrid/sendEmail/SendEmailPerformer.js.map +0 -1
- package/dist/destinations/engage-messaging-sendgrid/sendEmail/UnlayerResponse.d.ts +0 -12
- package/dist/destinations/engage-messaging-sendgrid/sendEmail/UnlayerResponse.js.map +0 -1
- package/dist/destinations/engage-messaging-sendgrid/sendEmail/generated-types.d.ts +0 -56
- package/dist/destinations/engage-messaging-sendgrid/sendEmail/generated-types.js.map +0 -1
- package/dist/destinations/engage-messaging-sendgrid/sendEmail/index.js +0 -258
- package/dist/destinations/engage-messaging-sendgrid/sendEmail/index.js.map +0 -1
- package/dist/destinations/engage-messaging-sendgrid/sendEmail/insertEmailPreviewText.d.ts +0 -1
- package/dist/destinations/engage-messaging-sendgrid/sendEmail/insertEmailPreviewText.js +0 -23
- package/dist/destinations/engage-messaging-sendgrid/sendEmail/insertEmailPreviewText.js.map +0 -1
- package/dist/destinations/engage-messaging-sendgrid/sendEmail/isRestrictedDomain.d.ts +0 -1
- package/dist/destinations/engage-messaging-sendgrid/sendEmail/isRestrictedDomain.js +0 -14
- package/dist/destinations/engage-messaging-sendgrid/sendEmail/isRestrictedDomain.js.map +0 -1
- package/dist/destinations/engage-messaging-twilio/sendMobilePush/PushSender.d.ts +0 -29
- package/dist/destinations/engage-messaging-twilio/sendMobilePush/PushSender.js +0 -169
- package/dist/destinations/engage-messaging-twilio/sendMobilePush/PushSender.js.map +0 -1
- package/dist/destinations/engage-messaging-twilio/sendMobilePush/generated-types.d.ts +0 -39
- package/dist/destinations/engage-messaging-twilio/sendMobilePush/generated-types.js.map +0 -1
- package/dist/destinations/engage-messaging-twilio/sendMobilePush/index.d.ts +0 -5
- package/dist/destinations/engage-messaging-twilio/sendMobilePush/index.js +0 -251
- package/dist/destinations/engage-messaging-twilio/sendMobilePush/index.js.map +0 -1
- package/dist/destinations/engage-messaging-twilio/sendSms/SmsMessageSender.d.ts +0 -9
- package/dist/destinations/engage-messaging-twilio/sendSms/SmsMessageSender.js +0 -72
- package/dist/destinations/engage-messaging-twilio/sendSms/SmsMessageSender.js.map +0 -1
- package/dist/destinations/engage-messaging-twilio/sendSms/generated-types.d.ts +0 -27
- package/dist/destinations/engage-messaging-twilio/sendSms/generated-types.js.map +0 -1
- package/dist/destinations/engage-messaging-twilio/sendSms/index.d.ts +0 -5
- package/dist/destinations/engage-messaging-twilio/sendSms/index.js +0 -163
- package/dist/destinations/engage-messaging-twilio/sendSms/index.js.map +0 -1
- package/dist/destinations/engage-messaging-twilio/sendWhatsApp/WhatsAppMessageSender.d.ts +0 -9
- package/dist/destinations/engage-messaging-twilio/sendWhatsApp/WhatsAppMessageSender.js +0 -89
- package/dist/destinations/engage-messaging-twilio/sendWhatsApp/WhatsAppMessageSender.js.map +0 -1
- package/dist/destinations/engage-messaging-twilio/sendWhatsApp/generated-types.d.ts +0 -25
- package/dist/destinations/engage-messaging-twilio/sendWhatsApp/generated-types.js.map +0 -1
- package/dist/destinations/engage-messaging-twilio/sendWhatsApp/index.d.ts +0 -5
- package/dist/destinations/engage-messaging-twilio/sendWhatsApp/index.js +0 -137
- package/dist/destinations/engage-messaging-twilio/sendWhatsApp/index.js.map +0 -1
- package/dist/destinations/engage-messaging-twilio/utils/PhoneMessageSender.d.ts +0 -16
- package/dist/destinations/engage-messaging-twilio/utils/PhoneMessageSender.js +0 -71
- package/dist/destinations/engage-messaging-twilio/utils/PhoneMessageSender.js.map +0 -1
- package/dist/destinations/engage-messaging-twilio/utils/TwilioMessageSender.d.ts +0 -16
- package/dist/destinations/engage-messaging-twilio/utils/TwilioMessageSender.js +0 -115
- package/dist/destinations/engage-messaging-twilio/utils/TwilioMessageSender.js.map +0 -1
- package/dist/destinations/engage-messaging-twilio/utils/index.d.ts +0 -2
- package/dist/destinations/engage-messaging-twilio/utils/index.js +0 -15
- package/dist/destinations/engage-messaging-twilio/utils/index.js.map +0 -1
- package/dist/destinations/engage-messaging-twilio/utils/types.d.ts +0 -23
- package/dist/destinations/engage-messaging-twilio/utils/types.js.map +0 -1
- /package/dist/destinations/{engage-messaging-twilio/utils → dynamic-yield-audiences/syncAudience}/types.js +0 -0
- /package/dist/destinations/{engage-messaging-twilio/sendWhatsApp → responsys/asyncMergePetRecords}/generated-types.js +0 -0
- /package/dist/destinations/{engage-messaging-sendgrid/previewApiLookup → responsys-cloud}/generated-types.js +0 -0
- /package/dist/destinations/{engage-messaging-sendgrid/sendEmail → responsys-cloud/sendAudience}/generated-types.js +0 -0
- /package/dist/destinations/{engage-messaging-twilio/sendMobilePush → responsys-cloud/sendCustomTraits}/generated-types.js +0 -0
- /package/dist/destinations/{engage-messaging-twilio/sendSms → responsys-cloud/upsertListMember}/generated-types.js +0 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Payload } from './generated-types';
|
|
2
|
+
export interface Data {
|
|
3
|
+
payload: Payload & {
|
|
4
|
+
context?: {
|
|
5
|
+
[k: string]: unknown;
|
|
6
|
+
personas?: {
|
|
7
|
+
computation_key?: string;
|
|
8
|
+
computation_class?: string;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
rawData?: {
|
|
13
|
+
context?: {
|
|
14
|
+
personas?: {
|
|
15
|
+
computation_key?: string;
|
|
16
|
+
computation_class?: string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
properties?: Record<string, boolean>;
|
|
20
|
+
traits?: Record<string, boolean>;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/destinations/dynamic-yield-audiences/syncAudience/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare type AudienceAction = 'ADD' | 'REMOVE';
|
|
2
|
+
export declare enum Priority {
|
|
3
|
+
UserIdThenEmail = "user_id_then_email",
|
|
4
|
+
UserIdThenAnonymousId = "user_id_then_anonymousId",
|
|
5
|
+
UserIdThenEmailThenAnonymousId = "user_id_then_email_then_anonymousId",
|
|
6
|
+
UserIdOnly = "user_id_only",
|
|
7
|
+
EmailOnly = "email_only"
|
|
8
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Priority = void 0;
|
|
4
|
+
var Priority;
|
|
5
|
+
(function (Priority) {
|
|
6
|
+
Priority["UserIdThenEmail"] = "user_id_then_email";
|
|
7
|
+
Priority["UserIdThenAnonymousId"] = "user_id_then_anonymousId";
|
|
8
|
+
Priority["UserIdThenEmailThenAnonymousId"] = "user_id_then_email_then_anonymousId";
|
|
9
|
+
Priority["UserIdOnly"] = "user_id_only";
|
|
10
|
+
Priority["EmailOnly"] = "email_only";
|
|
11
|
+
})(Priority = exports.Priority || (exports.Priority = {}));
|
|
12
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/destinations/dynamic-yield-audiences/types.ts"],"names":[],"mappings":";;;AAEA,IAAY,QAMX;AAND,WAAY,QAAQ;IAClB,kDAAsC,CAAA;IACtC,8DAAkD,CAAA;IAClD,kFAAsE,CAAA;IACtE,uCAA2B,CAAA;IAC3B,oCAAwB,CAAA;AAC1B,CAAC,EANW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAMnB"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
export default destinationDefinition;
|
|
1
|
+
import destination from '../engage/sendgrid';
|
|
2
|
+
export default destination;
|
|
3
|
+
export * from '../engage/sendgrid';
|
|
@@ -1,71 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
unlayerApiKey: {
|
|
15
|
-
label: 'Unlayer API Key',
|
|
16
|
-
type: 'password',
|
|
17
|
-
description: 'The API key for your Unlayer account'
|
|
18
|
-
},
|
|
19
|
-
sendGridApiKey: {
|
|
20
|
-
label: 'API Key',
|
|
21
|
-
type: 'password',
|
|
22
|
-
description: 'The Api Key for your SendGrid account',
|
|
23
|
-
required: true
|
|
24
|
-
},
|
|
25
|
-
profileApiEnvironment: {
|
|
26
|
-
label: 'Profile API Environment',
|
|
27
|
-
description: 'Profile API Environment',
|
|
28
|
-
type: 'string',
|
|
29
|
-
required: true
|
|
30
|
-
},
|
|
31
|
-
profileApiAccessToken: {
|
|
32
|
-
label: 'Profile API Access Token',
|
|
33
|
-
description: 'Profile API Access Token',
|
|
34
|
-
type: 'password',
|
|
35
|
-
required: true
|
|
36
|
-
},
|
|
37
|
-
spaceId: {
|
|
38
|
-
label: 'Space ID',
|
|
39
|
-
description: 'Space ID',
|
|
40
|
-
type: 'string',
|
|
41
|
-
required: true
|
|
42
|
-
},
|
|
43
|
-
sourceId: {
|
|
44
|
-
label: 'Source ID',
|
|
45
|
-
description: 'Source ID',
|
|
46
|
-
type: 'string',
|
|
47
|
-
required: true
|
|
48
|
-
},
|
|
49
|
-
region: {
|
|
50
|
-
label: 'Region',
|
|
51
|
-
description: 'The region where the email is originating from',
|
|
52
|
-
type: 'string',
|
|
53
|
-
choices: [
|
|
54
|
-
{ value: 'us-west-2', label: 'US West 2' },
|
|
55
|
-
{ value: 'eu-west-1', label: 'EU West 1' }
|
|
56
|
-
],
|
|
57
|
-
default: 'us-west-2',
|
|
58
|
-
required: false
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
testAuthentication: (request) => {
|
|
62
|
-
return request('https://api.sendgrid.com/v3/mail_settings');
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
actions: {
|
|
66
|
-
sendEmail: sendEmail_1.actionDefinition,
|
|
67
|
-
previewApiLookup: previewApiLookup_1.actionDefinition
|
|
68
|
-
}
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
13
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
69
14
|
};
|
|
70
|
-
exports
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
const sendgrid_1 = __importDefault(require("../engage/sendgrid"));
|
|
17
|
+
exports.default = sendgrid_1.default;
|
|
18
|
+
__exportStar(require("../engage/sendgrid"), exports);
|
|
71
19
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/engage-messaging-sendgrid/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/engage-messaging-sendgrid/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAOA,kEAA4C;AAC5C,kBAAe,kBAAW,CAAA;AAC1B,qDAAkC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
export default destinationDefinition;
|
|
1
|
+
import destination from '../engage/twilio';
|
|
2
|
+
export default destination;
|
|
3
|
+
export * from '../engage/twilio';
|
|
@@ -1,173 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
};
|
|
12
|
-
const ConnectionOverridesProperties = {
|
|
13
|
-
ct: {
|
|
14
|
-
label: 'Connection timeout',
|
|
15
|
-
description: 'The timeout in milliseconds Twilio will wait to establish its TCP connection to your webserver',
|
|
16
|
-
type: 'number',
|
|
17
|
-
default: 5000,
|
|
18
|
-
choices: getRange(10000)
|
|
19
|
-
},
|
|
20
|
-
rt: {
|
|
21
|
-
label: 'Read timeout',
|
|
22
|
-
description: 'The amount of time in milliseconds after sending your webhook an HTTP request that Twilio will wait for the initial HTTP response packet',
|
|
23
|
-
type: 'number',
|
|
24
|
-
default: 15000,
|
|
25
|
-
choices: getRange(15000)
|
|
26
|
-
},
|
|
27
|
-
tt: {
|
|
28
|
-
label: 'Total timeout',
|
|
29
|
-
description: 'The total time allowed for all timeouts including retries',
|
|
30
|
-
type: 'number',
|
|
31
|
-
default: 15000,
|
|
32
|
-
choices: getRange(15000)
|
|
33
|
-
},
|
|
34
|
-
rc: {
|
|
35
|
-
label: 'Retry count',
|
|
36
|
-
description: 'The number of retry attempts Twilio will make if its connection to your webhook fails',
|
|
37
|
-
type: 'number',
|
|
38
|
-
default: 1,
|
|
39
|
-
choices: getRange(5)
|
|
40
|
-
},
|
|
41
|
-
rp: {
|
|
42
|
-
label: 'Retry policy',
|
|
43
|
-
description: 'The type of failure to retry on',
|
|
44
|
-
type: 'string',
|
|
45
|
-
default: 'ct',
|
|
46
|
-
choices: ['ct', '4xx', '5xx', 'rt', 'all']
|
|
47
|
-
},
|
|
48
|
-
sni: {
|
|
49
|
-
label: 'SNI',
|
|
50
|
-
description: 'The type of failure to retry on',
|
|
51
|
-
type: 'string',
|
|
52
|
-
default: 'unset',
|
|
53
|
-
choices: ['y', 'n', 'unser']
|
|
54
|
-
},
|
|
55
|
-
e: {
|
|
56
|
-
label: 'Edge location',
|
|
57
|
-
description: 'The Twilio edge location where webhooks egress. This can be a list and we rotate through the list as retries happen.',
|
|
58
|
-
type: 'string',
|
|
59
|
-
default: 'ashburn',
|
|
60
|
-
choices: [
|
|
61
|
-
'ashburn',
|
|
62
|
-
'ashburn-ix',
|
|
63
|
-
'dublin',
|
|
64
|
-
'frankfurt',
|
|
65
|
-
'frankfurt-ix',
|
|
66
|
-
'sao-paulo',
|
|
67
|
-
'singapore',
|
|
68
|
-
'sydney',
|
|
69
|
-
'tokyo',
|
|
70
|
-
'umatilla',
|
|
71
|
-
'london-ix',
|
|
72
|
-
'san-jose-ix',
|
|
73
|
-
'singapore-ix'
|
|
74
|
-
]
|
|
75
|
-
}
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
76
11
|
};
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
slug: 'actions-personas-messaging-twilio',
|
|
80
|
-
mode: 'cloud',
|
|
81
|
-
description: 'This is an Engage specific action to send an SMS and Whatsapp messages using Twilio API',
|
|
82
|
-
authentication: {
|
|
83
|
-
scheme: 'custom',
|
|
84
|
-
fields: {
|
|
85
|
-
twilioAccountSID: {
|
|
86
|
-
label: 'Twilio Account SID',
|
|
87
|
-
description: 'Twilio Account SID',
|
|
88
|
-
type: 'string',
|
|
89
|
-
required: true
|
|
90
|
-
},
|
|
91
|
-
twilioApiKeySID: {
|
|
92
|
-
label: 'Twilio API Key SID',
|
|
93
|
-
description: 'Twilio API Key SID',
|
|
94
|
-
type: 'string',
|
|
95
|
-
required: true
|
|
96
|
-
},
|
|
97
|
-
twilioApiKeySecret: {
|
|
98
|
-
label: 'Twilio API Key Secret',
|
|
99
|
-
description: 'Twilio API Key Secret',
|
|
100
|
-
type: 'password',
|
|
101
|
-
required: true
|
|
102
|
-
},
|
|
103
|
-
profileApiEnvironment: {
|
|
104
|
-
label: 'Profile API Environment',
|
|
105
|
-
description: 'Profile API Environment',
|
|
106
|
-
type: 'string',
|
|
107
|
-
required: true
|
|
108
|
-
},
|
|
109
|
-
profileApiAccessToken: {
|
|
110
|
-
label: 'Profile API Access Token',
|
|
111
|
-
description: 'Profile API Access Token',
|
|
112
|
-
type: 'password',
|
|
113
|
-
required: true
|
|
114
|
-
},
|
|
115
|
-
spaceId: {
|
|
116
|
-
label: 'Space ID',
|
|
117
|
-
description: 'Space ID',
|
|
118
|
-
type: 'string',
|
|
119
|
-
required: true
|
|
120
|
-
},
|
|
121
|
-
sourceId: {
|
|
122
|
-
label: 'Source ID',
|
|
123
|
-
description: 'Source ID',
|
|
124
|
-
type: 'string',
|
|
125
|
-
required: true
|
|
126
|
-
},
|
|
127
|
-
webhookUrl: {
|
|
128
|
-
label: 'Webhook URL',
|
|
129
|
-
description: 'Webhook URL that will receive all events for the sent message',
|
|
130
|
-
type: 'string',
|
|
131
|
-
format: 'uri',
|
|
132
|
-
required: false
|
|
133
|
-
},
|
|
134
|
-
twilioHostname: {
|
|
135
|
-
label: 'Twilio host name',
|
|
136
|
-
description: 'Overrides the default Twilio host name used mainly for testing without having to send real messages.',
|
|
137
|
-
type: 'string',
|
|
138
|
-
default: 'api.twilio.com',
|
|
139
|
-
required: false
|
|
140
|
-
},
|
|
141
|
-
connectionOverrides: {
|
|
142
|
-
label: 'Connection Overrides',
|
|
143
|
-
description: 'Connection overrides are configuration supported by twilio webhook services. Must be passed as fragments on the callback url',
|
|
144
|
-
type: 'string',
|
|
145
|
-
required: false,
|
|
146
|
-
default: 'rp=all&rc=5',
|
|
147
|
-
properties: ConnectionOverridesProperties
|
|
148
|
-
},
|
|
149
|
-
region: {
|
|
150
|
-
label: 'Region',
|
|
151
|
-
description: 'The region where the message is originating from',
|
|
152
|
-
type: 'string',
|
|
153
|
-
choices: [
|
|
154
|
-
{ value: 'us-west-2', label: 'US West 2' },
|
|
155
|
-
{ value: 'eu-west-1', label: 'EU West 1' }
|
|
156
|
-
],
|
|
157
|
-
default: 'us-west-2',
|
|
158
|
-
required: false
|
|
159
|
-
}
|
|
160
|
-
},
|
|
161
|
-
testAuthentication: (request, options) => {
|
|
162
|
-
const hostName = options.settings.twilioHostname ?? 'api.twilio.com';
|
|
163
|
-
return request(`https://${hostName}/2010-04-01`);
|
|
164
|
-
}
|
|
165
|
-
},
|
|
166
|
-
actions: {
|
|
167
|
-
sendSms: sendSms_1.actionDefinition,
|
|
168
|
-
sendWhatsApp: sendWhatsApp_1.actionDefinition,
|
|
169
|
-
sendMobilePush: sendMobilePush_1.actionDefinition
|
|
170
|
-
}
|
|
12
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
13
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
171
14
|
};
|
|
172
|
-
exports
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
const twilio_1 = __importDefault(require("../engage/twilio"));
|
|
17
|
+
exports.default = twilio_1.default;
|
|
18
|
+
__exportStar(require("../engage/twilio"), exports);
|
|
173
19
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/engage-messaging-twilio/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/engage-messaging-twilio/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAQA,8DAA0C;AAC1C,kBAAe,gBAAW,CAAA;AAC1B,mDAAgC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RequestClient, DynamicFieldResponse } from '@segment/actions-core';
|
|
2
2
|
import { Settings } from './generated-types';
|
|
3
|
-
import { ImportJobPayload, SubscribeProfile, SubscribeEventData, UnsubscribeProfile, UnsubscribeEventData } from './types';
|
|
3
|
+
import { ImportJobPayload, SubscribeProfile, SubscribeEventData, UnsubscribeProfile, UnsubscribeEventData, GroupedProfiles } from './types';
|
|
4
4
|
import { Payload } from './upsertProfile/generated-types';
|
|
5
5
|
export declare function getListIdDynamicData(request: RequestClient): Promise<DynamicFieldResponse>;
|
|
6
6
|
export declare function addProfileToList(request: RequestClient, id: string, list_id: string | undefined): Promise<import("@segment/actions-core").ModifiedResponse<unknown>>;
|
|
@@ -37,3 +37,5 @@ export declare function createList(request: RequestClient, settings: Settings, l
|
|
|
37
37
|
name: any;
|
|
38
38
|
};
|
|
39
39
|
}>;
|
|
40
|
+
export declare function groupByListId(profiles: Payload[]): GroupedProfiles;
|
|
41
|
+
export declare function processProfilesByGroup(request: RequestClient, groupedProfiles: GroupedProfiles): Promise<import("@segment/actions-core").ModifiedResponse<unknown>[]>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createList = exports.getList = exports.formatUnsubscribeProfile = exports.formatUnsubscribeRequestBody = exports.formatSubscribeRequestBody = exports.formatSubscribeProfile = exports.getProfiles = exports.sendImportJobRequest = exports.createImportJobPayload = exports.buildHeaders = exports.createProfile = exports.removeProfileFromList = exports.addProfileToList = exports.getListIdDynamicData = void 0;
|
|
3
|
+
exports.processProfilesByGroup = exports.groupByListId = exports.createList = exports.getList = exports.formatUnsubscribeProfile = exports.formatUnsubscribeRequestBody = exports.formatSubscribeRequestBody = exports.formatSubscribeProfile = exports.getProfiles = exports.sendImportJobRequest = exports.createImportJobPayload = exports.buildHeaders = exports.createProfile = exports.removeProfileFromList = exports.addProfileToList = exports.getListIdDynamicData = void 0;
|
|
4
4
|
const actions_core_1 = require("@segment/actions-core");
|
|
5
5
|
const config_1 = require("./config");
|
|
6
6
|
async function getListIdDynamicData(request) {
|
|
@@ -95,7 +95,7 @@ const createImportJobPayload = (profiles, listId) => ({
|
|
|
95
95
|
type: 'profile-bulk-import-job',
|
|
96
96
|
attributes: {
|
|
97
97
|
profiles: {
|
|
98
|
-
data: profiles.map(({ list_id, enable_batching, batch_size, ...attributes }) => ({
|
|
98
|
+
data: profiles.map(({ list_id, enable_batching, batch_size, override_list_id, ...attributes }) => ({
|
|
99
99
|
type: 'profile',
|
|
100
100
|
attributes
|
|
101
101
|
}))
|
|
@@ -296,4 +296,25 @@ async function createList(request, settings, listName) {
|
|
|
296
296
|
};
|
|
297
297
|
}
|
|
298
298
|
exports.createList = createList;
|
|
299
|
+
function groupByListId(profiles) {
|
|
300
|
+
const grouped = {};
|
|
301
|
+
for (const profile of profiles) {
|
|
302
|
+
const listId = profile.override_list_id || profile.list_id;
|
|
303
|
+
if (!grouped[listId]) {
|
|
304
|
+
grouped[listId] = [];
|
|
305
|
+
}
|
|
306
|
+
grouped[listId].push(profile);
|
|
307
|
+
}
|
|
308
|
+
return grouped;
|
|
309
|
+
}
|
|
310
|
+
exports.groupByListId = groupByListId;
|
|
311
|
+
async function processProfilesByGroup(request, groupedProfiles) {
|
|
312
|
+
const importResponses = await Promise.all(Object.keys(groupedProfiles).map(async (listId) => {
|
|
313
|
+
const profiles = groupedProfiles[listId];
|
|
314
|
+
const importJobPayload = exports.createImportJobPayload(profiles, listId);
|
|
315
|
+
return await exports.sendImportJobRequest(request, importJobPayload);
|
|
316
|
+
}));
|
|
317
|
+
return importResponses;
|
|
318
|
+
}
|
|
319
|
+
exports.processProfilesByGroup = processProfilesByGroup;
|
|
299
320
|
//# sourceMappingURL=functions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../../../src/destinations/klaviyo/functions.ts"],"names":[],"mappings":";;;AAAA,wDAM8B;AAC9B,qCAAiD;
|
|
1
|
+
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../../../src/destinations/klaviyo/functions.ts"],"names":[],"mappings":";;;AAAA,wDAM8B;AAC9B,qCAAiD;AAkB1C,KAAK,UAAU,oBAAoB,CAAC,OAAsB;IAC/D,IAAI;QACF,MAAM,MAAM,GAAmB,MAAM,OAAO,CAAC,GAAG,gBAAO,SAAS,EAAE;YAChE,MAAM,EAAE,KAAK;SACd,CAAC,CAAA;QACF,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAkD,EAAE,EAAE;YACzG,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,CAAA;QACxD,CAAC,CAAC,CAAA;QACF,OAAO;YACL,OAAO;SACR,CAAA;KACF;IAAC,OAAO,GAAG,EAAE;QACZ,OAAO;YACL,OAAO,EAAE,EAAE;Y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AAM,CAAC,EAAE;YACpB,OAAO,CAAC,MAAM,CAAC,GAAG,EAAE,CAAA;SACrB;QACD,OAAO,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;KAC9B;IAED,OAAO,OAAO,CAAA;AAChB,CAAC;AAZD,sCAYC;AAEM,KAAK,UAAU,sBAAsB,CAAC,OAAsB,EAAE,eAAgC;IACnG,MAAM,eAAe,GAAG,MAAM,OAAO,CAAC,GAAG,CACvC,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE;QAChD,MAAM,QAAQ,GAAG,eAAe,CAAC,MAAM,CAAC,CAAA;QACxC,MAAM,gBAAgB,GAAG,8BAAsB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAA;QACjE,OAAO,MAAM,4BAAoB,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAA;IAC9D,CAAC,CAAC,CACH,CAAA;IACD,OAAO,eAAe,CAAA;AACxB,CAAC;AATD,wDASC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { HTTPError } from '@segment/actions-core';
|
|
2
|
+
import { Payload } from './upsertProfile/generated-types';
|
|
2
3
|
export declare class KlaviyoAPIError extends HTTPError {
|
|
3
4
|
response: Response & {
|
|
4
5
|
data: {
|
|
@@ -193,3 +194,6 @@ export interface UnsubscribeEventData {
|
|
|
193
194
|
};
|
|
194
195
|
};
|
|
195
196
|
}
|
|
197
|
+
export interface GroupedProfiles {
|
|
198
|
+
[listId: string]: Payload[];
|
|
199
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/destinations/klaviyo/types.ts"],"names":[],"mappings":";;;AAAA,wDAAiD;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/destinations/klaviyo/types.ts"],"names":[],"mappings":";;;AAAA,wDAAiD;AAEjD,MAAa,eAAgB,SAAQ,wBAAS;CAmB7C;AAnBD,0CAmBC"}
|
|
@@ -23,16 +23,5 @@ export interface Payload {
|
|
|
23
23
|
};
|
|
24
24
|
list_id?: string;
|
|
25
25
|
batch_size?: number;
|
|
26
|
-
|
|
27
|
-
export interface HookBundle {
|
|
28
|
-
retlOnMappingSave: {
|
|
29
|
-
inputs?: {
|
|
30
|
-
list_identifier?: string;
|
|
31
|
-
list_name?: string;
|
|
32
|
-
};
|
|
33
|
-
outputs?: {
|
|
34
|
-
id?: string;
|
|
35
|
-
name?: string;
|
|
36
|
-
};
|
|
37
|
-
};
|
|
26
|
+
override_list_id?: string;
|
|
38
27
|
}
|
|
@@ -129,76 +129,15 @@ const action = {
|
|
|
129
129
|
description: `The Klaviyo list to add the profile to.`,
|
|
130
130
|
type: 'string',
|
|
131
131
|
dynamic: true,
|
|
132
|
-
default: ''
|
|
133
|
-
unsafe_hidden: true
|
|
132
|
+
default: ''
|
|
134
133
|
},
|
|
135
|
-
batch_size: { ...properties_1.batch_size }
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
list_identifier: {
|
|
143
|
-
type: 'string',
|
|
144
|
-
label: 'Existing List ID',
|
|
145
|
-
description: 'The ID of the Klaviyo List that users will be synced to. If defined, we will not create a new list.',
|
|
146
|
-
required: false,
|
|
147
|
-
dynamic: async (request) => {
|
|
148
|
-
return functions_1.getListIdDynamicData(request);
|
|
149
|
-
}
|
|
150
|
-
},
|
|
151
|
-
list_name: {
|
|
152
|
-
type: 'string',
|
|
153
|
-
label: 'List Name',
|
|
154
|
-
description: 'The name of the Klaviyo List that you would like to create.',
|
|
155
|
-
required: false
|
|
156
|
-
}
|
|
157
|
-
},
|
|
158
|
-
outputTypes: {
|
|
159
|
-
id: {
|
|
160
|
-
type: 'string',
|
|
161
|
-
label: 'ID',
|
|
162
|
-
description: 'The ID of the created Klaviyo List that users will be synced to.',
|
|
163
|
-
required: false
|
|
164
|
-
},
|
|
165
|
-
name: {
|
|
166
|
-
type: 'string',
|
|
167
|
-
label: 'List Name',
|
|
168
|
-
description: 'The name of the created Klaviyo List that users will be synced to.',
|
|
169
|
-
required: false
|
|
170
|
-
}
|
|
171
|
-
},
|
|
172
|
-
performHook: async (request, { settings, hookInputs }) => {
|
|
173
|
-
if (hookInputs.list_identifier) {
|
|
174
|
-
try {
|
|
175
|
-
return functions_1.getList(request, settings, hookInputs.list_identifier);
|
|
176
|
-
}
|
|
177
|
-
catch (e) {
|
|
178
|
-
const message = e.message || JSON.stringify(e) || 'Failed to get list';
|
|
179
|
-
const code = e.code || 'GET_LIST_FAILURE';
|
|
180
|
-
return {
|
|
181
|
-
error: {
|
|
182
|
-
message,
|
|
183
|
-
code
|
|
184
|
-
}
|
|
185
|
-
};
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
try {
|
|
189
|
-
return functions_1.createList(request, settings, hookInputs.list_name);
|
|
190
|
-
}
|
|
191
|
-
catch (e) {
|
|
192
|
-
const message = e.message || JSON.stringify(e) || 'Failed to create list';
|
|
193
|
-
const code = e.code || 'CREATE_LIST_FAILURE';
|
|
194
|
-
return {
|
|
195
|
-
error: {
|
|
196
|
-
message,
|
|
197
|
-
code
|
|
198
|
-
}
|
|
199
|
-
};
|
|
200
|
-
}
|
|
201
|
-
}
|
|
134
|
+
batch_size: { ...properties_1.batch_size },
|
|
135
|
+
override_list_id: {
|
|
136
|
+
unsafe_hidden: true,
|
|
137
|
+
label: 'List ID Override',
|
|
138
|
+
description: 'Klaviyo list ID to override the default list ID when provided in an event payload. Added to support backward compatibility with klaviyo(classic) and facilitate a seamless migration.',
|
|
139
|
+
type: 'string',
|
|
140
|
+
default: { '@path': '$.traits.integrations.Klaviyo.listId' }
|
|
202
141
|
}
|
|
203
142
|
},
|
|
204
143
|
dynamicFields: {
|
|
@@ -206,9 +145,9 @@ const action = {
|
|
|
206
145
|
return functions_1.getListIdDynamicData(request);
|
|
207
146
|
}
|
|
208
147
|
},
|
|
209
|
-
perform: async (request, { payload
|
|
210
|
-
const { email, external_id, phone_number, enable_batching, batch_size, ...otherAttributes } = payload;
|
|
211
|
-
const list_id =
|
|
148
|
+
perform: async (request, { payload }) => {
|
|
149
|
+
const { email, external_id, phone_number, enable_batching, batch_size, list_id: otherListId, override_list_id, ...otherAttributes } = payload;
|
|
150
|
+
const list_id = override_list_id || otherListId;
|
|
212
151
|
if (!email && !phone_number && !external_id) {
|
|
213
152
|
throw new actions_core_1.PayloadValidationError('One of External ID, Phone Number and Email is required.');
|
|
214
153
|
}
|
|
@@ -255,22 +194,15 @@ const action = {
|
|
|
255
194
|
throw error;
|
|
256
195
|
}
|
|
257
196
|
},
|
|
258
|
-
performBatch: async (request, { payload
|
|
197
|
+
performBatch: async (request, { payload }) => {
|
|
259
198
|
payload = payload.filter((profile) => profile.email || profile.external_id || profile.phone_number);
|
|
260
|
-
|
|
261
|
-
if (!profile.list_id && hookOutputs?.retlOnMappingSave.outputs.id) {
|
|
262
|
-
return { ...profile, list_id: hookOutputs?.retlOnMappingSave.outputs.idd };
|
|
263
|
-
}
|
|
264
|
-
return profile;
|
|
265
|
-
});
|
|
266
|
-
const profilesWithList = payload.filter((profile) => profile.list_id);
|
|
199
|
+
const profilesWithList = payload.filter((profile) => profile.list_id || profile.override_list_id);
|
|
267
200
|
const profilesWithoutList = payload.filter((profile) => !profile.list_id);
|
|
268
201
|
let importResponseWithList;
|
|
269
202
|
let importResponseWithoutList;
|
|
270
203
|
if (profilesWithList.length > 0) {
|
|
271
|
-
const
|
|
272
|
-
|
|
273
|
-
importResponseWithList = await functions_1.sendImportJobRequest(request, importJobPayload);
|
|
204
|
+
const groupedByListId = functions_1.groupByListId(profilesWithList);
|
|
205
|
+
importResponseWithList = await functions_1.processProfilesByGroup(request, groupedByListId);
|
|
274
206
|
}
|
|
275
207
|
if (profilesWithoutList.length > 0) {
|
|
276
208
|
const importJobPayload = functions_1.createImportJobPayload(profilesWithoutList);
|