@segment/action-destinations 3.437.1-staging-8e44525ae.0 → 3.437.1-staging-ea6c83c19.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/first-party-dv360/_tests_/index.test.js +14 -139
- package/dist/destinations/first-party-dv360/_tests_/index.test.js.map +1 -1
- package/dist/destinations/first-party-dv360/addToAudContactInfo/_tests_/index.test.js +5 -31
- package/dist/destinations/first-party-dv360/addToAudContactInfo/_tests_/index.test.js.map +1 -1
- package/dist/destinations/first-party-dv360/addToAudMobileDeviceId/_tests_/index.test.js +6 -36
- package/dist/destinations/first-party-dv360/addToAudMobileDeviceId/_tests_/index.test.js.map +1 -1
- package/dist/destinations/first-party-dv360/functions.d.ts +7 -2
- package/dist/destinations/first-party-dv360/functions.js +33 -37
- package/dist/destinations/first-party-dv360/functions.js.map +1 -1
- package/dist/destinations/first-party-dv360/generated-types.d.ts +1 -1
- package/dist/destinations/first-party-dv360/index.js +8 -10
- package/dist/destinations/first-party-dv360/index.js.map +1 -1
- package/dist/destinations/first-party-dv360/properties.d.ts +0 -1
- package/dist/destinations/first-party-dv360/properties.js +1 -2
- package/dist/destinations/first-party-dv360/properties.js.map +1 -1
- package/dist/destinations/first-party-dv360/removeFromAudContactInfo/_tests_/index.test.js +4 -55
- package/dist/destinations/first-party-dv360/removeFromAudContactInfo/_tests_/index.test.js.map +1 -1
- package/dist/destinations/first-party-dv360/types.d.ts +2 -2
- package/dist/destinations/google-enhanced-conversions/userList/index.js +1 -1
- package/dist/destinations/google-enhanced-conversions/userList/index.js.map +1 -1
- package/dist/destinations/hubspot/upsertObject/functions/validation-functions.d.ts +2 -0
- package/dist/destinations/hubspot/upsertObject/functions/validation-functions.js +25 -1
- package/dist/destinations/hubspot/upsertObject/functions/validation-functions.js.map +1 -1
- package/dist/destinations/hubspot/upsertObject/index.js +1 -1
- package/dist/destinations/hubspot/upsertObject/index.js.map +1 -1
- package/dist/destinations/linkedin-audiences/{api/index.d.ts → api.d.ts} +3 -3
- package/dist/destinations/linkedin-audiences/{api/index.js → api.js} +2 -2
- package/dist/destinations/linkedin-audiences/api.js.map +1 -0
- package/dist/destinations/linkedin-audiences/updateAudience/fields.d.ts +2 -0
- package/dist/destinations/linkedin-audiences/updateAudience/fields.js +126 -0
- package/dist/destinations/linkedin-audiences/updateAudience/fields.js.map +1 -0
- package/dist/destinations/linkedin-audiences/updateAudience/functions.d.ts +5 -0
- package/dist/destinations/linkedin-audiences/updateAudience/functions.js +112 -0
- package/dist/destinations/linkedin-audiences/updateAudience/functions.js.map +1 -0
- package/dist/destinations/linkedin-audiences/updateAudience/index.js +5 -232
- package/dist/destinations/linkedin-audiences/updateAudience/index.js.map +1 -1
- package/dist/destinations/vibe-audience/index.js +11 -1
- package/dist/destinations/vibe-audience/index.js.map +1 -1
- package/dist/destinations/webhook-extensible/__test__/webhook.test.js +64 -0
- package/dist/destinations/webhook-extensible/__test__/webhook.test.js.map +1 -1
- package/dist/destinations/webhook-extensible/index.js +15 -3
- package/dist/destinations/webhook-extensible/index.js.map +1 -1
- package/package.json +4 -4
- package/dist/destinations/linkedin-audiences/api/index.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.LinkedInAudiences = void 0;
|
|
4
|
-
const constants_1 = require("
|
|
4
|
+
const constants_1 = require("./constants");
|
|
5
5
|
class LinkedInAudiences {
|
|
6
6
|
constructor(request) {
|
|
7
7
|
this.request = request;
|
|
@@ -58,4 +58,4 @@ class LinkedInAudiences {
|
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
exports.LinkedInAudiences = LinkedInAudiences;
|
|
61
|
-
//# sourceMappingURL=
|
|
61
|
+
//# sourceMappingURL=api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../../src/destinations/linkedin-audi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ACF;aACF;SACF,CAAC,CAAA;IACJ,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,YAAoB,EAAE,QAAmC;QACzE,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,oBAAQ,gBAAgB,YAAY,QAAQ,EAAE;YACnE,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACP,iBAAiB,EAAE,cAAc;aAClC;YACD,IAAI,EAAE;gBACJ,QAAQ;aACT;YACD,eAAe,EAAE,KAAK;SACvB,CAAC,CAAA;IACJ,CAAC;CACF;AAhED,8CAgEC"}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fields = void 0;
|
|
4
|
+
exports.fields = {
|
|
5
|
+
dmp_segment_name: {
|
|
6
|
+
label: 'DMP Segment Display Name',
|
|
7
|
+
description: 'The display name of the LinkedIn DMP Segment. This field is set only when Segment creates a new audience. Updating this field after Segment has created an audience will not update the audience name in LinkedIn.',
|
|
8
|
+
type: 'string',
|
|
9
|
+
default: {
|
|
10
|
+
'@if': {
|
|
11
|
+
exists: { '@path': '$.properties.audience_key' },
|
|
12
|
+
then: { '@path': '$.properties.audience_key' },
|
|
13
|
+
else: { '@path': '$.context.personas.computation_key' }
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
enable_batching: {
|
|
18
|
+
label: 'Enable Batching',
|
|
19
|
+
description: 'Enable batching of requests to the LinkedIn DMP Segment.',
|
|
20
|
+
type: 'boolean',
|
|
21
|
+
default: true,
|
|
22
|
+
unsafe_hidden: true
|
|
23
|
+
},
|
|
24
|
+
email: {
|
|
25
|
+
label: 'User Email',
|
|
26
|
+
description: "The user's email address to send to LinkedIn.",
|
|
27
|
+
type: 'string',
|
|
28
|
+
default: {
|
|
29
|
+
'@if': {
|
|
30
|
+
exists: { '@path': '$.context.traits.email' },
|
|
31
|
+
then: { '@path': '$.context.traits.email' },
|
|
32
|
+
else: { '@path': '$.traits.email' }
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
category: 'hashedPII'
|
|
36
|
+
},
|
|
37
|
+
first_name: {
|
|
38
|
+
label: 'User First Name',
|
|
39
|
+
description: "The user's first name to send to LinkedIn.",
|
|
40
|
+
type: 'string',
|
|
41
|
+
default: {
|
|
42
|
+
'@path': '$.traits.firstName'
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
last_name: {
|
|
46
|
+
label: 'User Last Name',
|
|
47
|
+
description: "The user's last name to send to LinkedIn.",
|
|
48
|
+
type: 'string',
|
|
49
|
+
default: {
|
|
50
|
+
'@path': '$.traits.lastName'
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
title: {
|
|
54
|
+
label: 'User Title',
|
|
55
|
+
description: "The user's title to send to LinkedIn.",
|
|
56
|
+
type: 'string',
|
|
57
|
+
default: {
|
|
58
|
+
'@path': '$.traits.title'
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
company: {
|
|
62
|
+
label: 'User Company',
|
|
63
|
+
description: "The user's company to send to LinkedIn.",
|
|
64
|
+
type: 'string',
|
|
65
|
+
default: {
|
|
66
|
+
'@path': '$.traits.company'
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
country: {
|
|
70
|
+
label: 'User Country',
|
|
71
|
+
description: "The user's country to send to LinkedIn. This field accepts an ISO standardized two letter country code e.g. US.",
|
|
72
|
+
type: 'string',
|
|
73
|
+
default: {
|
|
74
|
+
'@path': '$.traits.country'
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
google_advertising_id: {
|
|
78
|
+
label: 'User Google Advertising ID',
|
|
79
|
+
description: "The user's Google Advertising ID to send to LinkedIn.",
|
|
80
|
+
type: 'string',
|
|
81
|
+
unsafe_hidden: true,
|
|
82
|
+
default: {
|
|
83
|
+
'@path': '$.context.device.advertisingId'
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
source_segment_id: {
|
|
87
|
+
label: 'LinkedIn Source Segment ID',
|
|
88
|
+
description: "A Segment-specific key associated with the LinkedIn DMP Segment. This is the lookup key Segment uses to fetch the DMP Segment from LinkedIn's API.",
|
|
89
|
+
type: 'string',
|
|
90
|
+
unsafe_hidden: true,
|
|
91
|
+
default: {
|
|
92
|
+
'@if': {
|
|
93
|
+
exists: { '@path': '$.properties.audience_key' },
|
|
94
|
+
then: { '@path': '$.properties.audience_key' },
|
|
95
|
+
else: { '@path': '$.context.personas.computation_key' }
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
personas_audience_key: {
|
|
100
|
+
label: 'Segment Engage Audience Key',
|
|
101
|
+
description: 'The `audience_key` of the Engage audience you want to sync to LinkedIn. This value must be a hard-coded string variable, e.g. `personas_test_audience`, in order for batching to work properly.',
|
|
102
|
+
type: 'string',
|
|
103
|
+
required: true
|
|
104
|
+
},
|
|
105
|
+
event_name: {
|
|
106
|
+
label: 'Event Name',
|
|
107
|
+
description: 'The name of the current Segment event.',
|
|
108
|
+
type: 'string',
|
|
109
|
+
unsafe_hidden: true,
|
|
110
|
+
default: {
|
|
111
|
+
'@path': '$.event'
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
dmp_user_action: {
|
|
115
|
+
label: 'DMP User Action',
|
|
116
|
+
description: 'A Segment specific key used to define action type.',
|
|
117
|
+
type: 'string',
|
|
118
|
+
choices: [
|
|
119
|
+
{ label: `Auto Detect`, value: 'AUTO' },
|
|
120
|
+
{ label: `Add`, value: 'ADD' },
|
|
121
|
+
{ label: 'Remove', value: 'REMOVE' }
|
|
122
|
+
],
|
|
123
|
+
default: 'AUTO'
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
//# sourceMappingURL=fields.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fields.js","sourceRoot":"","sources":["../../../../src/destinations/linkedin-audiences/updateAudience/fields.ts"],"names":[],"mappings":";;;AAEa,QAAA,MAAM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AM,EAAE;YACvC,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE;YAC9B,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE;SACrC;QACD,OAAO,EAAE,MAAM;KAChB;CACF,CAAA"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { StatsContext } from '@segment/actions-core';
|
|
2
|
+
import { RequestClient } from '@segment/actions-core';
|
|
3
|
+
import type { Settings } from '../generated-types';
|
|
4
|
+
import type { Payload } from './generated-types';
|
|
5
|
+
export declare function processPayload(request: RequestClient, settings: Settings, payloads: Payload[], statsContext: StatsContext | undefined): Promise<import("@segment/actions-core/src").ModifiedResponse<unknown> | undefined>;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.processPayload = processPayload;
|
|
4
|
+
const actions_core_1 = require("@segment/actions-core");
|
|
5
|
+
const api_1 = require("../api");
|
|
6
|
+
const hashing_utils_1 = require("../../../lib/hashing-utils");
|
|
7
|
+
async function processPayload(request, settings, payloads, statsContext) {
|
|
8
|
+
validate(settings, payloads);
|
|
9
|
+
const linkedinApiClient = new api_1.LinkedInAudiences(request);
|
|
10
|
+
const dmpSegmentId = await getDmpSegmentId(linkedinApiClient, settings, payloads[0], statsContext);
|
|
11
|
+
const elements = extractUsers(settings, payloads);
|
|
12
|
+
if (elements.length < 1) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
statsContext?.statsClient?.incr('oauth_app_api_call', 1, [
|
|
16
|
+
...statsContext?.tags,
|
|
17
|
+
`endpoint:add-or-remove-users-from-dmpSegment`
|
|
18
|
+
]);
|
|
19
|
+
const res = await linkedinApiClient.batchUpdate(dmpSegmentId, elements);
|
|
20
|
+
if (res.status !== 200) {
|
|
21
|
+
throw new actions_core_1.RetryableError('Error while attempting to update LinkedIn DMP Segment. This batch will be retried.');
|
|
22
|
+
}
|
|
23
|
+
return res;
|
|
24
|
+
}
|
|
25
|
+
function validate(settings, payloads) {
|
|
26
|
+
const isAutoOrUndefined = ['AUTO', undefined].includes(payloads[0]?.dmp_user_action);
|
|
27
|
+
if (isAutoOrUndefined && payloads[0].source_segment_id !== payloads[0].personas_audience_key) {
|
|
28
|
+
throw new actions_core_1.IntegrationError('The value of `source_segment_id` and `personas_audience_key` must match.', 'INVALID_SETTINGS', 400);
|
|
29
|
+
}
|
|
30
|
+
if (!settings.send_google_advertising_id && !settings.send_email) {
|
|
31
|
+
throw new actions_core_1.IntegrationError('At least one of `Send Email` or `Send Google Advertising ID` must be set to `true`.', 'INVALID_SETTINGS', 400);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
async function getDmpSegmentId(linkedinApiClient, settings, payload, statsContext) {
|
|
35
|
+
statsContext?.statsClient?.incr('oauth_app_api_call', 1, [...statsContext?.tags, `endpoint:get-dmpSegment`]);
|
|
36
|
+
const res = await linkedinApiClient.getDmpSegment(settings, payload);
|
|
37
|
+
const body = await res.json();
|
|
38
|
+
if (body.elements?.length > 0) {
|
|
39
|
+
return body.elements[0].id;
|
|
40
|
+
}
|
|
41
|
+
return createDmpSegment(linkedinApiClient, settings, payload, statsContext);
|
|
42
|
+
}
|
|
43
|
+
async function createDmpSegment(linkedinApiClient, settings, payload, statsContext) {
|
|
44
|
+
statsContext?.statsClient?.incr('oauth_app_api_call', 1, [...statsContext?.tags, `endpoint:create-dmpSegment`]);
|
|
45
|
+
const res = await linkedinApiClient.createDmpSegment(settings, payload);
|
|
46
|
+
const headers = res.headers.toJSON();
|
|
47
|
+
return headers['x-linkedin-id'];
|
|
48
|
+
}
|
|
49
|
+
function extractUsers(settings, payloads) {
|
|
50
|
+
const elements = [];
|
|
51
|
+
payloads.forEach((payload) => {
|
|
52
|
+
if (!payload.email && !payload.google_advertising_id) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
const linkedinAudiencePayload = {
|
|
56
|
+
action: getAction(payload),
|
|
57
|
+
userIds: getUserIds(settings, payload)
|
|
58
|
+
};
|
|
59
|
+
if (payload.first_name) {
|
|
60
|
+
linkedinAudiencePayload.firstName = payload.first_name;
|
|
61
|
+
}
|
|
62
|
+
if (payload.last_name) {
|
|
63
|
+
linkedinAudiencePayload.lastName = payload.last_name;
|
|
64
|
+
}
|
|
65
|
+
if (payload.title) {
|
|
66
|
+
linkedinAudiencePayload.title = payload.title;
|
|
67
|
+
}
|
|
68
|
+
if (payload.company) {
|
|
69
|
+
linkedinAudiencePayload.company = payload.company;
|
|
70
|
+
}
|
|
71
|
+
if (payload.country) {
|
|
72
|
+
linkedinAudiencePayload.country = payload.country;
|
|
73
|
+
}
|
|
74
|
+
elements.push(linkedinAudiencePayload);
|
|
75
|
+
});
|
|
76
|
+
return elements;
|
|
77
|
+
}
|
|
78
|
+
function getAction(payload) {
|
|
79
|
+
const { dmp_user_action = 'AUTO' } = payload;
|
|
80
|
+
if (dmp_user_action === 'ADD') {
|
|
81
|
+
return 'ADD';
|
|
82
|
+
}
|
|
83
|
+
if (dmp_user_action === 'REMOVE') {
|
|
84
|
+
return 'REMOVE';
|
|
85
|
+
}
|
|
86
|
+
if (dmp_user_action === 'AUTO' || !dmp_user_action) {
|
|
87
|
+
if (payload.event_name === 'Audience Entered') {
|
|
88
|
+
return 'ADD';
|
|
89
|
+
}
|
|
90
|
+
if (payload.event_name === 'Audience Exited') {
|
|
91
|
+
return 'REMOVE';
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return 'ADD';
|
|
95
|
+
}
|
|
96
|
+
function getUserIds(settings, payload) {
|
|
97
|
+
const userIds = [];
|
|
98
|
+
if (payload.email && settings.send_email === true) {
|
|
99
|
+
userIds.push({
|
|
100
|
+
idType: 'SHA256_EMAIL',
|
|
101
|
+
idValue: (0, hashing_utils_1.processHashing)(payload.email, 'sha256', 'hex')
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
if (payload.google_advertising_id && settings.send_google_advertising_id === true) {
|
|
105
|
+
userIds.push({
|
|
106
|
+
idType: 'GOOGLE_AID',
|
|
107
|
+
idValue: payload.google_advertising_id
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
return userIds;
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=functions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../../../../src/destinations/linkedin-audiences/updateAudience/functions.ts"],"names":[],"mappings":";;AAQA,wCAuCC;AA9CD,wDAAuF;AAGvF,gCAA0C;AAE1C,8DAA2D;AAEpD,KAAK,UAAU,cAAc,CAClC,OAAsB,EACtB,QAAkB,EAClB,QAAmB,EACnB,YAAsC;IAEtC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;IAE5B,MAAM,iBAAiB,GAAsB,IAAI,uBAAiB,CAAC,OAAO,CAAC,CAAA;IAE3E,MAAM,YAAY,GAAG,MAAM,eAAe,CAAC,iBAAiB,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,YAAY,CAAC,CAAA;IAClG,MAAM,QAAQ,GAAG,YAAY,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;IAQjD,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACxB,OAAM;IACR,CAAC;IAED,YAAY,EAAE,WAAW,EAAE,IAAI,CAAC,oBAAoB,EAAE,CAAC,EAAE;QACvD,GAAG,YAAY,EAAE,IAAI;QACrB,8CAA8C;KAC/C,CAAC,CAAA;IAEF,MAAM,GAAG,GAAG,MAAM,iBAAiB,CAAC,WAAW,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAA;IAMvE,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;QACvB,MAAM,IAAI,6BAAc,CAAC,oFAAoF,CAAC,CAAA;IAChH,CAAC;IAED,OAAO,GAAG,CAAA;AACZ,CAAC;AAED,SAAS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J,CAAC;IAED,OAAO,OAAO,CAAA;AAChB,CAAC"}
|
|
@@ -1,245 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const hashing_utils_1 = require("../../../lib/hashing-utils");
|
|
3
|
+
const functions_1 = require("./functions");
|
|
4
|
+
const fields_1 = require("./fields");
|
|
6
5
|
const action = {
|
|
7
6
|
title: 'Sync To LinkedIn DMP Segment',
|
|
8
7
|
description: 'Syncs contacts from a Personas Audience to a LinkedIn DMP Segment.',
|
|
9
8
|
defaultSubscription: 'event = "Audience Entered" or event = "Audience Exited"',
|
|
10
|
-
fields:
|
|
11
|
-
dmp_segment_name: {
|
|
12
|
-
label: 'DMP Segment Display Name',
|
|
13
|
-
description: 'The display name of the LinkedIn DMP Segment. This field is set only when Segment creates a new audience. Updating this field after Segment has created an audience will not update the audience name in LinkedIn.',
|
|
14
|
-
type: 'string',
|
|
15
|
-
default: {
|
|
16
|
-
'@if': {
|
|
17
|
-
exists: { '@path': '$.properties.audience_key' },
|
|
18
|
-
then: { '@path': '$.properties.audience_key' },
|
|
19
|
-
else: { '@path': '$.context.personas.computation_key' }
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
enable_batching: {
|
|
24
|
-
label: 'Enable Batching',
|
|
25
|
-
description: 'Enable batching of requests to the LinkedIn DMP Segment.',
|
|
26
|
-
type: 'boolean',
|
|
27
|
-
default: true,
|
|
28
|
-
unsafe_hidden: true
|
|
29
|
-
},
|
|
30
|
-
email: {
|
|
31
|
-
label: 'User Email',
|
|
32
|
-
description: "The user's email address to send to LinkedIn.",
|
|
33
|
-
type: 'string',
|
|
34
|
-
default: {
|
|
35
|
-
'@if': {
|
|
36
|
-
exists: { '@path': '$.context.traits.email' },
|
|
37
|
-
then: { '@path': '$.context.traits.email' },
|
|
38
|
-
else: { '@path': '$.traits.email' }
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
category: 'hashedPII'
|
|
42
|
-
},
|
|
43
|
-
first_name: {
|
|
44
|
-
label: 'User First Name',
|
|
45
|
-
description: "The user's first name to send to LinkedIn.",
|
|
46
|
-
type: 'string',
|
|
47
|
-
default: {
|
|
48
|
-
'@path': '$.traits.firstName'
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
|
-
last_name: {
|
|
52
|
-
label: 'User Last Name',
|
|
53
|
-
description: "The user's last name to send to LinkedIn.",
|
|
54
|
-
type: 'string',
|
|
55
|
-
default: {
|
|
56
|
-
'@path': '$.traits.lastName'
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
title: {
|
|
60
|
-
label: 'User Title',
|
|
61
|
-
description: "The user's title to send to LinkedIn.",
|
|
62
|
-
type: 'string',
|
|
63
|
-
default: {
|
|
64
|
-
'@path': '$.traits.title'
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
company: {
|
|
68
|
-
label: 'User Company',
|
|
69
|
-
description: "The user's company to send to LinkedIn.",
|
|
70
|
-
type: 'string',
|
|
71
|
-
default: {
|
|
72
|
-
'@path': '$.traits.company'
|
|
73
|
-
}
|
|
74
|
-
},
|
|
75
|
-
country: {
|
|
76
|
-
label: 'User Country',
|
|
77
|
-
description: "The user's country to send to LinkedIn. This field accepts an ISO standardized two letter country code e.g. US.",
|
|
78
|
-
type: 'string',
|
|
79
|
-
default: {
|
|
80
|
-
'@path': '$.traits.country'
|
|
81
|
-
}
|
|
82
|
-
},
|
|
83
|
-
google_advertising_id: {
|
|
84
|
-
label: 'User Google Advertising ID',
|
|
85
|
-
description: "The user's Google Advertising ID to send to LinkedIn.",
|
|
86
|
-
type: 'string',
|
|
87
|
-
unsafe_hidden: true,
|
|
88
|
-
default: {
|
|
89
|
-
'@path': '$.context.device.advertisingId'
|
|
90
|
-
}
|
|
91
|
-
},
|
|
92
|
-
source_segment_id: {
|
|
93
|
-
label: 'LinkedIn Source Segment ID',
|
|
94
|
-
description: "A Segment-specific key associated with the LinkedIn DMP Segment. This is the lookup key Segment uses to fetch the DMP Segment from LinkedIn's API.",
|
|
95
|
-
type: 'string',
|
|
96
|
-
unsafe_hidden: true,
|
|
97
|
-
default: {
|
|
98
|
-
'@if': {
|
|
99
|
-
exists: { '@path': '$.properties.audience_key' },
|
|
100
|
-
then: { '@path': '$.properties.audience_key' },
|
|
101
|
-
else: { '@path': '$.context.personas.computation_key' }
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
},
|
|
105
|
-
personas_audience_key: {
|
|
106
|
-
label: 'Segment Engage Audience Key',
|
|
107
|
-
description: 'The `audience_key` of the Engage audience you want to sync to LinkedIn. This value must be a hard-coded string variable, e.g. `personas_test_audience`, in order for batching to work properly.',
|
|
108
|
-
type: 'string',
|
|
109
|
-
required: true
|
|
110
|
-
},
|
|
111
|
-
event_name: {
|
|
112
|
-
label: 'Event Name',
|
|
113
|
-
description: 'The name of the current Segment event.',
|
|
114
|
-
type: 'string',
|
|
115
|
-
unsafe_hidden: true,
|
|
116
|
-
default: {
|
|
117
|
-
'@path': '$.event'
|
|
118
|
-
}
|
|
119
|
-
},
|
|
120
|
-
dmp_user_action: {
|
|
121
|
-
label: 'DMP User Action',
|
|
122
|
-
description: 'A Segment specific key used to define action type.',
|
|
123
|
-
type: 'string',
|
|
124
|
-
choices: [
|
|
125
|
-
{ label: `Auto Detect`, value: 'AUTO' },
|
|
126
|
-
{ label: `Add`, value: 'ADD' },
|
|
127
|
-
{ label: 'Remove', value: 'REMOVE' }
|
|
128
|
-
],
|
|
129
|
-
default: 'AUTO'
|
|
130
|
-
}
|
|
131
|
-
},
|
|
9
|
+
fields: fields_1.fields,
|
|
132
10
|
perform: async (request, { settings, payload, statsContext }) => {
|
|
133
|
-
return processPayload(request, settings, [payload], statsContext);
|
|
11
|
+
return (0, functions_1.processPayload)(request, settings, [payload], statsContext);
|
|
134
12
|
},
|
|
135
13
|
performBatch: async (request, { settings, payload, statsContext }) => {
|
|
136
|
-
return processPayload(request, settings, payload, statsContext);
|
|
14
|
+
return (0, functions_1.processPayload)(request, settings, payload, statsContext);
|
|
137
15
|
}
|
|
138
16
|
};
|
|
139
|
-
async function processPayload(request, settings, payloads, statsContext) {
|
|
140
|
-
validate(settings, payloads);
|
|
141
|
-
const linkedinApiClient = new api_1.LinkedInAudiences(request);
|
|
142
|
-
const dmpSegmentId = await getDmpSegmentId(linkedinApiClient, settings, payloads[0], statsContext);
|
|
143
|
-
const elements = extractUsers(settings, payloads);
|
|
144
|
-
if (elements.length < 1) {
|
|
145
|
-
return;
|
|
146
|
-
}
|
|
147
|
-
statsContext?.statsClient?.incr('oauth_app_api_call', 1, [
|
|
148
|
-
...statsContext?.tags,
|
|
149
|
-
`endpoint:add-or-remove-users-from-dmpSegment`
|
|
150
|
-
]);
|
|
151
|
-
const res = await linkedinApiClient.batchUpdate(dmpSegmentId, elements);
|
|
152
|
-
if (res.status !== 200) {
|
|
153
|
-
throw new actions_core_1.RetryableError('Error while attempting to update LinkedIn DMP Segment. This batch will be retried.');
|
|
154
|
-
}
|
|
155
|
-
return res;
|
|
156
|
-
}
|
|
157
|
-
function validate(settings, payloads) {
|
|
158
|
-
const isAutoOrUndefined = ['AUTO', undefined].includes(payloads[0]?.dmp_user_action);
|
|
159
|
-
if (isAutoOrUndefined && payloads[0].source_segment_id !== payloads[0].personas_audience_key) {
|
|
160
|
-
throw new actions_core_1.IntegrationError('The value of `source_segment_id` and `personas_audience_key` must match.', 'INVALID_SETTINGS', 400);
|
|
161
|
-
}
|
|
162
|
-
if (!settings.send_google_advertising_id && !settings.send_email) {
|
|
163
|
-
throw new actions_core_1.IntegrationError('At least one of `Send Email` or `Send Google Advertising ID` must be set to `true`.', 'INVALID_SETTINGS', 400);
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
async function getDmpSegmentId(linkedinApiClient, settings, payload, statsContext) {
|
|
167
|
-
statsContext?.statsClient?.incr('oauth_app_api_call', 1, [...statsContext?.tags, `endpoint:get-dmpSegment`]);
|
|
168
|
-
const res = await linkedinApiClient.getDmpSegment(settings, payload);
|
|
169
|
-
const body = await res.json();
|
|
170
|
-
if (body.elements?.length > 0) {
|
|
171
|
-
return body.elements[0].id;
|
|
172
|
-
}
|
|
173
|
-
return createDmpSegment(linkedinApiClient, settings, payload, statsContext);
|
|
174
|
-
}
|
|
175
|
-
async function createDmpSegment(linkedinApiClient, settings, payload, statsContext) {
|
|
176
|
-
statsContext?.statsClient?.incr('oauth_app_api_call', 1, [...statsContext?.tags, `endpoint:create-dmpSegment`]);
|
|
177
|
-
const res = await linkedinApiClient.createDmpSegment(settings, payload);
|
|
178
|
-
const headers = res.headers.toJSON();
|
|
179
|
-
return headers['x-linkedin-id'];
|
|
180
|
-
}
|
|
181
|
-
function extractUsers(settings, payloads) {
|
|
182
|
-
const elements = [];
|
|
183
|
-
payloads.forEach((payload) => {
|
|
184
|
-
if (!payload.email && !payload.google_advertising_id) {
|
|
185
|
-
return;
|
|
186
|
-
}
|
|
187
|
-
const linkedinAudiencePayload = {
|
|
188
|
-
action: getAction(payload),
|
|
189
|
-
userIds: getUserIds(settings, payload)
|
|
190
|
-
};
|
|
191
|
-
if (payload.first_name) {
|
|
192
|
-
linkedinAudiencePayload.firstName = payload.first_name;
|
|
193
|
-
}
|
|
194
|
-
if (payload.last_name) {
|
|
195
|
-
linkedinAudiencePayload.lastName = payload.last_name;
|
|
196
|
-
}
|
|
197
|
-
if (payload.title) {
|
|
198
|
-
linkedinAudiencePayload.title = payload.title;
|
|
199
|
-
}
|
|
200
|
-
if (payload.company) {
|
|
201
|
-
linkedinAudiencePayload.company = payload.company;
|
|
202
|
-
}
|
|
203
|
-
if (payload.country) {
|
|
204
|
-
linkedinAudiencePayload.country = payload.country;
|
|
205
|
-
}
|
|
206
|
-
elements.push(linkedinAudiencePayload);
|
|
207
|
-
});
|
|
208
|
-
return elements;
|
|
209
|
-
}
|
|
210
|
-
function getAction(payload) {
|
|
211
|
-
const { dmp_user_action = 'AUTO' } = payload;
|
|
212
|
-
if (dmp_user_action === 'ADD') {
|
|
213
|
-
return 'ADD';
|
|
214
|
-
}
|
|
215
|
-
if (dmp_user_action === 'REMOVE') {
|
|
216
|
-
return 'REMOVE';
|
|
217
|
-
}
|
|
218
|
-
if (dmp_user_action === 'AUTO' || !dmp_user_action) {
|
|
219
|
-
if (payload.event_name === 'Audience Entered') {
|
|
220
|
-
return 'ADD';
|
|
221
|
-
}
|
|
222
|
-
if (payload.event_name === 'Audience Exited') {
|
|
223
|
-
return 'REMOVE';
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
return 'ADD';
|
|
227
|
-
}
|
|
228
|
-
function getUserIds(settings, payload) {
|
|
229
|
-
const userIds = [];
|
|
230
|
-
if (payload.email && settings.send_email === true) {
|
|
231
|
-
userIds.push({
|
|
232
|
-
idType: 'SHA256_EMAIL',
|
|
233
|
-
idValue: (0, hashing_utils_1.processHashing)(payload.email, 'sha256', 'hex')
|
|
234
|
-
});
|
|
235
|
-
}
|
|
236
|
-
if (payload.google_advertising_id && settings.send_google_advertising_id === true) {
|
|
237
|
-
userIds.push({
|
|
238
|
-
idType: 'GOOGLE_AID',
|
|
239
|
-
idValue: payload.google_advertising_id
|
|
240
|
-
});
|
|
241
|
-
}
|
|
242
|
-
return userIds;
|
|
243
|
-
}
|
|
244
17
|
exports.default = action;
|
|
245
18
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/linkedin-audiences/updateAudience/index.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/linkedin-audiences/updateAudience/index.ts"],"names":[],"mappings":";;AAGA,2CAA4C;AAC5C,qCAAiC;AAEjC,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,8BAA8B;IACrC,WAAW,EAAE,oEAAoE;IACjF,mBAAmB,EAAE,yDAAyD;IAC9E,MAAM,EAAN,eAAM;IACN,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,EAAE;QAC9D,OAAO,IAAA,0BAAc,EAAC,OAAO,EAAE,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,YAAY,CAAC,CAAA;IACnE,CAAC;IACD,YAAY,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,EAAE;QACnE,OAAO,IAAA,0BAAc,EAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,YAAY,CAAC,CAAA;IACjE,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const actions_core_1 = require("@segment/actions-core");
|
|
6
7
|
const sync_1 = __importDefault(require("./sync"));
|
|
7
8
|
const constants_1 = require("./constants");
|
|
8
9
|
const destination = {
|
|
@@ -43,7 +44,16 @@ const destination = {
|
|
|
43
44
|
},
|
|
44
45
|
actions: {
|
|
45
46
|
sync: sync_1.default
|
|
46
|
-
}
|
|
47
|
+
},
|
|
48
|
+
presets: [
|
|
49
|
+
{
|
|
50
|
+
name: 'Sync Engage Audience',
|
|
51
|
+
subscribe: 'type = "identify" or type = "track"',
|
|
52
|
+
partnerAction: 'sync',
|
|
53
|
+
mapping: (0, actions_core_1.defaultValues)(sync_1.default.fields),
|
|
54
|
+
type: 'automatic'
|
|
55
|
+
}
|
|
56
|
+
]
|
|
47
57
|
};
|
|
48
58
|
exports.default = destination;
|
|
49
59
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/vibe-audience/index.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/vibe-audience/index.ts"],"names":[],"mappings":";;;;;AAAA,wDAA4E;AAE5E,kDAAyB;AACzB,2CAAmD;AAEnD,MAAM,WAAW,GAAoC;IACnD,IAAI,EAAE,eAAe;IACrB,IAAI,EAAE,uBAAuB;IAC7B,IAAI,EAAE,OAAO;IACb,WAAW,EAAE,uCAAuC;IAEpD,cAAc,EAAE;QACd,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE;YACN,YAAY,EAAE;gBACZ,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,eAAe;gBACtB,WAAW,EAAE,0BAA0B;gBACvC,QAAQ,EAAE,IAAI;aACf;YACD,SAAS,EAAE;gBACT,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,YAAY;gBACnB,WAAW,EAAE,iCAAiC;gBAC9C,QAAQ,EAAE,IAAI;gBACd,MAAM,EAAE,UAAU;aACnB;SACF;QAED,kBAAkB,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE;YAClD,OAAO,OAAO,CAAC,GAAG,oBAAQ,IAAI,uBAAW,oBAAoB,QAAQ,CAAC,YAAY,EAAE,EAAE;gBACpF,MAAM,EAAE,KAAK;aACd,CAAC,CAAA;QACJ,CAAC;KACF;IACD,aAAa,CAAC,EAAE,QAAQ,EAAE;QACxB,OAAO;YACL,OAAO,EAAE;gBACP,WAAW,EAAE,QAAQ,CAAC,SAAS;gBAC/B,cAAc,EAAE,kBAAkB;aACnC;SACF,CAAA;IACH,CAAC;IACD,OAAO,EAAE;QACP,IAAI,EAAJ,cAAI;KACL;IACD,OAAO,EAAE;QACP;YACE,IAAI,EAAE,sBAAsB;YAC5B,SAAS,EAAE,qCAAqC;YAChD,aAAa,EAAE,MAAM;YACrB,OAAO,EAAE,IAAA,4BAAa,EAAC,cAAI,CAAC,MAAM,CA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