@segment/action-destinations 3.110.1-alpha.0 → 3.110.1-alpha.3
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/actions-pardot/prospects/index.js.map +1 -1
- package/dist/destinations/adobe-target/adobeTarget_operations.d.ts +1 -1
- package/dist/destinations/adobe-target/adobeTarget_operations.js +15 -21
- package/dist/destinations/adobe-target/adobeTarget_operations.js.map +1 -1
- package/dist/destinations/adobe-target/generated-types.d.ts +0 -1
- package/dist/destinations/adobe-target/index.js +0 -15
- package/dist/destinations/adobe-target/index.js.map +1 -1
- package/dist/destinations/amplitude/emptyObject.d.ts +2 -0
- package/dist/destinations/amplitude/emptyObject.js +7 -0
- package/dist/destinations/amplitude/emptyObject.js.map +1 -0
- package/dist/destinations/amplitude/index.js +6 -6
- package/dist/destinations/amplitude/index.js.map +1 -1
- package/dist/destinations/amplitude/logEvent/generated-types.d.ts +21 -0
- package/dist/destinations/amplitude/logEvent/index.js +96 -10
- package/dist/destinations/amplitude/logEvent/index.js.map +1 -1
- package/dist/destinations/amplitude/logEventV2/index.js +15 -16
- package/dist/destinations/amplitude/logEventV2/index.js.map +1 -1
- package/dist/destinations/cordial/addProductToCart/index.js +1 -1
- package/dist/destinations/cordial/addProductToCart/index.js.map +1 -1
- package/dist/destinations/cordial/index.js +1 -1
- package/dist/destinations/cordial/index.js.map +1 -1
- package/dist/destinations/cordial/removeProductFromCart/index.js.map +1 -1
- package/dist/destinations/cordial/upsertOrder/index.js +8 -8
- package/dist/destinations/cordial/upsertOrder/index.js.map +1 -1
- package/dist/destinations/customerio/trackEvent/index.js.map +1 -1
- package/dist/destinations/engage-messaging-sendgrid/sendEmail/index.js +4 -1
- package/dist/destinations/engage-messaging-sendgrid/sendEmail/index.js.map +1 -1
- package/dist/destinations/engage-messaging-twilio/sendSms/index.js.map +1 -1
- package/dist/destinations/facebook-conversions-api/addToCart/index.js +5 -1
- package/dist/destinations/facebook-conversions-api/addToCart/index.js.map +1 -1
- package/dist/destinations/facebook-conversions-api/custom/index.js +5 -1
- package/dist/destinations/facebook-conversions-api/custom/index.js.map +1 -1
- package/dist/destinations/facebook-conversions-api/fb-capi-properties.d.ts +1 -2
- package/dist/destinations/facebook-conversions-api/fb-capi-properties.js +6 -8
- package/dist/destinations/facebook-conversions-api/fb-capi-properties.js.map +1 -1
- package/dist/destinations/facebook-conversions-api/initiateCheckout/index.js +5 -1
- package/dist/destinations/facebook-conversions-api/initiateCheckout/index.js.map +1 -1
- package/dist/destinations/facebook-conversions-api/pageView/index.js +5 -1
- package/dist/destinations/facebook-conversions-api/pageView/index.js.map +1 -1
- package/dist/destinations/facebook-conversions-api/purchase/index.js +5 -1
- package/dist/destinations/facebook-conversions-api/purchase/index.js.map +1 -1
- package/dist/destinations/facebook-conversions-api/search/index.js +5 -1
- package/dist/destinations/facebook-conversions-api/search/index.js.map +1 -1
- package/dist/destinations/facebook-conversions-api/viewContent/index.js +5 -1
- package/dist/destinations/facebook-conversions-api/viewContent/index.js.map +1 -1
- package/dist/destinations/google-enhanced-conversions/constants.d.ts +1 -0
- package/dist/destinations/google-enhanced-conversions/constants.js +185 -0
- package/dist/destinations/google-enhanced-conversions/constants.js.map +1 -0
- package/dist/destinations/google-enhanced-conversions/functions.d.ts +2 -5
- package/dist/destinations/google-enhanced-conversions/functions.js +7 -27
- package/dist/destinations/google-enhanced-conversions/functions.js.map +1 -1
- package/dist/destinations/google-enhanced-conversions/index.js +2 -2
- package/dist/destinations/google-enhanced-conversions/index.js.map +1 -1
- package/dist/destinations/google-enhanced-conversions/postConversion/index.js +1 -1
- package/dist/destinations/google-enhanced-conversions/postConversion/index.js.map +1 -1
- package/dist/destinations/google-enhanced-conversions/types.d.ts +0 -8
- package/dist/destinations/google-enhanced-conversions/types.js +0 -2
- package/dist/destinations/google-enhanced-conversions/types.js.map +1 -1
- package/dist/destinations/google-enhanced-conversions/uploadCallConversion/index.js +31 -17
- package/dist/destinations/google-enhanced-conversions/uploadCallConversion/index.js.map +1 -1
- package/dist/destinations/google-enhanced-conversions/uploadClickConversion/generated-types.d.ts +1 -1
- package/dist/destinations/google-enhanced-conversions/uploadClickConversion/index.js +49 -30
- package/dist/destinations/google-enhanced-conversions/uploadClickConversion/index.js.map +1 -1
- package/dist/destinations/google-enhanced-conversions/uploadClickConversion/types.d.ts +5 -0
- package/dist/destinations/{hubspot/upsertContact/generated-types.js → google-enhanced-conversions/uploadClickConversion/types.js} +1 -1
- package/dist/destinations/google-enhanced-conversions/uploadClickConversion/types.js.map +1 -0
- package/dist/destinations/google-enhanced-conversions/uploadConversionAdjustment/generated-types.d.ts +1 -1
- package/dist/destinations/google-enhanced-conversions/uploadConversionAdjustment/index.js +44 -61
- package/dist/destinations/google-enhanced-conversions/uploadConversionAdjustment/index.js.map +1 -1
- package/dist/destinations/index.js +1 -2
- package/dist/destinations/index.js.map +1 -1
- package/dist/destinations/linkedin-audiences/index.js +11 -38
- package/dist/destinations/linkedin-audiences/index.js.map +1 -1
- package/dist/destinations/linkedin-audiences/updateAudience/index.js +10 -19
- package/dist/destinations/linkedin-audiences/updateAudience/index.js.map +1 -1
- package/dist/destinations/mixpanel/index.js +1 -1
- package/dist/destinations/mixpanel/trackEvent/index.js.map +1 -1
- package/dist/destinations/salesforce/customObject/index.js +1 -8
- package/dist/destinations/salesforce/customObject/index.js.map +1 -1
- package/dist/destinations/salesforce/lead/index.js +2 -1
- package/dist/destinations/salesforce/lead/index.js.map +1 -1
- package/dist/destinations/salesforce/sf-operations.d.ts +0 -2
- package/dist/destinations/salesforce/sf-operations.js +0 -28
- package/dist/destinations/salesforce/sf-operations.js.map +1 -1
- package/dist/destinations/{loops/createContact → salesforce-marketing-cloud/contact}/generated-types.d.ts +0 -1
- package/dist/destinations/{hubspot/createCustomObjectRecord → salesforce-marketing-cloud/contact}/generated-types.js +0 -0
- package/dist/destinations/salesforce-marketing-cloud/contact/generated-types.js.map +1 -0
- package/dist/destinations/{hubspot/createCustomObjectRecord → salesforce-marketing-cloud/contact}/index.d.ts +0 -0
- package/dist/destinations/salesforce-marketing-cloud/contact/index.js +11 -0
- package/dist/destinations/salesforce-marketing-cloud/contact/index.js.map +1 -0
- package/dist/destinations/{hubspot → salesforce-marketing-cloud}/generated-types.d.ts +0 -0
- package/dist/destinations/{hubspot → salesforce-marketing-cloud}/generated-types.js +0 -0
- package/dist/destinations/salesforce-marketing-cloud/generated-types.js.map +1 -0
- package/dist/destinations/{hubspot → salesforce-marketing-cloud}/index.d.ts +0 -0
- package/dist/destinations/salesforce-marketing-cloud/index.js +27 -0
- package/dist/destinations/salesforce-marketing-cloud/index.js.map +1 -0
- package/dist/destinations/sendgrid/index.js +0 -8
- package/dist/destinations/sendgrid/index.js.map +1 -1
- package/dist/destinations/sendgrid/sendgrid-properties.d.ts +5 -8
- package/dist/destinations/sendgrid/sendgrid-properties.js +3 -34
- package/dist/destinations/sendgrid/sendgrid-properties.js.map +1 -1
- package/dist/destinations/sendgrid/updateUserProfile/index.js +10 -6
- package/dist/destinations/sendgrid/updateUserProfile/index.js.map +1 -1
- package/dist/destinations/tiktok-conversions/reportWebEvent/generated-types.d.ts +0 -1
- package/dist/destinations/tiktok-conversions/reportWebEvent/index.js +2 -15
- package/dist/destinations/tiktok-conversions/reportWebEvent/index.js.map +1 -1
- package/package.json +4 -4
- package/dist/destinations/amplitude/compact.d.ts +0 -2
- package/dist/destinations/amplitude/compact.js +0 -7
- package/dist/destinations/amplitude/compact.js.map +0 -1
- package/dist/destinations/hubspot/createCustomObjectRecord/generated-types.d.ts +0 -6
- package/dist/destinations/hubspot/createCustomObjectRecord/generated-types.js.map +0 -1
- package/dist/destinations/hubspot/createCustomObjectRecord/index.js +0 -38
- package/dist/destinations/hubspot/createCustomObjectRecord/index.js.map +0 -1
- package/dist/destinations/hubspot/generated-types.js.map +0 -1
- package/dist/destinations/hubspot/index.js +0 -47
- package/dist/destinations/hubspot/index.js.map +0 -1
- package/dist/destinations/hubspot/properties.d.ts +0 -1
- package/dist/destinations/hubspot/properties.js +0 -5
- package/dist/destinations/hubspot/properties.js.map +0 -1
- package/dist/destinations/hubspot/sendCustomBehavioralEvent/generated-types.d.ts +0 -10
- package/dist/destinations/hubspot/sendCustomBehavioralEvent/generated-types.js +0 -3
- package/dist/destinations/hubspot/sendCustomBehavioralEvent/generated-types.js.map +0 -1
- package/dist/destinations/hubspot/sendCustomBehavioralEvent/index.d.ts +0 -5
- package/dist/destinations/hubspot/sendCustomBehavioralEvent/index.js +0 -69
- package/dist/destinations/hubspot/sendCustomBehavioralEvent/index.js.map +0 -1
- package/dist/destinations/hubspot/testHelper.d.ts +0 -7
- package/dist/destinations/hubspot/testHelper.js +0 -24
- package/dist/destinations/hubspot/testHelper.js.map +0 -1
- package/dist/destinations/hubspot/upsertContact/generated-types.d.ts +0 -17
- package/dist/destinations/hubspot/upsertContact/generated-types.js.map +0 -1
- package/dist/destinations/hubspot/upsertContact/index.d.ts +0 -5
- package/dist/destinations/hubspot/upsertContact/index.js +0 -183
- package/dist/destinations/hubspot/upsertContact/index.js.map +0 -1
- package/dist/destinations/loops/createContact/generated-types.js +0 -3
- package/dist/destinations/loops/createContact/generated-types.js.map +0 -1
- package/dist/destinations/loops/createContact/index.d.ts +0 -5
- package/dist/destinations/loops/createContact/index.js +0 -33
- package/dist/destinations/loops/createContact/index.js.map +0 -1
- package/dist/destinations/loops/generated-types.d.ts +0 -3
- package/dist/destinations/loops/generated-types.js +0 -3
- package/dist/destinations/loops/generated-types.js.map +0 -1
- package/dist/destinations/loops/index.d.ts +0 -4
- package/dist/destinations/loops/index.js +0 -35
- package/dist/destinations/loops/index.js.map +0 -1
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const actions_core_1 = require("@segment/actions-core");
|
|
4
|
-
const types_1 = require("../types");
|
|
5
4
|
const functions_1 = require("../functions");
|
|
6
5
|
const action = {
|
|
7
6
|
title: 'Upload Click Conversion',
|
|
@@ -9,24 +8,28 @@ const action = {
|
|
|
9
8
|
fields: {
|
|
10
9
|
conversion_action: {
|
|
11
10
|
label: 'Conversion Action ID',
|
|
12
|
-
description: 'The ID of the conversion action associated with this conversion. To find the Conversion Action ID, click on your conversion in Google Ads and get the value for
|
|
11
|
+
description: 'The ID of the conversion action associated with this conversion. To find the Conversion Action ID, click on your conversion in Google Ads and get the value for ctId in the URL. For example, if the URL is https://ads.google.com/aw/conversions/detail?ocid=00000000&ctId=570000000, your Conversion Action ID is 570000000.',
|
|
13
12
|
type: 'string',
|
|
14
|
-
required: true
|
|
13
|
+
required: true,
|
|
14
|
+
default: ''
|
|
15
15
|
},
|
|
16
16
|
gclid: {
|
|
17
17
|
label: 'GCLID',
|
|
18
18
|
description: 'The Google click ID (gclid) associated with this conversion.',
|
|
19
|
-
type: 'string'
|
|
19
|
+
type: 'string',
|
|
20
|
+
default: ''
|
|
20
21
|
},
|
|
21
22
|
gbraid: {
|
|
22
23
|
label: 'GBRAID',
|
|
23
24
|
description: 'The click identifier for clicks associated with app conversions and originating from iOS devices starting with iOS14.',
|
|
24
|
-
type: 'string'
|
|
25
|
+
type: 'string',
|
|
26
|
+
default: ''
|
|
25
27
|
},
|
|
26
28
|
wbraid: {
|
|
27
29
|
label: 'WBRAID',
|
|
28
30
|
description: 'The click identifier for clicks associated with web conversions and originating from iOS devices starting with iOS14.',
|
|
29
|
-
type: 'string'
|
|
31
|
+
type: 'string',
|
|
32
|
+
default: ''
|
|
30
33
|
},
|
|
31
34
|
conversion_timestamp: {
|
|
32
35
|
label: 'Conversion Timestamp',
|
|
@@ -46,7 +49,7 @@ const action = {
|
|
|
46
49
|
'@if': {
|
|
47
50
|
exists: { '@path': '$.properties.email' },
|
|
48
51
|
then: { '@path': '$.properties.email' },
|
|
49
|
-
else: { '@path': '
|
|
52
|
+
else: { '@path': '$context.traits.email' }
|
|
50
53
|
}
|
|
51
54
|
}
|
|
52
55
|
},
|
|
@@ -58,20 +61,16 @@ const action = {
|
|
|
58
61
|
'@if': {
|
|
59
62
|
exists: { '@path': '$.properties.phone' },
|
|
60
63
|
then: { '@path': '$.properties.phone' },
|
|
61
|
-
else: { '@path': '
|
|
64
|
+
else: { '@path': '$context.traits.phone' }
|
|
62
65
|
}
|
|
63
66
|
}
|
|
64
67
|
},
|
|
65
68
|
order_id: {
|
|
66
69
|
label: 'Order ID',
|
|
67
|
-
description: 'The order ID associated with the conversion. An order
|
|
70
|
+
description: 'The order ID associated with the conversion. An order id can only be used for one conversion per conversion action.',
|
|
68
71
|
type: 'string',
|
|
69
72
|
default: {
|
|
70
|
-
'@
|
|
71
|
-
exists: { '@path': '$.properties.orderId' },
|
|
72
|
-
then: { '@path': '$.properties.orderId' },
|
|
73
|
-
else: { '@path': '$.properties.order_id' }
|
|
74
|
-
}
|
|
73
|
+
'@path': '$.properties.orderId'
|
|
75
74
|
}
|
|
76
75
|
},
|
|
77
76
|
value: {
|
|
@@ -92,33 +91,37 @@ const action = {
|
|
|
92
91
|
},
|
|
93
92
|
conversion_environment: {
|
|
94
93
|
label: 'Conversion Environment',
|
|
95
|
-
description: 'The environment this conversion was recorded on
|
|
94
|
+
description: 'The environment this conversion was recorded on. e.g. App or Web.',
|
|
96
95
|
type: 'string',
|
|
97
96
|
choices: [
|
|
98
97
|
{ label: 'APP', value: 'APP' },
|
|
99
98
|
{ label: 'WEB', value: 'WEB' },
|
|
100
|
-
{ label:
|
|
99
|
+
{ label: `UNSPECIFIED`, value: 'UNSPECIFIED' }
|
|
101
100
|
]
|
|
102
101
|
},
|
|
103
102
|
merchant_id: {
|
|
104
103
|
label: 'Merchant Center ID',
|
|
105
104
|
description: 'The ID of the Merchant Center account where the items are uploaded.',
|
|
106
|
-
type: 'string'
|
|
105
|
+
type: 'string',
|
|
106
|
+
default: ''
|
|
107
107
|
},
|
|
108
108
|
merchant_country_code: {
|
|
109
109
|
label: 'Merchant Center Feed Country Code',
|
|
110
110
|
description: 'The ISO 3166 two-character region code of the Merchant Center feed where the items are uploaded.',
|
|
111
|
-
type: 'string'
|
|
111
|
+
type: 'string',
|
|
112
|
+
default: ''
|
|
112
113
|
},
|
|
113
114
|
merchant_language_code: {
|
|
114
115
|
label: 'Merchant Center Feed Language Code',
|
|
115
116
|
description: 'The ISO 639-1 language code of the Merchant Center feed where the items are uploaded.',
|
|
116
|
-
type: 'string'
|
|
117
|
+
type: 'string',
|
|
118
|
+
default: ''
|
|
117
119
|
},
|
|
118
120
|
local_cost: {
|
|
119
121
|
label: 'Local Transaction Cost',
|
|
120
122
|
description: 'Sum of all transaction-level discounts, such as free shipping and coupon discounts for the whole cart.',
|
|
121
|
-
type: 'number'
|
|
123
|
+
type: 'number',
|
|
124
|
+
default: ''
|
|
122
125
|
},
|
|
123
126
|
items: {
|
|
124
127
|
label: 'Items',
|
|
@@ -164,14 +167,14 @@ const action = {
|
|
|
164
167
|
description: 'The custom variables associated with this conversion. On the left-hand side, input the name of the custom variable as it appears in your Google Ads account. On the right-hand side, map the Segment field that contains the corresponding value See [Google’s documentation on how to create custom conversion variables.](https://developers.google.com/google-ads/api/docs/conversions/conversion-custom-variables) ',
|
|
165
168
|
type: 'object',
|
|
166
169
|
additionalProperties: true,
|
|
167
|
-
defaultObjectUI: 'keyvalue
|
|
170
|
+
defaultObjectUI: 'keyvalue'
|
|
168
171
|
}
|
|
169
172
|
},
|
|
170
173
|
perform: async (request, { auth, settings, payload }) => {
|
|
171
174
|
if (!settings.customerId) {
|
|
172
|
-
throw new actions_core_1.IntegrationError('Customer
|
|
175
|
+
throw new actions_core_1.IntegrationError('Customer id is required for this action. Please set it in destination settings.', 'Missing required fields.', 400);
|
|
173
176
|
}
|
|
174
|
-
settings.customerId = settings.customerId.replace(
|
|
177
|
+
settings.customerId = settings.customerId.replace(/[^0-9.]+/g, '');
|
|
175
178
|
let cartItems = [];
|
|
176
179
|
if (payload.items) {
|
|
177
180
|
cartItems = payload.items.map((product) => {
|
|
@@ -182,6 +185,16 @@ const action = {
|
|
|
182
185
|
};
|
|
183
186
|
});
|
|
184
187
|
}
|
|
188
|
+
const customVariableIds = await request(`https://googleads.googleapis.com/v11/customers/${settings.customerId}/googleAds:searchStream`, {
|
|
189
|
+
method: 'post',
|
|
190
|
+
headers: {
|
|
191
|
+
authorization: `Bearer ${auth?.accessToken}`,
|
|
192
|
+
'developer-token': `${process.env.ADWORDS_DEVELOPER_TOKEN}`
|
|
193
|
+
},
|
|
194
|
+
json: {
|
|
195
|
+
query: `SELECT conversion_custom_variable.id, conversion_custom_variable.name FROM conversion_custom_variable`
|
|
196
|
+
}
|
|
197
|
+
});
|
|
185
198
|
const request_object = {
|
|
186
199
|
conversionAction: `customers/${settings.customerId}/conversionActions/${payload.conversion_action}`,
|
|
187
200
|
conversionDateTime: payload.conversion_timestamp.replace(/T/, ' ').replace(/\..+/, '+00:00'),
|
|
@@ -199,19 +212,16 @@ const action = {
|
|
|
199
212
|
localTransactionCost: payload.local_cost,
|
|
200
213
|
items: cartItems
|
|
201
214
|
},
|
|
202
|
-
userIdentifiers: []
|
|
215
|
+
userIdentifiers: [],
|
|
216
|
+
customVariables: functions_1.formatCustomVariables(payload.custom_variables, customVariableIds.data[0].results)
|
|
203
217
|
};
|
|
204
|
-
if (payload.custom_variables) {
|
|
205
|
-
const customVariableIds = await functions_1.getCustomVariables(settings.customerId, auth, request);
|
|
206
|
-
request_object.customVariables = functions_1.formatCustomVariables(payload.custom_variables, customVariableIds.data[0].results);
|
|
207
|
-
}
|
|
208
218
|
if (payload.email_address) {
|
|
209
219
|
request_object.userIdentifiers.push({ hashedEmail: functions_1.hash(payload.email_address) });
|
|
210
220
|
}
|
|
211
221
|
if (payload.phone_number) {
|
|
212
222
|
request_object.userIdentifiers.push({ hashedPhoneNumber: functions_1.hash(payload.phone_number) });
|
|
213
223
|
}
|
|
214
|
-
const response = await request(
|
|
224
|
+
const response = await request(`https://googleads.googleapis.com/v11/customers/${settings.customerId}:uploadClickConversions`, {
|
|
215
225
|
method: 'post',
|
|
216
226
|
headers: {
|
|
217
227
|
'developer-token': `${process.env.ADWORDS_DEVELOPER_TOKEN}`
|
|
@@ -221,7 +231,16 @@ const action = {
|
|
|
221
231
|
partialFailure: true
|
|
222
232
|
}
|
|
223
233
|
});
|
|
224
|
-
|
|
234
|
+
if (typeof response.data === 'object' && response.data != null) {
|
|
235
|
+
Object.entries(response.data).forEach(([key]) => {
|
|
236
|
+
if (key === 'partialFailureError') {
|
|
237
|
+
throw new actions_core_1.IntegrationError('Partial Failure Error', 'INVALID_ARGUMENT', 400);
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
else {
|
|
242
|
+
throw new actions_core_1.IntegrationError('Not really an error', 'INVALID_ARGUMENT', 400);
|
|
243
|
+
}
|
|
225
244
|
return response;
|
|
226
245
|
}
|
|
227
246
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/google-enhanced-conversions/uploadClickConversion/index.ts"],"names":[],"mappings":";;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/google-enhanced-conversions/uploadClickConversion/index.ts"],"names":[],"mappings":";;AAAA,wDAA4F;AAI5F,4CAA0D;AAE1D,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,yBAAyB;IAChC,WAAW,EAAE,2DAA2D;IACxE,MAAM,EAAE;QACN,iBAAiB,EAAE;YACjB,KAAK,EAAE,sBAAsB;YAC7B,WAAW,EACT,gUAAgU;YAClU,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE,EAAE;SACZ;QACD,KAAK,EAAE;YACL,KAAK,EAAE,OAAO;YACd,WAAW,EAAE,8DAA8D;YAC3E,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,EAAE;SACZ;QACD,MAAM,EAAE;YACN,KAAK,EAAE,QAAQ;YACf,WAAW,EACT,uHAAuH;YACzH,IAAI,EAAE,QAA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CAAC,EAAE,WAAW,EAAE,gBAAI,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE,CAAC,CAAA;SAClF;QAED,IAAI,OAAO,CAAC,YAAY,EAAE;YACxB,cAAc,CAAC,eAAe,CAAC,IAAI,CAAC,EAAE,iBAAiB,EAAE,gBAAI,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC,CAAA;SACvF;QAED,MAAM,QAAQ,GAAG,MAAM,OAAO,CAC5B,kDAAkD,QAAQ,CAAC,UAAU,yBAAyB,EAC9F;YACE,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACP,iBAAiB,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,uBAAuB,EAAE;aAC5D;YACD,IAAI,EAAE;gBACJ,WAAW,EAAE,CAAC,cAAc,CAAC;gBAC7B,cAAc,EAAE,IAAI;aACrB;SACF,CACF,CAAA;QAGD,IAAI,OAAO,QAAQ,CAAC,IAAI,KAAK,QAAQ,IAAI,QAAQ,CAAC,IAAI,IAAI,IAAI,EAAE;YAC9D,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE;gBAC9C,IAAI,GAAG,KAAK,qBAAqB,EAAE;oBACjC,MAAM,IAAI,+BAAgB,CAAC,uBAAuB,EAAE,kBAAkB,EAAE,GAAG,CAAC,CAAA;iBAC7E;YACH,CAAC,CAAC,CAAA;SACH;aAAM;YACL,MAAM,IAAI,+BAAgB,CAAC,qBAAqB,EAAE,kBAAkB,EAAE,GAAG,CAAC,CAAA;SAC3E;QACD,OAAO,QAAQ,CAAA;IACjB,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/destinations/google-enhanced-conversions/uploadClickConversion/types.ts"],"names":[],"mappings":""}
|
|
@@ -2,20 +2,20 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const actions_core_1 = require("@segment/actions-core");
|
|
4
4
|
const functions_1 = require("../functions");
|
|
5
|
-
const types_1 = require("../types");
|
|
6
5
|
const action = {
|
|
7
6
|
title: 'Upload Conversion Adjustment',
|
|
8
7
|
description: 'Upload a conversion adjustment to the Google Ads API.',
|
|
9
8
|
fields: {
|
|
10
9
|
conversion_action: {
|
|
11
10
|
label: 'Conversion Action ID',
|
|
12
|
-
description: 'The ID of the conversion action associated with this conversion. To find the Conversion Action ID, click on your conversion in Google Ads and get the value for
|
|
11
|
+
description: 'The ID of the conversion action associated with this conversion. To find the Conversion Action ID, click on your conversion in Google Ads and get the value for ctId in the URL. For example, if the URL is https://ads.google.com/aw/conversions/detail?ocid=00000000&ctId=576882000, your Conversion Action ID is 576882000.',
|
|
13
12
|
type: 'string',
|
|
14
|
-
required: true
|
|
13
|
+
required: true,
|
|
14
|
+
default: ''
|
|
15
15
|
},
|
|
16
16
|
adjustment_type: {
|
|
17
17
|
label: 'Adjustment Type',
|
|
18
|
-
description: 'The adjustment type. See
|
|
18
|
+
description: 'The adjustment type. See Google’s documentation for details on each type.',
|
|
19
19
|
type: 'string',
|
|
20
20
|
choices: [
|
|
21
21
|
{ label: 'UNSPECIFIED', value: 'UNSPECIFIED' },
|
|
@@ -28,7 +28,7 @@ const action = {
|
|
|
28
28
|
},
|
|
29
29
|
adjustment_timestamp: {
|
|
30
30
|
label: 'Adjustment Timestamp',
|
|
31
|
-
description: 'The date time at which the adjustment occurred. Must be after the
|
|
31
|
+
description: 'The date time at which the adjustment occurred. Must be after the conversion_date_time. The timezone must be specified. The format is "yyyy-mm-dd hh:mm:ss+|-hh:mm", e.g. "2019-01-01 12:32:45-08:00".',
|
|
32
32
|
type: 'string',
|
|
33
33
|
required: true,
|
|
34
34
|
default: {
|
|
@@ -40,32 +40,32 @@ const action = {
|
|
|
40
40
|
description: 'The order ID of the conversion to be adjusted. If the conversion was reported with an order ID specified, that order ID must be used as the identifier here. Required for ENHANCEMENT adjustments.',
|
|
41
41
|
type: 'string',
|
|
42
42
|
default: {
|
|
43
|
-
'@
|
|
44
|
-
exists: { '@path': '$.properties.orderId' },
|
|
45
|
-
then: { '@path': '$.properties.orderId' },
|
|
46
|
-
else: { '@path': '$.properties.order_id' }
|
|
47
|
-
}
|
|
43
|
+
'@path': '$.properties.orderId'
|
|
48
44
|
}
|
|
49
45
|
},
|
|
50
46
|
gclid: {
|
|
51
47
|
label: 'GCLID',
|
|
52
48
|
description: 'Google click ID associated with the original conversion for this adjustment. This is used for the GCLID Date Time Pair. Required for non-ENHANCEMENT adjustments. If adjustment is ENHANCEMENT, this value is optional but may be set in addition to the order ID.',
|
|
53
|
-
type: 'string'
|
|
49
|
+
type: 'string',
|
|
50
|
+
default: ''
|
|
54
51
|
},
|
|
55
52
|
conversion_timestamp: {
|
|
56
53
|
label: 'Conversion Timestamp',
|
|
57
54
|
description: 'The date time at which the original conversion for this adjustment occurred. The timezone must be specified. The format is "yyyy-mm-dd hh:mm:ss+|-hh:mm", e.g. "2019-01-01 12:32:45-08:00". This is used for the GCLID Date Time Pair. Required for non-ENHANCEMENT adjustments. If adjustment is ENHANCEMENT, this value is optional but may be set in addition to the order ID.',
|
|
58
|
-
type: 'string'
|
|
55
|
+
type: 'string',
|
|
56
|
+
default: ''
|
|
59
57
|
},
|
|
60
58
|
restatement_value: {
|
|
61
59
|
label: 'Restatement Value',
|
|
62
60
|
description: 'The restated conversion value. This is the value of the conversion after restatement. For example, to change the value of a conversion from 100 to 70, an adjusted value of 70 should be reported. Required for RESTATEMENT adjustments.',
|
|
63
|
-
type: 'number'
|
|
61
|
+
type: 'number',
|
|
62
|
+
default: ''
|
|
64
63
|
},
|
|
65
64
|
restatement_currency_code: {
|
|
66
65
|
label: 'Restatement Currency Code',
|
|
67
|
-
description: 'The currency of the restated value. If not provided, then the default currency from the conversion action is used, and if that is not set then the account currency is used. This is the ISO 4217 3-character currency code
|
|
68
|
-
type: 'string'
|
|
66
|
+
description: 'The currency of the restated value. If not provided, then the default currency from the conversion action is used, and if that is not set then the account currency is used. This is the ISO 4217 3-character currency code e.g. USD or EUR.',
|
|
67
|
+
type: 'string',
|
|
68
|
+
default: ''
|
|
69
69
|
},
|
|
70
70
|
email_address: {
|
|
71
71
|
label: 'Email Address',
|
|
@@ -76,7 +76,7 @@ const action = {
|
|
|
76
76
|
'@if': {
|
|
77
77
|
exists: { '@path': '$.properties.email' },
|
|
78
78
|
then: { '@path': '$.properties.email' },
|
|
79
|
-
else: { '@path': '
|
|
79
|
+
else: { '@path': '$context.traits.email' }
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
},
|
|
@@ -88,7 +88,7 @@ const action = {
|
|
|
88
88
|
'@if': {
|
|
89
89
|
exists: { '@path': '$.properties.phone' },
|
|
90
90
|
then: { '@path': '$.properties.phone' },
|
|
91
|
-
else: { '@path': '
|
|
91
|
+
else: { '@path': '$context.traits.phone' }
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
},
|
|
@@ -100,7 +100,7 @@ const action = {
|
|
|
100
100
|
'@if': {
|
|
101
101
|
exists: { '@path': '$.properties.firstName' },
|
|
102
102
|
then: { '@path': '$.properties.firstName' },
|
|
103
|
-
else: { '@path': '
|
|
103
|
+
else: { '@path': '$context.traits.firstName' }
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
},
|
|
@@ -112,7 +112,7 @@ const action = {
|
|
|
112
112
|
'@if': {
|
|
113
113
|
exists: { '@path': '$.properties.lastName' },
|
|
114
114
|
then: { '@path': '$.properties.lastName' },
|
|
115
|
-
else: { '@path': '
|
|
115
|
+
else: { '@path': '$context.traits.lastName' }
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
118
|
},
|
|
@@ -187,44 +187,22 @@ const action = {
|
|
|
187
187
|
},
|
|
188
188
|
perform: async (request, { settings, payload }) => {
|
|
189
189
|
if (!settings.customerId) {
|
|
190
|
-
throw new actions_core_1.IntegrationError('Customer
|
|
190
|
+
throw new actions_core_1.IntegrationError('Customer id is required for this action. Please set it in destination settings.', 'Missing required fields.', 400);
|
|
191
191
|
}
|
|
192
|
-
settings.customerId = settings.customerId.replace(
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
},
|
|
206
|
-
RETRACTION: {
|
|
207
|
-
validation: (payload) => !payload.gclid || !payload.conversion_timestamp,
|
|
208
|
-
error: {
|
|
209
|
-
message: 'GCLID and conversion timestamp required for chosen conversion type'
|
|
210
|
-
}
|
|
211
|
-
},
|
|
212
|
-
UNKNOWN: {
|
|
213
|
-
validation: (payload) => !payload.gclid || !payload.conversion_timestamp,
|
|
214
|
-
error: {
|
|
215
|
-
message: 'GCLID and conversion timestamp required for chosen conversion type'
|
|
216
|
-
}
|
|
217
|
-
},
|
|
218
|
-
UNSPECIFIED: {
|
|
219
|
-
validation: (payload) => !payload.gclid || !payload.conversion_timestamp,
|
|
220
|
-
error: {
|
|
221
|
-
message: 'GCLID and conversion timestamp required for chosen conversion type'
|
|
222
|
-
}
|
|
192
|
+
settings.customerId = settings.customerId.replace(/[^0-9.]+/g, '');
|
|
193
|
+
if (payload.adjustment_type == 'ENHANCEMENT' && !payload.order_id) {
|
|
194
|
+
throw new actions_core_1.IntegrationError('Order id required for enhancement conversion', 'INVALID_ARGUMENT', 400);
|
|
195
|
+
}
|
|
196
|
+
else if (payload.adjustment_type != 'ENHANCEMENT') {
|
|
197
|
+
if (!payload.gclid) {
|
|
198
|
+
throw new actions_core_1.IntegrationError('Gclid required for chosen conversion type', 'INVALID_ARGUMENT', 400);
|
|
199
|
+
}
|
|
200
|
+
if (!payload.conversion_timestamp) {
|
|
201
|
+
throw new actions_core_1.IntegrationError('Conversion timestamp required for chosen conversion type', 'INVALID_ARGUMENT', 400);
|
|
202
|
+
}
|
|
203
|
+
if (payload.adjustment_type == 'RESTATEMENT' && !payload.restatement_value) {
|
|
204
|
+
throw new actions_core_1.IntegrationError('Restatement value required for restatement conversion', 'INVALID_ARGUMENT', 400);
|
|
223
205
|
}
|
|
224
|
-
};
|
|
225
|
-
const key = payload.adjustment_type;
|
|
226
|
-
if (validations[key].validation(payload)) {
|
|
227
|
-
throw new actions_core_1.IntegrationError(validations[key].error.message, 'INVALID_ARGUMENT', 400);
|
|
228
206
|
}
|
|
229
207
|
const request_object = {
|
|
230
208
|
conversionAction: `customers/${settings.customerId}/conversionActions/${payload.conversion_action}`,
|
|
@@ -233,7 +211,7 @@ const action = {
|
|
|
233
211
|
orderId: payload.order_id,
|
|
234
212
|
gclidDateTimePair: {
|
|
235
213
|
gclid: payload.gclid,
|
|
236
|
-
conversionDateTime: payload.conversion_timestamp
|
|
214
|
+
conversionDateTime: payload.conversion_timestamp
|
|
237
215
|
},
|
|
238
216
|
restatementValue: {
|
|
239
217
|
adjustedValue: payload.restatement_value,
|
|
@@ -248,14 +226,13 @@ const action = {
|
|
|
248
226
|
if (payload.phone_number) {
|
|
249
227
|
request_object.userIdentifiers.push({ hashedPhoneNumber: functions_1.hash(payload.phone_number) });
|
|
250
228
|
}
|
|
251
|
-
|
|
229
|
+
if (payload.first_name ||
|
|
252
230
|
payload.last_name ||
|
|
253
231
|
payload.city ||
|
|
254
232
|
payload.state ||
|
|
255
233
|
payload.country ||
|
|
256
234
|
payload.postal_code ||
|
|
257
|
-
payload.street_address
|
|
258
|
-
if (containsAddressInfo) {
|
|
235
|
+
payload.street_address) {
|
|
259
236
|
request_object.userIdentifiers.push({
|
|
260
237
|
addressInfo: {
|
|
261
238
|
hashedFirstName: functions_1.hash(payload.first_name),
|
|
@@ -268,7 +245,7 @@ const action = {
|
|
|
268
245
|
}
|
|
269
246
|
});
|
|
270
247
|
}
|
|
271
|
-
const response = await request(
|
|
248
|
+
const response = await request(`https://googleads.googleapis.com/v11/customers/${settings.customerId}:uploadConversionAdjustments`, {
|
|
272
249
|
method: 'post',
|
|
273
250
|
headers: {
|
|
274
251
|
'developer-token': `${process.env.ADWORDS_DEVELOPER_TOKEN}`
|
|
@@ -278,7 +255,13 @@ const action = {
|
|
|
278
255
|
partialFailure: true
|
|
279
256
|
}
|
|
280
257
|
});
|
|
281
|
-
|
|
258
|
+
if (typeof response.data === 'object' && response.data != null) {
|
|
259
|
+
Object.entries(response.data).forEach(([key, value]) => {
|
|
260
|
+
if (key === 'partialFailureError' && value.code !== 0) {
|
|
261
|
+
throw new actions_core_1.IntegrationError(value.message, 'INVALID_ARGUMENT', 400);
|
|
262
|
+
}
|
|
263
|
+
});
|
|
264
|
+
}
|
|
282
265
|
return response;
|
|
283
266
|
}
|
|
284
267
|
};
|
package/dist/destinations/google-enhanced-conversions/uploadConversionAdjustment/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/google-enhanced-conversions/uploadConversionAdjustment/index.ts"],"names":[],"mappings":";;AAAA,wDAA0E;AAC1E,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/google-enhanced-conversions/uploadConversionAdjustment/index.ts"],"names":[],"mappings":";;AAAA,wDAA0E;AAC1E,4CAAmC;AAInC,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,8BAA8B;IACrC,WAAW,EAAE,uDAAuD;IACpE,MAAM,EAAE;QACN,iBAAiB,EAAE;YACjB,KAAK,EAAE,sBAAsB;YAC7B,WAAW,EACT,gUAAgU;YAClU,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE,EAAE;SACZ;QACD,eAAe,EAAE;YACf,KAAK,EAAE,iBAAiB;YACxB,WAAW,EAAE,2EAA2E;YACxF,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,aAAa,EAAE;g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C,SAAS,CAAC;oBACvC,mBAAmB,EAAE,gBAAI,CAAC,OAAO,CAAC,cAAc,CAAC;oBACjD,IAAI,EAAE,OAAO,CAAC,IAAI;oBAClB,KAAK,EAAE,OAAO,CAAC,KAAK;oBACpB,WAAW,EAAE,OAAO,CAAC,OAAO;oBAC5B,UAAU,EAAE,OAAO,CAAC,WAAW;iBAChC;aACF,CAAC,CAAA;SACH;QAED,MAAM,QAAQ,GAAG,MAAM,OAAO,CAC5B,kDAAkD,QAAQ,CAAC,UAAU,8BAA8B,EACnG;YACE,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACP,iBAAiB,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,uBAAuB,EAAE;aAC5D;YACD,IAAI,EAAE;gBACJ,qBAAqB,EAAE,CAAC,cAAc,CAAC;gBACvC,cAAc,EAAE,IAAI;aACrB;SACF,CACF,CAAA;QAGD,IAAI,OAAO,QAAQ,CAAC,IAAI,KAAK,QAAQ,IAAI,QAAQ,CAAC,IAAI,IAAI,IAAI,EAAE;YAC9D,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;gBACrD,IAAI,GAAG,KAAK,qBAAqB,IAAI,KAAK,CAAC,IAAI,KAAK,CAAC,EAAE;oBACrD,MAAM,IAAI,+BAAgB,CAAC,KAAK,CAAC,OAAO,EAAE,kBAAkB,EAAE,GAAG,CAAC,CAAA;iBACnE;YACH,CAAC,CAAC,CAAA;SACH;QACD,OAAO,QAAQ,CAAA;IACjB,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -47,7 +47,6 @@ register('60ae8b97dcb6cc52d5d0d5ab', './google-enhanced-conversions');
|
|
|
47
47
|
register('627ea052118e3cd530d28963', './google-sheets');
|
|
48
48
|
register('62e184d538b54413fe754512', './heap');
|
|
49
49
|
register('624dddd054ced46facfdb9c0', './launchdarkly');
|
|
50
|
-
register('63360a5fe290ca3fdfad4a68', './loops');
|
|
51
50
|
register('62f435d1d311567bd5bf0e8d', './linkedin-audiences');
|
|
52
51
|
register('615c7438d93d9b61b1e9e192', './mixpanel');
|
|
53
52
|
register('61a8032ea5f157ee37a720be', './metronome');
|
|
@@ -56,6 +55,7 @@ register('62df16e45ba0058c864a75d1', './actions-pardot');
|
|
|
56
55
|
register('5f7dd8191ad74f868ab1fc48', './pipedrive');
|
|
57
56
|
register('62e17e6f687e4a3d32d0f875', './qualtrics');
|
|
58
57
|
register('61957755c4d820be968457de', './salesforce');
|
|
58
|
+
register('62e30bad99f1bfb98ee8ce08', './salesforce-marketing-cloud');
|
|
59
59
|
register('5f7dd8e302173ff732db5cc4', './slack');
|
|
60
60
|
register('6261a8b6cb4caa70e19116e8', './snap-conversions-api');
|
|
61
61
|
register('6234b137d3b6404a64f2a0f0', './talon-one');
|
|
@@ -65,7 +65,6 @@ register('614a3c7d791c91c41bae7599', './webhook');
|
|
|
65
65
|
register('61dc4e96894a6d7954cc6e45', './voyage');
|
|
66
66
|
register('62ded0cf5753c743883ca0f3', './intercom');
|
|
67
67
|
register('631a6f32946dd8197e9cab66', './sendgrid');
|
|
68
|
-
register('632b1116e0cb83902f3fd717', './hubspot');
|
|
69
68
|
function register(id, destinationPath) {
|
|
70
69
|
const definition = require(destinationPath).default;
|
|
71
70
|
const resolvedPath = require.resolve(destinationPath);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/destinations/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AACA,wDAAmD;AACnD,gDAAuB;AAWV,QAAA,YAAY,GAA0C,EAAE,CAAA;AACxD,QAAA,QAAQ,GAAsC,EAAE,CAAA;AAU7D,QAAQ,CAAC,0BAA0B,EAAE,UAAU,CAAC,CAAA;AAChD,QAAQ,CAAC,0BAA0B,EAAE,gBAAgB,CAAC,CAAA;AACtD,QAAQ,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BAAkB,CAAC,IAAY;IAC5C,MAAM,WAAW,GAAG,MAAM,kDAAO,KAAK,IAAI,EAAE,IAAE,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;IAGxE,IAAI,CAAC,WAAW,EAAE,IAAI,IAAI,OAAO,WAAW,EAAE,OAAO,KAAK,QAAQ,EAAE;QAClE,OAAO,IAAI,CAAA;KACZ;IAED,OAAO,WAAW,CAAA;AACpB,CAAC;AAED,KAAK,UAAU,uBAAuB,CAAC,GAAW;IAChD,MAAM,WAAW,GAAG,oBAAY,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,kBAAkB,CAAC,GAAG,CAAC,CAAC,CAAA;IAExE,IAAI,CAAC,WAAW,EAAE;QAChB,OAAO,IAAI,CAAA;KACZ;IAGD,OAAO,IAAI,0BAAW,CAAC,WAAyC,CAAC,CAAA;AACnE,CAAC;AAED,SAAgB,kBAAkB,CAAC,EAAU;IAC3C,MAAM,WAAW,GAAG,gBAAQ,CAAC,EAAE,CAAC,CAAA;IAEhC,IAAI,CAAC,WAAW,EAAE,UAAU,EAAE;QAC5B,OAAO,IAAI,CAAA;KACZ;IAED,OAAO,IAAI,0BAAW,CAAC,WAAW,CAAC,UAAU,CAAC,CAAA;AAChD,CAAC;AARD,gDAQC;AAEM,KAAK,UAAU,uBAAuB,CAAC,WAAmB;IAC/D,OAAO,kBAAkB,CAAC,WAAW,CAAC,IAAI,uBAAuB,CAAC,WAAW,CAAC,CAAA;AAChF,CAAC;AAFD,0DAEC"}
|
|
@@ -5,7 +5,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const updateAudience_1 = __importDefault(require("./updateAudience"));
|
|
7
7
|
const linkedin_properties_1 = require("./linkedin-properties");
|
|
8
|
-
const https_1 = __importDefault(require("https"));
|
|
9
8
|
const destination = {
|
|
10
9
|
name: 'Linkedin Audiences',
|
|
11
10
|
slug: 'actions-linkedin-audiences',
|
|
@@ -20,40 +19,15 @@ const destination = {
|
|
|
20
19
|
required: true
|
|
21
20
|
}
|
|
22
21
|
},
|
|
23
|
-
testAuthentication: async (request, {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
method: 'GET'
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
catch (e) {
|
|
34
|
-
if (e.message === 'Unauthorized') {
|
|
35
|
-
throw new Error('Invalid LinkedIn Oauth access token. Please reauthenticate to retrieve a valid access token before updating other settings and/or enabling the destination.');
|
|
36
|
-
}
|
|
37
|
-
throw e;
|
|
38
|
-
}
|
|
39
|
-
const userId = firstRes?.data?.id;
|
|
40
|
-
let secondRes;
|
|
41
|
-
try {
|
|
42
|
-
secondRes = await request(`https://api.linkedin.com/rest/adAccountUsers/account=urn:li:sponsoredAccount:${settings.ad_account_id}&user=urn:li:person:${userId}`, {
|
|
43
|
-
method: 'GET'
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
catch (e) {
|
|
47
|
-
if (e.message === 'Not Found') {
|
|
48
|
-
throw new Error('Invalid LinkedIn Ad Account id. Please verify that the LinkedIn Ad Account exists and that you have access to it.');
|
|
22
|
+
testAuthentication: async (request, { auth, settings }) => {
|
|
23
|
+
return request(`https://api.linkedin.com/rest/adAccountsV2/${settings.ad_account_id}`, {
|
|
24
|
+
method: 'POST',
|
|
25
|
+
headers: {
|
|
26
|
+
'X-Restli-Protocol-Version': '2.0.0',
|
|
27
|
+
'LinkedIn-Version': linkedin_properties_1.LINKEDIN_API_VERSION,
|
|
28
|
+
authorization: auth.accessToken
|
|
49
29
|
}
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
const userRole = secondRes?.data.role;
|
|
53
|
-
if (userRole === 'VIEWER') {
|
|
54
|
-
throw new Error("It looks like you don't have access to this LinkedIn Ad Account. Please reach out to a LinkedIn Ad Account Admin on your team to grant access.");
|
|
55
|
-
}
|
|
56
|
-
return true;
|
|
30
|
+
});
|
|
57
31
|
},
|
|
58
32
|
refreshAccessToken: async (request, { auth }) => {
|
|
59
33
|
const res = await request('https://www.linkedin.com/oauth/v2/accessToken', {
|
|
@@ -69,13 +43,12 @@ const destination = {
|
|
|
69
43
|
}
|
|
70
44
|
},
|
|
71
45
|
extendRequest({ auth }) {
|
|
72
|
-
const agent = new https_1.default.Agent({ keepAlive: true });
|
|
73
46
|
return {
|
|
74
47
|
headers: {
|
|
75
48
|
authorization: `Bearer ${auth?.accessToken}`,
|
|
76
|
-
'LinkedIn-Version': linkedin_properties_1.LINKEDIN_API_VERSION
|
|
77
|
-
|
|
78
|
-
|
|
49
|
+
'LinkedIn-Version': linkedin_properties_1.LINKEDIN_API_VERSION,
|
|
50
|
+
'Content-Type': 'application/json'
|
|
51
|
+
}
|
|
79
52
|
};
|
|
80
53
|
},
|
|
81
54
|
actions: {
|