@segment/action-destinations 3.387.0 → 3.388.0
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/amazon-amc/function.js +8 -8
- package/dist/destinations/amazon-amc/function.js.map +1 -1
- package/dist/destinations/amazon-amc/index.js +9 -0
- package/dist/destinations/amazon-amc/index.js.map +1 -1
- package/dist/destinations/aws-s3/index.js +7 -0
- package/dist/destinations/aws-s3/index.js.map +1 -1
- package/dist/destinations/customerio/index.js +11 -1
- package/dist/destinations/customerio/index.js.map +1 -1
- package/dist/destinations/customerio/reportContentEvent/generated-types.d.ts +9 -0
- package/dist/destinations/customerio/reportContentEvent/generated-types.js +3 -0
- package/dist/destinations/customerio/reportContentEvent/generated-types.js.map +1 -0
- package/dist/destinations/customerio/reportContentEvent/index.d.ts +5 -0
- package/dist/destinations/customerio/reportContentEvent/index.js +77 -0
- package/dist/destinations/customerio/reportContentEvent/index.js.map +1 -0
- package/dist/destinations/delivrai-activate/index.js +10 -1
- package/dist/destinations/delivrai-activate/index.js.map +1 -1
- package/dist/destinations/delivrai-activate/utils-rt.js +1 -1
- package/dist/destinations/delivrai-activate/utils-rt.js.map +1 -1
- package/dist/destinations/display-video-360/index.js +7 -0
- package/dist/destinations/display-video-360/index.js.map +1 -1
- package/dist/destinations/drip/identify/index.js +2 -1
- package/dist/destinations/drip/identify/index.js.map +1 -1
- package/dist/destinations/dub/config.d.ts +1 -0
- package/dist/destinations/dub/config.js +5 -0
- package/dist/destinations/dub/config.js.map +1 -0
- package/dist/destinations/dub/generated-types.d.ts +3 -0
- package/dist/destinations/dub/generated-types.js +3 -0
- package/dist/destinations/dub/generated-types.js.map +1 -0
- package/dist/destinations/dub/index.d.ts +4 -0
- package/dist/destinations/dub/index.js +38 -0
- package/dist/destinations/dub/index.js.map +1 -0
- package/dist/destinations/dub/trackLead/generated-types.d.ts +12 -0
- package/dist/destinations/dub/trackLead/generated-types.js +3 -0
- package/dist/destinations/dub/trackLead/generated-types.js.map +1 -0
- package/dist/destinations/dub/trackLead/index.d.ts +5 -0
- package/dist/destinations/dub/trackLead/index.js +118 -0
- package/dist/destinations/dub/trackLead/index.js.map +1 -0
- package/dist/destinations/dub/trackLead/types.d.ts +21 -0
- package/dist/destinations/dub/trackLead/types.js +3 -0
- package/dist/destinations/dub/trackLead/types.js.map +1 -0
- package/dist/destinations/dub/trackSale/generated-types.d.ts +12 -0
- package/dist/destinations/dub/trackSale/generated-types.js +3 -0
- package/dist/destinations/dub/trackSale/generated-types.js.map +1 -0
- package/dist/destinations/dub/trackSale/index.d.ts +5 -0
- package/dist/destinations/dub/trackSale/index.js +84 -0
- package/dist/destinations/dub/trackSale/index.js.map +1 -0
- package/dist/destinations/dynamic-yield-audiences/helpers.js +2 -2
- package/dist/destinations/dynamic-yield-audiences/helpers.js.map +1 -1
- package/dist/destinations/dynamic-yield-audiences/index.js +9 -0
- package/dist/destinations/dynamic-yield-audiences/index.js.map +1 -1
- package/dist/destinations/dynamic-yield-audiences/syncAudience/index.js +1 -1
- package/dist/destinations/dynamic-yield-audiences/syncAudience/index.js.map +1 -1
- package/dist/destinations/eagleeye/generated-types.d.ts +4 -0
- package/dist/destinations/eagleeye/generated-types.js +3 -0
- package/dist/destinations/eagleeye/generated-types.js.map +1 -0
- package/dist/destinations/eagleeye/index.d.ts +4 -0
- package/dist/destinations/eagleeye/index.js +35 -0
- package/dist/destinations/eagleeye/index.js.map +1 -0
- package/dist/destinations/eagleeye/triggerBehavioralAction/generated-types.d.ts +5 -0
- package/dist/destinations/eagleeye/triggerBehavioralAction/generated-types.js +3 -0
- package/dist/destinations/eagleeye/triggerBehavioralAction/generated-types.js.map +1 -0
- package/dist/destinations/eagleeye/triggerBehavioralAction/index.d.ts +5 -0
- package/dist/destinations/eagleeye/triggerBehavioralAction/index.js +56 -0
- package/dist/destinations/eagleeye/triggerBehavioralAction/index.js.map +1 -0
- package/dist/destinations/eagleeye/triggerBehavioralAction/types.d.ts +12 -0
- package/dist/destinations/eagleeye/triggerBehavioralAction/types.js +3 -0
- package/dist/destinations/eagleeye/triggerBehavioralAction/types.js.map +1 -0
- package/dist/destinations/facebook-conversions-api/fb-capi-user-data.js +2 -2
- package/dist/destinations/facebook-conversions-api/fb-capi-user-data.js.map +1 -1
- package/dist/destinations/facebook-custom-audiences/fbca-operations.js +1 -1
- package/dist/destinations/facebook-custom-audiences/fbca-operations.js.map +1 -1
- package/dist/destinations/facebook-custom-audiences/index.js +7 -0
- package/dist/destinations/facebook-custom-audiences/index.js.map +1 -1
- package/dist/destinations/facebook-custom-audiences/sync/generated-types.d.ts +1 -0
- package/dist/destinations/facebook-custom-audiences/sync/index.js +11 -2
- package/dist/destinations/facebook-custom-audiences/sync/index.js.map +1 -1
- package/dist/destinations/first-party-dv360/functions.js +1 -1
- package/dist/destinations/first-party-dv360/functions.js.map +1 -1
- package/dist/destinations/first-party-dv360/index.js +7 -0
- package/dist/destinations/first-party-dv360/index.js.map +1 -1
- package/dist/destinations/google-campaign-manager-360/utils.js +7 -7
- package/dist/destinations/google-campaign-manager-360/utils.js.map +1 -1
- package/dist/destinations/google-enhanced-conversions/functions.d.ts +1 -1
- package/dist/destinations/google-enhanced-conversions/functions.js +9 -9
- package/dist/destinations/google-enhanced-conversions/functions.js.map +1 -1
- package/dist/destinations/google-enhanced-conversions/index.js +7 -0
- package/dist/destinations/google-enhanced-conversions/index.js.map +1 -1
- package/dist/destinations/google-enhanced-conversions/uploadCallConversion/index.js +2 -2
- package/dist/destinations/google-enhanced-conversions/uploadCallConversion2/index.js +2 -2
- package/dist/destinations/google-enhanced-conversions/uploadClickConversion/index.js +6 -6
- package/dist/destinations/google-enhanced-conversions/uploadClickConversion/index.js.map +1 -1
- package/dist/destinations/google-enhanced-conversions/uploadClickConversion2/index.js +6 -6
- package/dist/destinations/google-enhanced-conversions/uploadClickConversion2/index.js.map +1 -1
- package/dist/destinations/google-enhanced-conversions/uploadConversionAdjustment/index.js +10 -10
- package/dist/destinations/google-enhanced-conversions/uploadConversionAdjustment/index.js.map +1 -1
- package/dist/destinations/google-enhanced-conversions/uploadConversionAdjustment2/index.js +10 -10
- package/dist/destinations/google-enhanced-conversions/uploadConversionAdjustment2/index.js.map +1 -1
- package/dist/destinations/google-enhanced-conversions/userList/index.js +3 -3
- package/dist/destinations/google-enhanced-conversions/userList/index.js.map +1 -1
- package/dist/destinations/hubspot/upsertObject/constants.js +2 -1
- package/dist/destinations/hubspot/upsertObject/constants.js.map +1 -1
- package/dist/destinations/index.js +3 -0
- package/dist/destinations/index.js.map +1 -1
- package/dist/destinations/iterable/index.js +12 -0
- package/dist/destinations/iterable/index.js.map +1 -1
- package/dist/destinations/iterable-lists/index.js +8 -1
- package/dist/destinations/iterable-lists/index.js.map +1 -1
- package/dist/destinations/klaviyo/addProfileToList/index.js +1 -1
- package/dist/destinations/klaviyo/addProfileToList/index.js.map +1 -1
- package/dist/destinations/klaviyo/index.js +7 -0
- package/dist/destinations/klaviyo/index.js.map +1 -1
- package/dist/destinations/linkedin-audiences/updateAudience/index.js +1 -1
- package/dist/destinations/linkedin-audiences/updateAudience/index.js.map +1 -1
- package/dist/destinations/linkedin-conversions/api/index.js +1 -1
- package/dist/destinations/linkedin-conversions/api/index.js.map +1 -1
- package/dist/destinations/liveramp-audiences/operations.js +2 -2
- package/dist/destinations/liveramp-audiences/operations.js.map +1 -1
- package/dist/destinations/marketo-static-lists/addToList/index.js +1 -1
- package/dist/destinations/marketo-static-lists/addToList/index.js.map +1 -1
- package/dist/destinations/marketo-static-lists/index.js +7 -0
- package/dist/destinations/marketo-static-lists/index.js.map +1 -1
- package/dist/destinations/mixpanel/mixpanel-properties.js +2 -2
- package/dist/destinations/mixpanel/mixpanel-properties.js.map +1 -1
- package/dist/destinations/ortto/common-fields.d.ts +2 -0
- package/dist/destinations/ortto/common-fields.js +217 -0
- package/dist/destinations/ortto/common-fields.js.map +1 -0
- package/dist/destinations/ortto/generated-types.d.ts +3 -0
- package/dist/destinations/ortto/generated-types.js +3 -0
- package/dist/destinations/ortto/generated-types.js.map +1 -0
- package/dist/destinations/ortto/index.d.ts +4 -0
- package/dist/destinations/ortto/index.js +55 -0
- package/dist/destinations/ortto/index.js.map +1 -0
- package/dist/destinations/ortto/ortto-client.d.ts +20 -0
- package/dist/destinations/ortto/ortto-client.js +160 -0
- package/dist/destinations/ortto/ortto-client.js.map +1 -0
- package/dist/destinations/ortto/trackActivity/generated-types.d.ts +34 -0
- package/dist/destinations/ortto/trackActivity/generated-types.js +3 -0
- package/dist/destinations/ortto/trackActivity/generated-types.js.map +1 -0
- package/dist/destinations/ortto/trackActivity/index.d.ts +5 -0
- package/dist/destinations/ortto/trackActivity/index.js +119 -0
- package/dist/destinations/ortto/trackActivity/index.js.map +1 -0
- package/dist/destinations/ortto/types.d.ts +16 -0
- package/dist/destinations/ortto/types.js +5 -0
- package/dist/destinations/ortto/types.js.map +1 -0
- package/dist/destinations/ortto/upsertContactProfile/generated-types.d.ts +29 -0
- package/dist/destinations/ortto/upsertContactProfile/generated-types.js +3 -0
- package/dist/destinations/ortto/upsertContactProfile/generated-types.js.map +1 -0
- package/dist/destinations/ortto/upsertContactProfile/index.d.ts +5 -0
- package/dist/destinations/ortto/upsertContactProfile/index.js +85 -0
- package/dist/destinations/ortto/upsertContactProfile/index.js.map +1 -0
- package/dist/destinations/ortto/utils.d.ts +1 -0
- package/dist/destinations/ortto/utils.js +10 -0
- package/dist/destinations/ortto/utils.js.map +1 -0
- package/dist/destinations/pinterest-conversions/pinterset-capi-user-data.js +12 -12
- package/dist/destinations/pinterest-conversions/pinterset-capi-user-data.js.map +1 -1
- package/dist/destinations/podscribe/track/index.js +1 -1
- package/dist/destinations/podscribe/track/index.js.map +1 -1
- package/dist/destinations/reddit-audiences/index.js +7 -0
- package/dist/destinations/reddit-audiences/index.js.map +1 -1
- package/dist/destinations/reddit-audiences/syncAudience/index.js +7 -3
- package/dist/destinations/reddit-audiences/syncAudience/index.js.map +1 -1
- package/dist/destinations/reddit-conversions-api/utils.js +1 -1
- package/dist/destinations/reddit-conversions-api/utils.js.map +1 -1
- package/dist/destinations/sendgrid-audiences/index.js +8 -1
- package/dist/destinations/sendgrid-audiences/index.js.map +1 -1
- package/dist/destinations/sendgrid-audiences/syncAudience/index.js +4 -4
- package/dist/destinations/sendgrid-audiences/syncAudience/index.js.map +1 -1
- package/dist/destinations/snap-audiences/index.js +7 -0
- package/dist/destinations/snap-audiences/index.js.map +1 -1
- package/dist/destinations/snap-audiences/syncAudience/index.js +1 -1
- package/dist/destinations/snap-audiences/syncAudience/index.js.map +1 -1
- package/dist/destinations/snap-audiences/syncAudience/utils.js +3 -3
- package/dist/destinations/snap-audiences/syncAudience/utils.js.map +1 -1
- package/dist/destinations/snap-conversions-api/reportConversionEvent/snap-capi-v3.js +1 -1
- package/dist/destinations/snap-conversions-api/reportConversionEvent/snap-capi-v3.js.map +1 -1
- package/dist/destinations/snap-conversions-api/reportConversionEvent/utils.js +1 -1
- package/dist/destinations/snap-conversions-api/reportConversionEvent/utils.js.map +1 -1
- package/dist/destinations/stackadapt-audiences/forwardAudienceEvent/functions.js +11 -11
- package/dist/destinations/stackadapt-audiences/forwardAudienceEvent/functions.js.map +1 -1
- package/dist/destinations/stackadapt-audiences/forwardProfile/functions.js +5 -5
- package/dist/destinations/stackadapt-audiences/forwardProfile/functions.js.map +1 -1
- package/dist/destinations/taboola-actions/index.js +7 -0
- package/dist/destinations/taboola-actions/index.js.map +1 -1
- package/dist/destinations/taboola-actions/syncAudience/index.js +5 -2
- package/dist/destinations/taboola-actions/syncAudience/index.js.map +1 -1
- package/dist/destinations/tiktok-audiences/functions.js +1 -1
- package/dist/destinations/tiktok-audiences/functions.js.map +1 -1
- package/dist/destinations/tiktok-audiences/index.js +7 -0
- package/dist/destinations/tiktok-audiences/index.js.map +1 -1
- package/dist/destinations/tiktok-conversions/formatter.js +1 -1
- package/dist/destinations/tiktok-conversions/formatter.js.map +1 -1
- package/dist/destinations/tiktok-offline-conversions/formatter.js +1 -1
- package/dist/destinations/tiktok-offline-conversions/formatter.js.map +1 -1
- package/dist/destinations/webhook-audiences/index.js +7 -0
- package/dist/destinations/webhook-audiences/index.js.map +1 -1
- package/dist/destinations/yahoo-audiences/index.js +8 -1
- package/dist/destinations/yahoo-audiences/index.js.map +1 -1
- package/dist/destinations/yahoo-audiences/utils-rt.js +1 -1
- package/dist/destinations/yahoo-audiences/utils-rt.js.map +1 -1
- package/dist/lib/hashing-utils.d.ts +1 -3
- package/dist/lib/hashing-utils.js +2 -35
- package/dist/lib/hashing-utils.js.map +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const actions_core_1 = require("@segment/actions-core");
|
|
7
|
+
const upsertContactProfile_1 = __importDefault(require("./upsertContactProfile"));
|
|
8
|
+
const ortto_client_1 = __importDefault(require("./ortto-client"));
|
|
9
|
+
const trackActivity_1 = __importDefault(require("./trackActivity"));
|
|
10
|
+
const destination = {
|
|
11
|
+
name: 'Ortto (Actions)',
|
|
12
|
+
slug: 'actions-ortto',
|
|
13
|
+
mode: 'cloud',
|
|
14
|
+
description: 'Send customer data from Segment to Ortto in real time to power campaigns, trigger journeys, and manage audiences with greater flexibility and control.',
|
|
15
|
+
authentication: {
|
|
16
|
+
scheme: 'custom',
|
|
17
|
+
fields: {
|
|
18
|
+
api_key: {
|
|
19
|
+
label: 'API Key',
|
|
20
|
+
description: 'Ortto API key',
|
|
21
|
+
type: 'password',
|
|
22
|
+
required: true
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
testAuthentication: async (request, { settings }) => {
|
|
26
|
+
const client = new ortto_client_1.default(request);
|
|
27
|
+
return await client.testAuth(settings);
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
extendRequest({ settings }) {
|
|
31
|
+
if (process?.env?.ORTTO_API_KEY) {
|
|
32
|
+
settings.api_key = process?.env?.ORTTO_API_KEY;
|
|
33
|
+
}
|
|
34
|
+
return {
|
|
35
|
+
headers: {
|
|
36
|
+
Authorization: `Bearer ${settings.api_key}`
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
},
|
|
40
|
+
presets: [
|
|
41
|
+
{
|
|
42
|
+
name: upsertContactProfile_1.default.title,
|
|
43
|
+
subscribe: 'type = "identify"',
|
|
44
|
+
partnerAction: 'upsertContactProfile',
|
|
45
|
+
mapping: (0, actions_core_1.defaultValues)(upsertContactProfile_1.default.fields),
|
|
46
|
+
type: 'automatic'
|
|
47
|
+
}
|
|
48
|
+
],
|
|
49
|
+
actions: {
|
|
50
|
+
upsertContactProfile: upsertContactProfile_1.default,
|
|
51
|
+
trackActivity: trackActivity_1.default
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
exports.default = destination;
|
|
55
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/ortto/index.ts"],"names":[],"mappings":";;;;;AAAA,wDAA4E;AAE5E,kFAAyD;AACzD,kEAAwC;AAExC,oEAA2C;AAE3C,MAAM,WAAW,GAAoC;IACnD,IAAI,EAAE,iBAAiB;IACvB,IAAI,EAAE,eAAe;IACrB,IAAI,EAAE,OAAO;IACb,WAAW,EACT,wJAAwJ;IAC1J,cAAc,EAAE;QACd,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE;YACN,OAAO,EAAE;gBACP,KAAK,EAAE,SAAS;gBAChB,WAAW,EAAE,eAAe;gBAC5B,IAAI,EAAE,UAAU;gBAChB,QAAQ,EAAE,IAAI;aACf;SACF;QACD,kBAAkB,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE;YAClD,MAAM,MAAM,GAAgB,IAAI,sBAAW,CAAC,OAAO,CAAC,CAAA;YACpD,OAAO,MAAM,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;QACxC,CAAC;KACF;IACD,aAAa,CAAC,EAAE,QAAQ,EAAE;QACxB,IAAI,OAAO,EAAE,GAAG,EAAE,aAAa,EAAE;YAC/B,QAAQ,CAAC,OAAO,GAAG,OAAO,EAAE,GAAG,EAAE,aAAa,CAAA;SAC/C;QACD,OAAO;YACL,OAAO,EAAE;gBACP,aAAa,EAAE,UAAU,QAAQ,CAAC,OAAO,EAAE;aAC5C;SACF,CAAA;IACH,CAAC;IACD,OAAO,EAAE;QACP;YACE,IAAI,EAAE,8BAAoB,CAAC,KAAK;YAChC,SAAS,EAAE,mBAAmB;YAC9B,aAAa,EAAE,sBAAsB;YACrC,OAAO,EAAE,IAAA,4BAAa,EAAC,8BAAoB,CAAC,MAAM,CAAC;YACnD,IAAI,EAAE,WAAW;SAClB;KACF;IACD,OAAO,EAAE;QACP,oBAAoB,EAApB,8BAAoB;QACpB,aAAa,EAAb,uBAAa;KACd;CACF,CAAA;AAED,kBAAe,WAAW,CAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { RequestClient, MultiStatusResponse } from '@segment/actions-core';
|
|
2
|
+
import { Settings } from './generated-types';
|
|
3
|
+
import { Payload as UpsertContactPayload } from './upsertContactProfile/generated-types';
|
|
4
|
+
import { Payload as EventPayload } from './trackActivity/generated-types';
|
|
5
|
+
import { Audience } from './types';
|
|
6
|
+
export declare const API_VERSION = "v1";
|
|
7
|
+
export declare const Success: {
|
|
8
|
+
status: number;
|
|
9
|
+
body: string;
|
|
10
|
+
};
|
|
11
|
+
export declare const Errors: Record<string, string>;
|
|
12
|
+
export default class OrttoClient {
|
|
13
|
+
request: RequestClient;
|
|
14
|
+
constructor(request: RequestClient);
|
|
15
|
+
upsertContacts: (settings: Settings, payloads: UpsertContactPayload[], hookAudienceID: string) => Promise<MultiStatusResponse>;
|
|
16
|
+
sendActivities: (settings: Settings, payloads: EventPayload[], hookAudienceID: string) => Promise<MultiStatusResponse>;
|
|
17
|
+
testAuth: (settings: Settings) => Promise<import("@segment/actions-core").ModifiedResponse<unknown>>;
|
|
18
|
+
createAudience: (settings: Settings, audienceName: string) => Promise<Audience>;
|
|
19
|
+
private getEndpoint;
|
|
20
|
+
}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Errors = exports.Success = exports.API_VERSION = void 0;
|
|
4
|
+
const actions_core_1 = require("@segment/actions-core");
|
|
5
|
+
const utils_1 = require("./utils");
|
|
6
|
+
exports.API_VERSION = 'v1';
|
|
7
|
+
exports.Success = {
|
|
8
|
+
status: 200,
|
|
9
|
+
body: 'Processed successfully'
|
|
10
|
+
};
|
|
11
|
+
exports.Errors = {
|
|
12
|
+
InvalidAPIKey: `Invalid API key`,
|
|
13
|
+
MissingEventName: `Missing event name`,
|
|
14
|
+
MissingAudienceName: `Missing audience name`,
|
|
15
|
+
MissingAudienceId: `Missing audience Id`
|
|
16
|
+
};
|
|
17
|
+
class OrttoClient {
|
|
18
|
+
constructor(request) {
|
|
19
|
+
this.upsertContacts = async (settings, payloads, hookAudienceID) => {
|
|
20
|
+
const response = new actions_core_1.MultiStatusResponse();
|
|
21
|
+
const cleaned = [];
|
|
22
|
+
for (let i = 0; i < payloads.length; i++) {
|
|
23
|
+
const event = payloads[i];
|
|
24
|
+
const clean = (0, utils_1.cleanObject)(event);
|
|
25
|
+
if (hookAudienceID && (event.audience_update_mode === 'add' || event.audience_update_mode === 'remove')) {
|
|
26
|
+
clean.audience = {
|
|
27
|
+
mode: event.audience_update_mode,
|
|
28
|
+
id: hookAudienceID
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
cleaned.push(clean);
|
|
32
|
+
}
|
|
33
|
+
const url = this.getEndpoint(settings.api_key).concat('/identify');
|
|
34
|
+
const { data } = await this.request(url, {
|
|
35
|
+
method: 'POST',
|
|
36
|
+
json: cleaned
|
|
37
|
+
});
|
|
38
|
+
cleaned.forEach((payload, idx) => {
|
|
39
|
+
response.setSuccessResponseAtIndex(idx, {
|
|
40
|
+
...exports.Success,
|
|
41
|
+
sent: payload
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
if (data.errors) {
|
|
45
|
+
data.errors.forEach((err) => {
|
|
46
|
+
const { status, message, index } = err;
|
|
47
|
+
response.setErrorResponseAtIndex(index, {
|
|
48
|
+
status,
|
|
49
|
+
errormessage: message,
|
|
50
|
+
sent: cleaned[index]
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
return response;
|
|
55
|
+
};
|
|
56
|
+
this.sendActivities = async (settings, payloads, hookAudienceID) => {
|
|
57
|
+
const filtered = [];
|
|
58
|
+
const indexBitmap = [];
|
|
59
|
+
const response = new actions_core_1.MultiStatusResponse();
|
|
60
|
+
for (let i = 0; i < payloads.length; i++) {
|
|
61
|
+
const event = payloads[i];
|
|
62
|
+
const clean = (0, utils_1.cleanObject)(event);
|
|
63
|
+
if (!event.event || event.event.trim() === '') {
|
|
64
|
+
response.setErrorResponseAtIndex(i, {
|
|
65
|
+
status: 400,
|
|
66
|
+
sent: clean,
|
|
67
|
+
errortype: actions_core_1.ErrorCodes.PAYLOAD_VALIDATION_FAILED,
|
|
68
|
+
errormessage: exports.Errors.MissingEventName
|
|
69
|
+
});
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
if (event.namespace === 'ortto.com') {
|
|
73
|
+
response.setSuccessResponseAtIndex(i, {
|
|
74
|
+
status: 200,
|
|
75
|
+
sent: clean,
|
|
76
|
+
body: `${event.event} was originated from ${event.namespace} (Ignored)`
|
|
77
|
+
});
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
if (hookAudienceID && (event.audience_update_mode === 'add' || event.audience_update_mode === 'remove')) {
|
|
81
|
+
clean.audience = {
|
|
82
|
+
mode: event.audience_update_mode,
|
|
83
|
+
id: hookAudienceID
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
filtered.push(clean);
|
|
87
|
+
indexBitmap.push(i);
|
|
88
|
+
}
|
|
89
|
+
if (filtered.length == 0) {
|
|
90
|
+
return response;
|
|
91
|
+
}
|
|
92
|
+
const url = this.getEndpoint(settings.api_key).concat(`/track`);
|
|
93
|
+
const { data } = await this.request(url, {
|
|
94
|
+
method: 'POST',
|
|
95
|
+
json: filtered
|
|
96
|
+
});
|
|
97
|
+
filtered.forEach((payload, idx) => {
|
|
98
|
+
const originalIndex = indexBitmap[idx];
|
|
99
|
+
response.setSuccessResponseAtIndex(originalIndex, {
|
|
100
|
+
...exports.Success,
|
|
101
|
+
sent: payload
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
if (data.errors) {
|
|
105
|
+
data.errors.forEach((err) => {
|
|
106
|
+
const { status, message, index } = err;
|
|
107
|
+
const originalIndex = indexBitmap[index];
|
|
108
|
+
response.setErrorResponseAtIndex(originalIndex, {
|
|
109
|
+
status: status,
|
|
110
|
+
errormessage: message,
|
|
111
|
+
sent: filtered[index]
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
return response;
|
|
116
|
+
};
|
|
117
|
+
this.testAuth = async (settings) => {
|
|
118
|
+
const url = this.getEndpoint(settings.api_key).concat('/me');
|
|
119
|
+
return this.request(url, {
|
|
120
|
+
method: 'GET'
|
|
121
|
+
});
|
|
122
|
+
};
|
|
123
|
+
this.createAudience = async (settings, audienceName) => {
|
|
124
|
+
audienceName = audienceName?.trim();
|
|
125
|
+
if (!audienceName) {
|
|
126
|
+
throw new actions_core_1.PayloadValidationError(exports.Errors.MissingAudienceName);
|
|
127
|
+
}
|
|
128
|
+
const url = this.getEndpoint(settings.api_key).concat('/audiences/create');
|
|
129
|
+
const { data } = await this.request(url, {
|
|
130
|
+
method: 'POST',
|
|
131
|
+
json: { name: audienceName }
|
|
132
|
+
});
|
|
133
|
+
return data;
|
|
134
|
+
};
|
|
135
|
+
this.request = request;
|
|
136
|
+
}
|
|
137
|
+
getEndpoint(apiKey) {
|
|
138
|
+
if (process?.env?.ORTTO_LOCAL_ENDPOINT) {
|
|
139
|
+
return `${process?.env?.ORTTO_LOCAL_ENDPOINT}/${exports.API_VERSION}`;
|
|
140
|
+
}
|
|
141
|
+
if (!apiKey) {
|
|
142
|
+
throw new actions_core_1.InvalidAuthenticationError(exports.Errors.InvalidAPIKey);
|
|
143
|
+
}
|
|
144
|
+
const idx = apiKey.indexOf('-');
|
|
145
|
+
if (idx != 3) {
|
|
146
|
+
throw new actions_core_1.InvalidAuthenticationError(exports.Errors.InvalidAPIKey);
|
|
147
|
+
}
|
|
148
|
+
let env = '';
|
|
149
|
+
if (apiKey.charAt(0) == 's') {
|
|
150
|
+
env = '-stg';
|
|
151
|
+
}
|
|
152
|
+
const region = apiKey.substring(1, idx).trim();
|
|
153
|
+
if (region.length != 2) {
|
|
154
|
+
throw new actions_core_1.InvalidAuthenticationError(exports.Errors.InvalidAPIKey);
|
|
155
|
+
}
|
|
156
|
+
return `https://segment-action-api-${region}.ortto${env}.app/${exports.API_VERSION}`;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
exports.default = OrttoClient;
|
|
160
|
+
//# sourceMappingURL=ortto-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ortto-client.js","sourceRoot":"","sources":["../../../src/destinations/ortto/ortto-client.ts"],"names":[],"mappings":";;;AAAA,wDAO8B;AAI9B,mCAAqC;AAGxB,QAAA,WAAW,GAAG,IAAI,CAAA;AAClB,QAAA,OAAO,GAAG;IACrB,MAAM,EAAE,GAAG;IACX,IAAI,EAAE,wBAAwB;CAC/B,CAAA;AACY,QAAA,MAAM,GAA2B;IAC5C,aAAa,EAAE,iBAAiB;IAChC,gBAAgB,EAAE,oBAAoB;IACtC,mBAAmB,EAAE,uBAAuB;IAC5C,iBAAiB,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AAO,EAAE,GAAG,EAAE,oBAAoB,IAAI,mBAAW,EAAE,CAAA;SAC9D;QACD,IAAI,CAAC,MAAM,EAAE;YACX,MAAM,IAAI,yCAA0B,CAAC,cAAM,CAAC,aAAa,CAAC,CAAA;SAC3D;QACD,MAAM,GAAG,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;QAC/B,IAAI,GAAG,IAAI,CAAC,EAAE;YACZ,MAAM,IAAI,yCAA0B,CAAC,cAAM,CAAC,aAAa,CAAC,CAAA;SAC3D;QAED,IAAI,GAAG,GAAG,EAAE,CAAA;QACZ,IAAI,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,GAAG,EAAE;YAC3B,GAAG,GAAG,MAAM,CAAA;SACb;QACD,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAA;QAC9C,IAAI,MAAM,CAAC,MAAM,IAAI,CAAC,EAAE;YACtB,MAAM,IAAI,yCAA0B,CAAC,cAAM,CAAC,aAAa,CAAC,CAAA;SAC3D;QAED,OAAO,8BAA8B,MAAM,SAAS,GAAG,QAAQ,mBAAW,EAAE,CAAA;IAC9E,CAAC;CACF;AAtKD,8BAsKC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export interface Payload {
|
|
2
|
+
timestamp?: string;
|
|
3
|
+
message_id?: string;
|
|
4
|
+
user_id?: string;
|
|
5
|
+
anonymous_id?: string;
|
|
6
|
+
enable_batching?: boolean;
|
|
7
|
+
ip?: string | null;
|
|
8
|
+
location?: {
|
|
9
|
+
country?: string | null;
|
|
10
|
+
state?: string | null;
|
|
11
|
+
city?: string | null;
|
|
12
|
+
post_code?: string | null;
|
|
13
|
+
};
|
|
14
|
+
traits?: {
|
|
15
|
+
email?: string;
|
|
16
|
+
phone?: string;
|
|
17
|
+
first_name?: string;
|
|
18
|
+
last_name?: string;
|
|
19
|
+
};
|
|
20
|
+
audience_update_mode?: string;
|
|
21
|
+
batch_size?: number;
|
|
22
|
+
event: string;
|
|
23
|
+
namespace?: string;
|
|
24
|
+
properties?: {
|
|
25
|
+
[k: string]: unknown;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export interface RetlOnMappingSaveInputs {
|
|
29
|
+
audience_name?: string;
|
|
30
|
+
}
|
|
31
|
+
export interface RetlOnMappingSaveOutputs {
|
|
32
|
+
audience_id?: string;
|
|
33
|
+
audience_name?: string;
|
|
34
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/ortto/trackActivity/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const ortto_client_1 = __importDefault(require("../ortto-client"));
|
|
7
|
+
const common_fields_1 = require("../common-fields");
|
|
8
|
+
const action = {
|
|
9
|
+
title: 'Track Activity',
|
|
10
|
+
description: 'Track user activity',
|
|
11
|
+
defaultSubscription: 'type = "track"',
|
|
12
|
+
fields: {
|
|
13
|
+
timestamp: common_fields_1.commonFields.timestamp,
|
|
14
|
+
message_id: common_fields_1.commonFields.message_id,
|
|
15
|
+
user_id: common_fields_1.commonFields.user_id,
|
|
16
|
+
anonymous_id: common_fields_1.commonFields.anonymous_id,
|
|
17
|
+
enable_batching: common_fields_1.commonFields.enable_batching,
|
|
18
|
+
ip: {
|
|
19
|
+
...common_fields_1.commonFields.ipV4,
|
|
20
|
+
description: 'The IP address of the location where the activity occurred.'
|
|
21
|
+
},
|
|
22
|
+
location: {
|
|
23
|
+
...common_fields_1.commonFields.location,
|
|
24
|
+
description: 'The location where the activity occurred. Takes priority over the IP address.'
|
|
25
|
+
},
|
|
26
|
+
traits: {
|
|
27
|
+
...common_fields_1.commonFields.traits,
|
|
28
|
+
description: "key-value custom property pairs to be assigned to the Contact's profile"
|
|
29
|
+
},
|
|
30
|
+
audience_update_mode: common_fields_1.commonFields.audience_update_mode,
|
|
31
|
+
batch_size: common_fields_1.commonFields.batch_size,
|
|
32
|
+
event: {
|
|
33
|
+
label: 'Event name',
|
|
34
|
+
description: 'Event name',
|
|
35
|
+
type: 'string',
|
|
36
|
+
required: true,
|
|
37
|
+
default: {
|
|
38
|
+
'@path': '$.event'
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
namespace: {
|
|
42
|
+
label: 'Namespace',
|
|
43
|
+
description: 'Event namespace',
|
|
44
|
+
type: 'string',
|
|
45
|
+
readOnly: true,
|
|
46
|
+
unsafe_hidden: true,
|
|
47
|
+
default: {
|
|
48
|
+
'@path': '$.context.app.namespace'
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
properties: {
|
|
52
|
+
label: 'Activity properties',
|
|
53
|
+
description: 'An object containing key-value pairs representing activity attributes',
|
|
54
|
+
type: 'object',
|
|
55
|
+
defaultObjectUI: 'keyvalue'
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
hooks: {
|
|
59
|
+
retlOnMappingSave: {
|
|
60
|
+
label: 'Associate Audience',
|
|
61
|
+
description: 'Link the Contact to an Audience in Ortto. If the Audience does not already exist, it will be created in Ortto.',
|
|
62
|
+
inputFields: {
|
|
63
|
+
audience_name: {
|
|
64
|
+
type: 'string',
|
|
65
|
+
label: 'Audience Name',
|
|
66
|
+
description: 'The name of the Ortto Audience to link the Contact to.'
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
outputTypes: {
|
|
70
|
+
audience_id: {
|
|
71
|
+
type: 'string',
|
|
72
|
+
label: 'ID',
|
|
73
|
+
description: 'The ID of the Ortto Audience Contacts will be linked to.',
|
|
74
|
+
required: false
|
|
75
|
+
},
|
|
76
|
+
audience_name: {
|
|
77
|
+
type: 'string',
|
|
78
|
+
label: 'Name',
|
|
79
|
+
description: 'The name of the Ortto Audience contacts will be linkted to.',
|
|
80
|
+
required: false
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
performHook: async (request, { settings, hookInputs }) => {
|
|
84
|
+
if (!hookInputs.audience_name) {
|
|
85
|
+
return {};
|
|
86
|
+
}
|
|
87
|
+
try {
|
|
88
|
+
const client = new ortto_client_1.default(request);
|
|
89
|
+
const audience = await client.createAudience(settings, hookInputs.audience_name);
|
|
90
|
+
return {
|
|
91
|
+
successMessage: `Connected to Audience '${audience.name}' (id: ${audience.id}) successfully.`,
|
|
92
|
+
savedData: {
|
|
93
|
+
audience_id: audience.id,
|
|
94
|
+
audience_name: audience.name
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
catch (err) {
|
|
99
|
+
return {
|
|
100
|
+
error: {
|
|
101
|
+
message: err.message ?? 'Unknown Error',
|
|
102
|
+
code: err.status?.toString() ?? 'Unknown Error'
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
perform: async (request, { settings, payload, hookOutputs }) => {
|
|
110
|
+
const client = new ortto_client_1.default(request);
|
|
111
|
+
return await client.sendActivities(settings, [payload], hookOutputs?.retlOnMappingSave?.outputs?.audience_id ?? '');
|
|
112
|
+
},
|
|
113
|
+
performBatch: async (request, { settings, payload, hookOutputs }) => {
|
|
114
|
+
const client = new ortto_client_1.default(request);
|
|
115
|
+
return await client.sendActivities(settings, payload, hookOutputs?.retlOnMappingSave?.outputs?.audience_id ?? '');
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
exports.default = action;
|
|
119
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/ortto/trackActivity/index.ts"],"names":[],"mappings":";;;;;AAG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E,QAAQ,EAAE,OAAO,EAAE,WAAW,EAAE,EAAE,EAAE;QAC7D,MAAM,MAAM,GAAgB,IAAI,sBAAW,CAAC,OAAO,CAAC,CAAA;QACpD,OAAO,MAAM,MAAM,CAAC,cAAc,CAChC,QAAQ,EACR,CAAC,OAAO,CAAC,EACR,WAAW,EAAE,iBAAiB,EAAE,OAAO,EAAE,WAAsB,IAAI,EAAE,CACvE,CAAA;IACH,CAAC;IACD,YAAY,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,WAAW,EAAE,EAAE,EAAE;QAClE,MAAM,MAAM,GAAgB,IAAI,sBAAW,CAAC,OAAO,CAAC,CAAA;QACpD,OAAO,MAAM,MAAM,CAAC,cAAc,CAChC,QAAQ,EACR,OAAO,EACN,WAAW,EAAE,iBAAiB,EAAE,OAAO,EAAE,WAAsB,IAAI,EAAE,CACvE,CAAA;IACH,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare const TEST_API_KEY = "pau-key";
|
|
2
|
+
export interface Audience {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
}
|
|
6
|
+
export interface AudienceList {
|
|
7
|
+
audiences: Audience[];
|
|
8
|
+
next_page: string;
|
|
9
|
+
}
|
|
10
|
+
export interface BatchResponse {
|
|
11
|
+
errors: {
|
|
12
|
+
status: number;
|
|
13
|
+
message: string;
|
|
14
|
+
index: number;
|
|
15
|
+
}[];
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/destinations/ortto/types.ts"],"names":[],"mappings":";;;AAAa,QAAA,YAAY,GAAG,SAAS,CAAA"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export interface Payload {
|
|
2
|
+
timestamp?: string;
|
|
3
|
+
message_id?: string;
|
|
4
|
+
user_id?: string;
|
|
5
|
+
anonymous_id?: string;
|
|
6
|
+
enable_batching?: boolean;
|
|
7
|
+
ip?: string | null;
|
|
8
|
+
location?: {
|
|
9
|
+
country?: string | null;
|
|
10
|
+
state?: string | null;
|
|
11
|
+
city?: string | null;
|
|
12
|
+
post_code?: string | null;
|
|
13
|
+
};
|
|
14
|
+
traits?: {
|
|
15
|
+
email?: string;
|
|
16
|
+
phone?: string;
|
|
17
|
+
first_name?: string;
|
|
18
|
+
last_name?: string;
|
|
19
|
+
};
|
|
20
|
+
audience_update_mode?: string;
|
|
21
|
+
batch_size?: number;
|
|
22
|
+
}
|
|
23
|
+
export interface RetlOnMappingSaveInputs {
|
|
24
|
+
audience_name?: string;
|
|
25
|
+
}
|
|
26
|
+
export interface RetlOnMappingSaveOutputs {
|
|
27
|
+
audience_id?: string;
|
|
28
|
+
audience_name?: string;
|
|
29
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/ortto/upsertContactProfile/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const ortto_client_1 = __importDefault(require("../ortto-client"));
|
|
7
|
+
const common_fields_1 = require("../common-fields");
|
|
8
|
+
const action = {
|
|
9
|
+
title: 'Upsert Contact',
|
|
10
|
+
description: 'Create or update a Contact in Ortto',
|
|
11
|
+
defaultSubscription: 'type = "identify"',
|
|
12
|
+
fields: {
|
|
13
|
+
timestamp: common_fields_1.commonFields.timestamp,
|
|
14
|
+
message_id: common_fields_1.commonFields.message_id,
|
|
15
|
+
user_id: common_fields_1.commonFields.user_id,
|
|
16
|
+
anonymous_id: common_fields_1.commonFields.anonymous_id,
|
|
17
|
+
enable_batching: common_fields_1.commonFields.enable_batching,
|
|
18
|
+
ip: common_fields_1.commonFields.ipV4,
|
|
19
|
+
location: common_fields_1.commonFields.location,
|
|
20
|
+
traits: common_fields_1.commonFields.traits,
|
|
21
|
+
audience_update_mode: common_fields_1.commonFields.audience_update_mode,
|
|
22
|
+
batch_size: common_fields_1.commonFields.batch_size
|
|
23
|
+
},
|
|
24
|
+
hooks: {
|
|
25
|
+
retlOnMappingSave: {
|
|
26
|
+
label: 'Associate Audience',
|
|
27
|
+
description: 'Link the Contact to an Audience in Ortto. If the Audience does not already exist, it will be created in Ortto.',
|
|
28
|
+
inputFields: {
|
|
29
|
+
audience_name: {
|
|
30
|
+
type: 'string',
|
|
31
|
+
label: 'Audience Name',
|
|
32
|
+
description: 'The name of the Ortto Audience to link the Contact to.'
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
outputTypes: {
|
|
36
|
+
audience_id: {
|
|
37
|
+
type: 'string',
|
|
38
|
+
label: 'ID',
|
|
39
|
+
description: 'The ID of the Ortto Audience Contacts will be linked to.',
|
|
40
|
+
required: false
|
|
41
|
+
},
|
|
42
|
+
audience_name: {
|
|
43
|
+
type: 'string',
|
|
44
|
+
label: 'Name',
|
|
45
|
+
description: 'The name of the Ortto Audience contacts will be linkted to.',
|
|
46
|
+
required: false
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
performHook: async (request, { settings, hookInputs }) => {
|
|
50
|
+
if (!hookInputs.audience_name) {
|
|
51
|
+
return {};
|
|
52
|
+
}
|
|
53
|
+
try {
|
|
54
|
+
const client = new ortto_client_1.default(request);
|
|
55
|
+
const audience = await client.createAudience(settings, hookInputs.audience_name);
|
|
56
|
+
return {
|
|
57
|
+
successMessage: `Connected to Audience '${audience.name}' (id: ${audience.id}) successfully.`,
|
|
58
|
+
savedData: {
|
|
59
|
+
audience_id: audience.id,
|
|
60
|
+
audience_name: audience.name
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
catch (err) {
|
|
65
|
+
return {
|
|
66
|
+
error: {
|
|
67
|
+
message: err.message ?? 'Unknown Error',
|
|
68
|
+
code: err.status?.toString() ?? 'Unknown Error'
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
perform: async (request, { settings, payload, hookOutputs }) => {
|
|
76
|
+
const client = new ortto_client_1.default(request);
|
|
77
|
+
return await client.upsertContacts(settings, [payload], hookOutputs?.retlOnMappingSave?.outputs?.audience_id ?? '');
|
|
78
|
+
},
|
|
79
|
+
performBatch: async (request, { settings, payload, hookOutputs }) => {
|
|
80
|
+
const client = new ortto_client_1.default(request);
|
|
81
|
+
return await client.upsertContacts(settings, payload, hookOutputs?.retlOnMappingSave?.outputs?.audience_id ?? '');
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
exports.default = action;
|
|
85
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/ortto/upsertContactProfile/index.ts"],"names":[],"mappings":";;;;;AAGA,mEAAyC;AACzC,oDAA+C;AAE/C,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,gBAAgB;IACvB,WAAW,EAAE,qCAAqC;IAClD,mBAAmB,EAAE,mBAAmB;IACxC,MAAM,EAAE;QACN,SAAS,EAAE,4BAAY,CAAC,SAAS;QACjC,UAAU,EAAE,4BAAY,CAAC,UAAU;QACnC,OAAO,EAAE,4BAAY,CAAC,OAAO;QAC7B,YAAY,EAAE,4BAAY,CAAC,YAAY;QACvC,eAAe,EAAE,4BAAY,CAAC,eAAe;QAC7C,EAAE,EAAE,4BAAY,CAAC,IAAI;QACrB,QAAQ,EAAE,4BAAY,CAAC,QAAQ;QAC/B,MAAM,EAAE,4BAAY,CAAC,MAAM;QAC3B,oBAAoB,EAAE,4BAAY,CAAC,oBAAoB;QACvD,UA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AQ,EAAE,IAAI,eAAe;yBAC9D;qBACF,CAAA;iBACF;YACH,CAAC;SACF;KACF;IACD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,WAAW,EAAE,EAAE,EAAE;QAC7D,MAAM,MAAM,GAAgB,IAAI,sBAAW,CAAC,OAAO,CAAC,CAAA;QACpD,OAAO,MAAM,MAAM,CAAC,cAAc,CAChC,QAAQ,EACR,CAAC,OAAO,CAAC,EACR,WAAW,EAAE,iBAAiB,EAAE,OAAO,EAAE,WAAsB,IAAI,EAAE,CACvE,CAAA;IACH,CAAC;IACD,YAAY,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,WAAW,EAAE,EAAE,EAAE;QAClE,MAAM,MAAM,GAAgB,IAAI,sBAAW,CAAC,OAAO,CAAC,CAAA;QACpD,OAAO,MAAM,MAAM,CAAC,cAAc,CAChC,QAAQ,EACR,OAAO,EACN,WAAW,EAAE,iBAAiB,EAAE,OAAO,EAAE,WAAsB,IAAI,EAAE,CACvE,CAAA;IACH,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function cleanObject<T extends {}>(obj: T): Partial<T>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.cleanObject = void 0;
|
|
4
|
+
function cleanObject(obj) {
|
|
5
|
+
return Object.fromEntries(Object.entries(obj)
|
|
6
|
+
.filter(([key, _]) => key !== '')
|
|
7
|
+
.map(([key, value]) => [key, value instanceof Object && !(value instanceof Array) ? cleanObject(value) : value]));
|
|
8
|
+
}
|
|
9
|
+
exports.cleanObject = cleanObject;
|
|
10
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/destinations/ortto/utils.ts"],"names":[],"mappings":";;;AAAA,SAAgB,WAAW,CAAe,GAAM;IAC9C,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC;SAChB,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC;SAChC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,KAAK,YAAY,MAAM,IAAI,CAAC,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CACrG,CAAA;AACjB,CAAC;AAND,kCAMC"}
|