@segment/action-destinations 3.112.1-alpha.9 → 3.113.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.
Files changed (59) hide show
  1. package/dist/destinations/clevertap/index.js +1 -1
  2. package/dist/destinations/google-enhanced-conversions/functions.d.ts +1 -0
  3. package/dist/destinations/google-enhanced-conversions/functions.js +8 -1
  4. package/dist/destinations/google-enhanced-conversions/functions.js.map +1 -1
  5. package/dist/destinations/google-enhanced-conversions/uploadCallConversion/index.js +2 -2
  6. package/dist/destinations/google-enhanced-conversions/uploadCallConversion/index.js.map +1 -1
  7. package/dist/destinations/google-enhanced-conversions/uploadClickConversion/index.js +1 -1
  8. package/dist/destinations/google-enhanced-conversions/uploadClickConversion/index.js.map +1 -1
  9. package/dist/destinations/google-enhanced-conversions/uploadConversionAdjustment/index.js +8 -44
  10. package/dist/destinations/google-enhanced-conversions/uploadConversionAdjustment/index.js.map +1 -1
  11. package/dist/destinations/hubspot/errors.d.ts +17 -0
  12. package/dist/destinations/hubspot/errors.js +30 -0
  13. package/dist/destinations/hubspot/errors.js.map +1 -0
  14. package/dist/destinations/hubspot/index.js +5 -3
  15. package/dist/destinations/hubspot/index.js.map +1 -1
  16. package/dist/destinations/hubspot/properties.d.ts +3 -1
  17. package/dist/destinations/hubspot/properties.js +4 -2
  18. package/dist/destinations/hubspot/properties.js.map +1 -1
  19. package/dist/destinations/hubspot/sendCustomBehavioralEvent/index.js +2 -2
  20. package/dist/destinations/hubspot/sendCustomBehavioralEvent/index.js.map +1 -1
  21. package/dist/destinations/hubspot/upsertCompany/generated-types.d.ts +21 -0
  22. package/dist/destinations/hubspot/upsertCompany/generated-types.js +3 -0
  23. package/dist/destinations/hubspot/upsertCompany/generated-types.js.map +1 -0
  24. package/dist/destinations/hubspot/upsertCompany/index.d.ts +5 -0
  25. package/dist/destinations/hubspot/upsertCompany/index.js +321 -0
  26. package/dist/destinations/hubspot/upsertCompany/index.js.map +1 -0
  27. package/dist/destinations/hubspot/upsertContact/index.js +5 -5
  28. package/dist/destinations/hubspot/upsertContact/index.js.map +1 -1
  29. package/dist/destinations/hubspot/upsertCustomObjectRecord/index.js +39 -10
  30. package/dist/destinations/hubspot/upsertCustomObjectRecord/index.js.map +1 -1
  31. package/dist/destinations/linkedin-audiences/generated-types.d.ts +0 -2
  32. package/dist/destinations/linkedin-audiences/index.js +20 -49
  33. package/dist/destinations/linkedin-audiences/index.js.map +1 -1
  34. package/dist/destinations/linkedin-audiences/linkedin-properties.d.ts +1 -0
  35. package/dist/destinations/linkedin-audiences/linkedin-properties.js +5 -0
  36. package/dist/destinations/linkedin-audiences/linkedin-properties.js.map +1 -0
  37. package/dist/destinations/linkedin-audiences/updateAudience/generated-types.d.ts +2 -0
  38. package/dist/destinations/linkedin-audiences/updateAudience/index.js +63 -26
  39. package/dist/destinations/linkedin-audiences/updateAudience/index.js.map +1 -1
  40. package/dist/destinations/mixpanel/identifyUser/generated-types.d.ts +1 -0
  41. package/dist/destinations/mixpanel/identifyUser/index.js +9 -0
  42. package/dist/destinations/mixpanel/identifyUser/index.js.map +1 -1
  43. package/dist/destinations/mixpanel/trackPurchase/index.js +18 -6
  44. package/dist/destinations/mixpanel/trackPurchase/index.js.map +1 -1
  45. package/dist/destinations/sendgrid/sendgrid-properties.js +2 -1
  46. package/dist/destinations/sendgrid/sendgrid-properties.js.map +1 -1
  47. package/package.json +4 -4
  48. package/dist/destinations/hubspot/testHelper.d.ts +0 -7
  49. package/dist/destinations/hubspot/testHelper.js +0 -24
  50. package/dist/destinations/hubspot/testHelper.js.map +0 -1
  51. package/dist/destinations/linkedin-audiences/api/index.d.ts +0 -13
  52. package/dist/destinations/linkedin-audiences/api/index.js +0 -62
  53. package/dist/destinations/linkedin-audiences/api/index.js.map +0 -1
  54. package/dist/destinations/linkedin-audiences/constants.d.ts +0 -2
  55. package/dist/destinations/linkedin-audiences/constants.js +0 -6
  56. package/dist/destinations/linkedin-audiences/constants.js.map +0 -1
  57. package/dist/destinations/linkedin-audiences/types.d.ts +0 -28
  58. package/dist/destinations/linkedin-audiences/types.js +0 -11
  59. package/dist/destinations/linkedin-audiences/types.js.map +0 -1
@@ -0,0 +1,321 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const properties_1 = require("../properties");
4
+ const errors_1 = require("../errors");
5
+ var CompanySearchFilterOperator;
6
+ (function (CompanySearchFilterOperator) {
7
+ CompanySearchFilterOperator["EQ"] = "EQ";
8
+ CompanySearchFilterOperator["NEQ"] = "NEQ";
9
+ CompanySearchFilterOperator["LT"] = "LT";
10
+ CompanySearchFilterOperator["LTE"] = "LTE";
11
+ CompanySearchFilterOperator["GT"] = "GT";
12
+ CompanySearchFilterOperator["GTE"] = "GTE";
13
+ CompanySearchFilterOperator["BETWEEN"] = "BETWEEN";
14
+ CompanySearchFilterOperator["IN"] = "IN";
15
+ CompanySearchFilterOperator["NOT_IN"] = "NOT_IN";
16
+ CompanySearchFilterOperator["HAS_PROPERTY"] = "HAS_PROPERTY";
17
+ CompanySearchFilterOperator["NOT_HAS_PROPERTY"] = "NOT_HAS_PROPERTY";
18
+ CompanySearchFilterOperator["CONTAINS_TOKEN"] = "CONTAINS_TOKEN";
19
+ CompanySearchFilterOperator["NOT_CONTAINS_TOKEN"] = "NOT_CONTAINS_TOKEN";
20
+ })(CompanySearchFilterOperator || (CompanySearchFilterOperator = {}));
21
+ const action = {
22
+ title: 'Upsert Company',
23
+ description: 'Create or update a company in HubSpot.',
24
+ defaultSubscription: 'type = "group"',
25
+ fields: {
26
+ groupid: {
27
+ label: 'Group ID',
28
+ description: `Used for constructing the unique ${properties_1.SEGMENT_UNIQUE_IDENTIFIER} for HubSpot.`,
29
+ type: 'hidden',
30
+ required: true,
31
+ default: {
32
+ '@if': {
33
+ exists: { '@path': '$.groupId' },
34
+ then: { '@path': '$.groupId' },
35
+ else: { '@path': '$.context.groupId' }
36
+ }
37
+ }
38
+ },
39
+ companysearchfields: {
40
+ label: 'Company Search Fields',
41
+ description: 'The unique field(s) used to search for an existing company in HubSpot to update. By default, Segment creates a custom property to store groupId for each company and uses this property to search for companies. If a company is not found, the fields provided here are then used to search. If a company is still not found, a new one is created.',
42
+ type: 'object',
43
+ required: true,
44
+ defaultObjectUI: 'keyvalue:only'
45
+ },
46
+ name: {
47
+ label: 'Company Name',
48
+ description: 'The name of the company.',
49
+ type: 'string',
50
+ required: true,
51
+ default: {
52
+ '@path': '$.traits.name'
53
+ }
54
+ },
55
+ description: {
56
+ label: 'Company Description',
57
+ description: 'A short statement about the company’s mission and goals.',
58
+ type: 'string',
59
+ default: {
60
+ '@path': '$.traits.description'
61
+ }
62
+ },
63
+ createdate: {
64
+ label: 'Company Create Date',
65
+ description: 'The date the company was added to your account.',
66
+ type: 'string',
67
+ default: {
68
+ '@path': '$.traits.createdAt'
69
+ }
70
+ },
71
+ address: {
72
+ label: 'Street Address',
73
+ description: 'The street address of the company.',
74
+ type: 'string',
75
+ default: {
76
+ '@path': '$.traits.address.street'
77
+ }
78
+ },
79
+ city: {
80
+ label: 'City',
81
+ description: 'The city where the company is located.',
82
+ type: 'string',
83
+ default: {
84
+ '@path': '$.traits.address.city'
85
+ }
86
+ },
87
+ state: {
88
+ label: 'State',
89
+ description: 'The state or region where the company is located.',
90
+ type: 'string',
91
+ default: {
92
+ '@path': '$.traits.address.state'
93
+ }
94
+ },
95
+ zip: {
96
+ label: 'Postal Code',
97
+ description: 'The postal or zip code of the company.',
98
+ type: 'string',
99
+ default: {
100
+ '@if': {
101
+ exists: { '@path': '$.traits.address.postalCode' },
102
+ then: { '@path': '$.traits.address.postalCode' },
103
+ else: { '@path': '$.traits.address.postal_code' }
104
+ }
105
+ }
106
+ },
107
+ domain: {
108
+ label: 'Domain',
109
+ description: 'The company’s website domain.',
110
+ type: 'string',
111
+ default: {
112
+ '@path': '$.traits.website'
113
+ }
114
+ },
115
+ phone: {
116
+ label: 'Phone',
117
+ description: 'The company’s primary phone number.',
118
+ type: 'string',
119
+ default: {
120
+ '@path': '$.traits.phone'
121
+ }
122
+ },
123
+ numberofemployees: {
124
+ label: 'Number of Employees',
125
+ description: 'The total number of people who work for the company.',
126
+ type: 'integer',
127
+ default: {
128
+ '@path': '$.traits.employees'
129
+ }
130
+ },
131
+ industry: {
132
+ label: 'Industry',
133
+ description: 'The type of business the company performs.',
134
+ type: 'string',
135
+ default: {
136
+ '@path': '$.traits.industry'
137
+ }
138
+ },
139
+ lifecyclestage: {
140
+ label: 'Lifecycle Stage',
141
+ description: 'The company’s stage within the marketing/sales process. See more information on default and custom stages in [HubSpot’s documentation](https://knowledge.hubspot.com/contacts/use-lifecycle-stages). Segment supports moving status forwards or backwards.',
142
+ type: 'string'
143
+ },
144
+ properties: {
145
+ label: 'Other Properties',
146
+ description: `Any other default or custom company properties. On the left-hand side, input the internal name of the property as seen in your HubSpot account. On the right-hand side, map the Segment field that contains the value. Custom properties must be predefined in HubSpot. See more information in [HubSpot’s documentation](https://knowledge.hubspot.com/crm-setup/manage-your-properties#create-custom-properties). Important: Do not use ’${properties_1.SEGMENT_UNIQUE_IDENTIFIER}’ here as it is an internal property and will result in an an error.`,
147
+ type: 'object',
148
+ defaultObjectUI: 'keyvalue:only',
149
+ allowNull: false
150
+ }
151
+ },
152
+ perform: async (request, { payload, transactionContext }) => {
153
+ if (payload.properties?.[properties_1.SEGMENT_UNIQUE_IDENTIFIER]) {
154
+ throw errors_1.RestrictedPropertyThrowableError;
155
+ }
156
+ if (!transactionContext?.transaction?.contact_id) {
157
+ throw errors_1.MissingIdentityCallThrowableError;
158
+ }
159
+ const companyProperties = {
160
+ name: payload.name,
161
+ description: payload.description,
162
+ createdate: payload.createdate,
163
+ address: payload.address,
164
+ city: payload.city,
165
+ state: payload.state,
166
+ zip: payload.zip,
167
+ domain: payload.domain,
168
+ phone: payload.phone,
169
+ numberofemployees: payload.numberofemployees,
170
+ industry: payload.industry,
171
+ lifecyclestage: payload.lifecyclestage?.toLocaleLowerCase(),
172
+ [properties_1.SEGMENT_UNIQUE_IDENTIFIER]: payload.groupid,
173
+ ...payload.properties
174
+ };
175
+ let companyId = '';
176
+ try {
177
+ const updateCompanyResponse = await updateCompany(request, payload.groupid, companyProperties, properties_1.SEGMENT_UNIQUE_IDENTIFIER);
178
+ companyId = updateCompanyResponse.data.id;
179
+ }
180
+ catch (e) {
181
+ const error = e;
182
+ if (errors_1.isSegmentUniqueIdentifierPropertyError(error, properties_1.SEGMENT_UNIQUE_IDENTIFIER)) {
183
+ await createSegmentUniqueIdentifierProperty(request);
184
+ throw errors_1.SegmentUniqueIdentifierMissingRetryableError;
185
+ }
186
+ if (error?.response?.status !== 404 &&
187
+ !errors_1.isSegmentUniqueIdentifierPropertyError(error, properties_1.SEGMENT_UNIQUE_IDENTIFIER)) {
188
+ throw e;
189
+ }
190
+ }
191
+ if (!companyId) {
192
+ let searchCompanyResponse = null;
193
+ if (typeof payload.companysearchfields === 'object' && Object.keys(payload.companysearchfields).length > 0) {
194
+ try {
195
+ searchCompanyResponse = await searchCompany(request, { ...payload.companysearchfields });
196
+ }
197
+ catch (e) {
198
+ if (e?.response?.status === 400) {
199
+ throw errors_1.CompanySearchThrowableError;
200
+ }
201
+ throw e;
202
+ }
203
+ }
204
+ if (!searchCompanyResponse || searchCompanyResponse.data.total === 0) {
205
+ const createCompanyWrapper = function () {
206
+ return createCompany(request, companyProperties);
207
+ };
208
+ companyId = await upsertCompanyWithRetry(request, createCompanyWrapper);
209
+ }
210
+ else {
211
+ if (searchCompanyResponse.data.total > 1) {
212
+ throw errors_1.MultipleCompaniesInSearchResultThrowableError;
213
+ }
214
+ companyId = searchCompanyResponse.data.results[0].id;
215
+ const updateCompanyWrapper = function () {
216
+ return updateCompany(request, companyId, companyProperties);
217
+ };
218
+ await upsertCompanyWithRetry(request, updateCompanyWrapper);
219
+ }
220
+ }
221
+ await associateCompanyToContact(request, companyId, transactionContext?.transaction?.['contact_id'], properties_1.ASSOCIATION_TYPE);
222
+ }
223
+ };
224
+ function searchCompany(request, companySearchFields) {
225
+ const responseProperties = ['name', 'domain', 'lifecyclestage', properties_1.SEGMENT_UNIQUE_IDENTIFIER];
226
+ const responseSortBy = ['name'];
227
+ const companySearchPayload = {
228
+ filterGroups: [],
229
+ properties: [...responseProperties],
230
+ sorts: [...responseSortBy]
231
+ };
232
+ for (const [key, value] of Object.entries(companySearchFields)) {
233
+ companySearchPayload.filterGroups.push({
234
+ filters: [
235
+ {
236
+ propertyName: key,
237
+ operator: CompanySearchFilterOperator.EQ,
238
+ value
239
+ }
240
+ ]
241
+ });
242
+ }
243
+ return request(`${properties_1.HUBSPOT_BASE_URL}/crm/v3/objects/companies/search`, {
244
+ method: 'POST',
245
+ json: {
246
+ ...companySearchPayload
247
+ }
248
+ });
249
+ }
250
+ function createCompany(request, properties) {
251
+ return request(`${properties_1.HUBSPOT_BASE_URL}/crm/v3/objects/companies`, {
252
+ method: 'POST',
253
+ json: {
254
+ properties: {
255
+ ...properties
256
+ }
257
+ }
258
+ });
259
+ }
260
+ function updateCompany(request, uniqueIdentifier, properties, idProperty) {
261
+ const updateCompanyURL = `${properties_1.HUBSPOT_BASE_URL}/crm/v3/objects/companies/${uniqueIdentifier}` + (idProperty ? `?idProperty=${idProperty}` : '');
262
+ return request(updateCompanyURL, {
263
+ method: 'PATCH',
264
+ json: {
265
+ properties: {
266
+ ...properties
267
+ }
268
+ }
269
+ });
270
+ }
271
+ function createSegmentUniqueIdentifierProperty(request) {
272
+ const segmentUniqueIdentifierProperty = {
273
+ name: properties_1.SEGMENT_UNIQUE_IDENTIFIER,
274
+ label: 'Segment Group ID',
275
+ description: 'Unique Property to map Segment Group ID with a HubSpot Company Object',
276
+ groupName: 'companyinformation',
277
+ type: 'string',
278
+ fieldType: 'text',
279
+ hidden: true,
280
+ displayOrder: -1,
281
+ hasUniqueValue: true,
282
+ formField: false
283
+ };
284
+ return request(`${properties_1.HUBSPOT_BASE_URL}/crm/v3/properties/companies`, {
285
+ method: 'POST',
286
+ json: {
287
+ ...segmentUniqueIdentifierProperty
288
+ }
289
+ });
290
+ }
291
+ function associateCompanyToContact(request, companyId, contactId, associationType) {
292
+ return request(`${properties_1.HUBSPOT_BASE_URL}/crm/v3/objects/companies/${companyId}/associations/contacts/${contactId}/${associationType}`, {
293
+ method: 'PUT'
294
+ });
295
+ }
296
+ async function upsertCompanyWithRetry(request, upsertCompanyFunction) {
297
+ try {
298
+ const upsertCompanyResponse = await upsertCompanyFunction();
299
+ return upsertCompanyResponse.data.id;
300
+ }
301
+ catch (e) {
302
+ const error = e;
303
+ if (errors_1.isSegmentUniqueIdentifierPropertyError(error, properties_1.SEGMENT_UNIQUE_IDENTIFIER)) {
304
+ try {
305
+ await createSegmentUniqueIdentifierProperty(request);
306
+ }
307
+ catch (e) {
308
+ if (e?.response?.status !== 409) {
309
+ throw e;
310
+ }
311
+ }
312
+ const upsertCompanyResponse = await upsertCompanyFunction();
313
+ return upsertCompanyResponse.data.id;
314
+ }
315
+ else {
316
+ throw e;
317
+ }
318
+ }
319
+ }
320
+ exports.default = action;
321
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/hubspot/upsertCompany/index.ts"],"names":[],"mappings":";;AAGA,8CAA6F;AAC7F,sCAQkB;AAElB,IAAK,2BAcJ;AAdD,WAAK,2BAA2B;IAC9B,wCAAS,CAAA;IACT,0CAAW,CAAA;IACX,wCAAS,CAAA;IACT,0CAAW,CAAA;IACX,wCAAS,CAAA;IACT,0CAAW,CAAA;IACX,kDAAmB,CAAA;IACnB,wCAAS,CAAA;IACT,gDAAiB,CAAA;IACjB,4DAA6B,CAAA;IAC7B,oEAAqC,CAAA;IACrC,gEAAiC,CAAA;IACjC,wEAAyC,CAAA;AAC3C,CAAC,EAdI,2BAA2B,KAA3B,2BAA2B,QAc/B;AAkFD,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,gBAAgB;IACvB,WAAW,EAAE,wCAAwC;IACrD,mBAA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AC,OAAsB,EAAE,qBAA4C;IACxG,IAAI;QACF,MAAM,qBAAqB,GAAG,MAAM,qBAAqB,EAAE,CAAA;QAC3D,OAAO,qBAAqB,CAAC,IAAI,CAAC,EAAE,CAAA;KACrC;IAAC,OAAO,CAAC,EAAE;QACV,MAAM,KAAK,GAAG,CAAiB,CAAA;QAC/B,IAAI,+CAAsC,CAAC,KAAK,EAAE,sCAAyB,CAAC,EAAE;YAI5E,IAAI;gBAEF,MAAM,qCAAqC,CAAC,OAAO,CAAC,CAAA;aACrD;YAAC,OAAO,CAAC,EAAE;gBAGV,IAAK,CAAe,EAAE,QAAQ,EAAE,MAAM,KAAK,GAAG,EAAE;oBAC9C,MAAM,CAAC,CAAA;iBACR;aACF;YAGD,MAAM,qBAAqB,GAAG,MAAM,qBAAqB,EAAE,CAAA;YAC3D,OAAO,qBAAqB,CAAC,IAAI,CAAC,EAAE,CAAA;SACrC;aAAM;YACL,MAAM,CAAC,CAAA;SACR;KACF;AACH,CAAC;AAED,kBAAe,MAAM,CAAA"}
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const actions_core_1 = require("@segment/actions-core");
4
3
  const properties_1 = require("../properties");
5
4
  const action = {
6
5
  title: 'Upsert Contact',
@@ -117,7 +116,7 @@ const action = {
117
116
  properties: {
118
117
  label: 'Other properties',
119
118
  type: 'object',
120
- description: 'Any other default or custom contact properties. Custom properties must be predefined in HubSpot. See more information in [HubSpot’s documentation](https://knowledge.hubspot.com/crm-setup/manage-your-properties#create-custom-properties).',
119
+ description: 'Any other default or custom contact properties. On the left-hand side, input the internal name of the property as seen in your HubSpot account. On the right-hand side, map the Segment field that contains the value. Custom properties must be predefined in HubSpot. See more information in [HubSpot’s documentation](https://knowledge.hubspot.com/crm-setup/manage-your-properties#create-custom-properties).',
121
120
  defaultObjectUI: 'keyvalue:only'
122
121
  }
123
122
  },
@@ -133,6 +132,7 @@ const action = {
133
132
  country: payload.country,
134
133
  zip: payload.zip,
135
134
  email: payload.email,
135
+ website: payload.website,
136
136
  lifecyclestage: payload.lifecyclestage?.toLowerCase(),
137
137
  ...payload.properties
138
138
  };
@@ -150,7 +150,7 @@ const action = {
150
150
  return response;
151
151
  }
152
152
  catch (ex) {
153
- if (ex instanceof actions_core_1.HTTPError && ex.response.status == 404) {
153
+ if (ex?.response.status == 404) {
154
154
  const result = await createContact(request, contactProperties);
155
155
  transactionContext?.setTransaction('contact_id', result.data.id);
156
156
  return result;
@@ -160,7 +160,7 @@ const action = {
160
160
  }
161
161
  };
162
162
  async function createContact(request, contactProperties) {
163
- return request(`${properties_1.hubSpotBaseURL}/crm/v3/objects/contacts`, {
163
+ return request(`${properties_1.HUBSPOT_BASE_URL}/crm/v3/objects/contacts`, {
164
164
  method: 'POST',
165
165
  json: {
166
166
  properties: {
@@ -170,7 +170,7 @@ async function createContact(request, contactProperties) {
170
170
  });
171
171
  }
172
172
  async function updateContact(request, email, properties) {
173
- return request(`${properties_1.hubSpotBaseURL}/crm/v3/objects/contacts/${email}?idProperty=email`, {
173
+ return request(`${properties_1.HUBSPOT_BASE_URL}/crm/v3/objects/contacts/${email}?idProperty=email`, {
174
174
  method: 'PATCH',
175
175
  json: {
176
176
  properties: {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/hubspot/upsertContact/index.ts"],"names":[],"mappings":";;AAAA,wDAAiD;AAGjD,8CAA8C;AAQ9C,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,gBAAgB;IACvB,WAAW,EAAE,wCAAwC;IACrD,mBAAmB,EAAE,mBAAmB;IACxC,MAAM,EAAE;QACN,KAAK,EAAE;YACL,KAAK,EAAE,OAAO;YACd,IAAI,EAAE,QAAQ;YACd,WAAW,EACT,2NAA2N;YAC7N,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE,OAAO;YACf,OAAO,EAAE;gBACP,OAAO,EAAE,gBAAgB;aAC1B;SACF;QACD,OAAO,E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E,CAAA;SACT;IACH,CAAC;CACF,CAAA;AAED,KAAK,UAAU,aAAa,CAAC,OAAsB,EAAE,iBAA6C;IAChG,OAAO,OAAO,CAAkB,GAAG,2BAAc,0BAA0B,EAAE;QAC3E,MAAM,EAAE,MAAM;QACd,IAAI,EAAE;YACJ,UAAU,EAAE;gBACV,GAAG,iBAAiB;aACrB;SACF;KACF,CAAC,CAAA;AACJ,CAAC;AAED,KAAK,UAAU,aAAa,CAAC,OAAsB,EAAE,KAAa,EAAE,UAAsC;IACxG,OAAO,OAAO,CAAkB,GAAG,2BAAc,4BAA4B,KAAK,mBAAmB,EAAE;QACrG,MAAM,EAAE,OAAO;QACf,IAAI,EAAE;YACJ,UAAU,EAAE;gBACV,GAAG,UAAU;aACd;SACF;KACF,CAAC,CAAA;AACJ,CAAC;AAED,kBAAe,MAAM,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/hubspot/upsertContact/index.ts"],"names":[],"mappings":";;AAIA,8CAAgD;AAOhD,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,gBAAgB;IACvB,WAAW,EAAE,wCAAwC;IACrD,mBAAmB,EAAE,mBAAmB;IACxC,MAAM,EAAE;QACN,KAAK,EAAE;YACL,KAAK,EAAE,OAAO;YACd,IAAI,EAAE,QAAQ;YACd,WAAW,EACT,2NAA2N;YAC7N,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE,OAAO;YACf,OAAO,EAAE;gBACP,OAAO,EAAE,gBAAgB;aAC1B;SACF;QACD,OAAO,EAAE;YACP,KAAK,EAAE,cAAc;YACrB,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,wBAAwB;YACrC,OAAO,EAAE;gBACP,OAAO,EAAE,kBAAkB;aAC5B;SACF;QACD,SAAS,EAAE;YACT,KAAK,EAAE,YAAY;YACnB,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,2BAA2B;YACxC,OAAO,EAAE;gBACP,KAAK,EAAE;oBACL,MAAM,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C;AAED,KAAK,UAAU,aAAa,CAAC,OAAsB,EAAE,KAAa,EAAE,UAAsC;IACxG,OAAO,OAAO,CAAkB,GAAG,6BAAgB,4BAA4B,KAAK,mBAAmB,EAAE;QACvG,MAAM,EAAE,OAAO;QACf,IAAI,EAAE;YACJ,UAAU,EAAE;gBACV,GAAG,UAAU;aACd;SACF;KACF,CAAC,CAAA;AACJ,CAAC;AAED,kBAAe,MAAM,CAAA"}
@@ -1,32 +1,33 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const actions_core_1 = require("@segment/actions-core");
4
- const hubspotDefinedObjects = ['deals', 'tickets'];
5
- const customObjectExpression = new RegExp('^[a-zA-Z0-9]+_[a-zA-Z][a-zA-Z0-9_-]+$');
3
+ const properties_1 = require("../properties");
6
4
  const action = {
7
5
  title: 'Create Custom Object Record',
8
6
  description: 'Create records in any HubSpot standard or custom object.',
9
7
  fields: {
10
8
  objectType: {
11
9
  label: 'Object Type',
12
- description: 'The CRM object schema to use for creating a record. This can be a standard object (i.e. tickets, deals) or ***fullyQualifiedName*** of a custom object. Schema for the Custom Objects must be predefined in HubSpot. More information on Custom Objects and *fullyQualifiedName* in [HubSpot documentation](https://developers.hubspot.com/docs/cms/data/crm-objects#getting-a-custom-object-type-s-details).',
10
+ description: 'The CRM object schema to use for creating a record. This can be a standard object (i.e. tickets, deals) or ***fullyQualifiedName*** of a custom object. Schema for the Custom Objects must be predefined in HubSpot. More information on Custom Objects and *fullyQualifiedName* in [HubSpot documentation](https://developers.hubspot.com/docs/api/crm/crm-custom-objects#retrieve-existing-custom-objects).',
13
11
  type: 'string',
14
- required: true
12
+ required: true,
13
+ dynamic: true
15
14
  },
16
15
  properties: {
17
16
  label: 'Properties',
18
- description: 'Properties to send to HubSpot. Please make sure to include the object’s required properties. Any custom properties must be predefined in HubSpot. More information in [HubSpot documentation](https://knowledge.hubspot.com/crm-setup/manage-your-properties#create-custom-properties).',
17
+ description: 'Properties to send to HubSpot. On the left-hand side, input the internal name of the property as seen in your HubSpot account. On the right-hand side, map the Segment field that contains the value. Please make sure to include the object’s required properties. Any custom properties must be predefined in HubSpot. More information in [HubSpot documentation](https://knowledge.hubspot.com/crm-setup/manage-your-properties#create-custom-properties).',
19
18
  type: 'object',
20
19
  required: true,
21
20
  defaultObjectUI: 'keyvalue:only',
22
21
  allowNull: false
23
22
  }
24
23
  },
25
- perform: async (request, { payload }) => {
26
- if (!customObjectExpression.test(payload.objectType) && !hubspotDefinedObjects.includes(payload.objectType)) {
27
- throw new actions_core_1.IntegrationError('Custom Object is not in valid format. Please make sure that you are using either a valid format of object’s fullyQualifiedName (eg: p11223344_myobject) or a supported HubSpot defined object (i.e.: deals, tickets).', 'Custom Object is not in valid format', 400);
24
+ dynamicFields: {
25
+ objectType: async (request, _) => {
26
+ return getCustomObjects(request);
28
27
  }
29
- return request(`https://api.hubapi.com/crm/v3/objects/${payload.objectType}`, {
28
+ },
29
+ perform: async (request, { payload }) => {
30
+ return request(`${properties_1.HUBSPOT_BASE_URL}/crm/v3/objects/${payload.objectType}`, {
30
31
  method: 'POST',
31
32
  json: {
32
33
  properties: { ...payload.properties }
@@ -34,5 +35,33 @@ const action = {
34
35
  });
35
36
  }
36
37
  };
38
+ async function getCustomObjects(request) {
39
+ const defaultChoices = [
40
+ { value: 'deals', label: 'Deals' },
41
+ { value: 'tickets', label: 'Tickets' }
42
+ ];
43
+ try {
44
+ const response = await request(`${properties_1.HUBSPOT_BASE_URL}/crm/v3/schemas?archived=false`, {
45
+ method: 'GET',
46
+ skipResponseCloning: true
47
+ });
48
+ const choices = response.data.results.map((schema) => ({
49
+ label: schema.labels.plural,
50
+ value: schema.fullyQualifiedName
51
+ }));
52
+ return {
53
+ choices: [...choices, ...defaultChoices]
54
+ };
55
+ }
56
+ catch (err) {
57
+ return {
58
+ choices: [],
59
+ error: {
60
+ message: err?.response?.data?.message ?? 'Unknown error',
61
+ code: err?.response?.data?.category ?? 'Unknown code'
62
+ }
63
+ };
64
+ }
65
+ }
37
66
  exports.default = action;
38
67
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/hubspot/upsertCustomObjectRecord/index.ts"],"names":[],"mappings":";;AACA,wDAAwD;AAKxD,MAAM,qBAAqB,GAAa,CAAC,OAAO,EAAE,SAAS,CAAC,CAAA;AAK5D,MAAM,sBAAsB,GAAG,IAAI,MAAM,CAAC,uCAAuC,CAAC,CAAA;AAIlF,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,6BAA6B;IACpC,WAAW,EAAE,0DAA0D;IACvE,MAAM,EAAE;QACN,UAAU,EAAE;YACV,KAAK,EAAE,aAAa;YACpB,WAAW,EACT,+YAA+Y;YACjZ,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;SACf;QACD,UAAU,EAAE;YACV,KAAK,EAAE,YAAY;YACnB,WAAW,EACT,yRAAyR;YAC3R,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,eAAe,EAAE,eAAe;YAChC,SAAS,EAAE,KAAK;SACjB;KACF;IACD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QAEtC,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,qBAAqB,CAAC,QAAQ,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE;YAC3G,MAAM,IAAI,+BAAgB,CACxB,uNAAuN,EACvN,sCAAsC,EACtC,GAAG,CACJ,CAAA;SACF;QAED,OAAO,OAAO,CAAC,yCAAyC,OAAO,CAAC,UAAU,EAAE,EAAE;YAC5E,MAAM,EAAE,MAAM;YACd,IAAI,EAAE;gBACJ,UAAU,EAAE,EAAE,GAAG,OAAO,CAAC,UAAU,EAAE;aACtC;SACF,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/hubspot/upsertCustomObjectRecord/index.ts"],"names":[],"mappings":";;AAIA,8CAAgD;AAchD,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,6BAA6B;IACpC,WAAW,EAAE,0DAA0D;IACvE,MAAM,EAAE;QACN,UAAU,EAAE;YACV,KAAK,EAAE,aAAa;YACpB,WAAW,EACT,+YAA+Y;YACjZ,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE,IAAI;SACd;QACD,UAAU,EAAE;YACV,KAAK,EAAE,YAAY;YACnB,WAAW,EACT,gcAAgc;YAClc,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,eAAe,EAAE,eAAe;YAChC,SAAS,EAAE,KAAK;SACjB;KACF;IACD,aAAa,EAAE;QACb,UAAU,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,EAAE,EAAE;YAC/B,OAAO,gBAAgB,CAAC,OAAO,CAAC,CAAA;QAClC,CAAC;KACF;IACD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QACtC,OAAO,OAAO,CAAC,GAAG,6BAAgB,mBAAmB,OAAO,CAAC,UAAU,EAAE,EAAE;YACzE,MAAM,EAAE,MAAM;YACd,IAAI,EAAE;gBACJ,UAAU,EAAE,EAAE,GAAG,OAAO,CAAC,UAAU,EAAE;aACtC;SACF,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,KAAK,UAAU,gBAAgB,CAAC,OAAsB;IAEpD,MAAM,cAAc,GAAG;QACrB,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE;QAClC,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE;KACvC,CAAA;IAED,IAAI;QAGF,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAqB,GAAG,6BAAgB,gCAAgC,EAAE;YACtG,MAAM,EAAE,KAAK;YACb,mBAAmB,EAAE,IAAI;SAC1B,CAAC,CAAA;QACF,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;YACrD,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM;YAC3B,KAAK,EAAE,MAAM,CAAC,kBAAkB;SACjC,CAAC,CAAC,CAAA;QACH,OAAO;YACL,OAAO,EAAE,CAAC,GAAG,OAAO,EAAE,GAAG,cAAc,CAAC;SACzC,CAAA;KACF;IAAC,OAAO,GAAG,EAAE;QACZ,OAAO;YACL,OAAO,EAAE,EAAE;YACX,KAAK,EAAE;gBACL,OAAO,EAAG,GAAoB,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,IAAI,eAAe;gBAC1E,IAAI,EAAG,GAAoB,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,IAAI,cAAc;aACxE;SACF,CAAA;KACF;AACH,CAAC;AAED,kBAAe,MAAM,CAAA"}
@@ -1,5 +1,3 @@
1
1
  export interface Settings {
2
2
  ad_account_id: string;
3
- send_email: boolean;
4
- send_google_advertising_id: boolean;
5
3
  }
@@ -3,12 +3,9 @@ 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");
7
6
  const updateAudience_1 = __importDefault(require("./updateAudience"));
8
- const constants_1 = require("./constants");
7
+ const linkedin_properties_1 = require("./linkedin-properties");
9
8
  const https_1 = __importDefault(require("https"));
10
- const api_1 = require("./api");
11
- const actions_core_2 = require("@segment/actions-core");
12
9
  const destination = {
13
10
  name: 'Linkedin Audiences',
14
11
  slug: 'actions-linkedin-audiences',
@@ -21,37 +18,20 @@ const destination = {
21
18
  description: 'The id of the LinkedIn Ad Account where batches should be synced.',
22
19
  type: 'string',
23
20
  required: true
24
- },
25
- send_email: {
26
- label: 'Send Email',
27
- description: 'Whether to send `email` to LinkedIn. This setting applies to all mappings you create in this destination instance.',
28
- type: 'boolean',
29
- default: true,
30
- required: true
31
- },
32
- send_google_advertising_id: {
33
- label: 'Send Google Advertising ID',
34
- description: 'Whether to send Google Advertising ID to LinkedIn. This setting applies to all mappings you create in this destination instance.',
35
- type: 'boolean',
36
- default: true,
37
- required: true
38
21
  }
39
22
  },
40
23
  testAuthentication: async (request, { settings, auth }) => {
41
24
  if (!auth?.accessToken) {
42
- throw new actions_core_1.InvalidAuthenticationError('Please authenticate via Oauth before updating other settings and/or enabling the destination.');
25
+ throw new Error('Please authenticate via Oauth before updating other settings and/or enabling the destination.');
43
26
  }
44
- if (!settings.send_email && !settings.send_google_advertising_id) {
45
- throw new Error('At least one of `Send Email` or `Send Google Advertising ID` must be set to `true`.');
46
- }
47
- const linkedinApiClient = new api_1.LinkedInAudiences(request);
48
27
  let firstRes;
49
28
  try {
50
- firstRes = await linkedinApiClient.getProfile();
29
+ firstRes = await request(`https://api.linkedin.com/rest/me`, {
30
+ method: 'GET'
31
+ });
51
32
  }
52
33
  catch (e) {
53
- const error = e;
54
- if (error.message === 'Unauthorized') {
34
+ if (e.message === 'Unauthorized') {
55
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.');
56
36
  }
57
37
  throw e;
@@ -59,11 +39,12 @@ const destination = {
59
39
  const userId = firstRes?.data?.id;
60
40
  let secondRes;
61
41
  try {
62
- secondRes = await linkedinApiClient.getAdAccountUserProfile(settings, userId);
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
+ });
63
45
  }
64
46
  catch (e) {
65
- const error = e;
66
- if (error.message === 'Not Found') {
47
+ if (e.message === 'Not Found') {
67
48
  throw new Error('Invalid LinkedIn Ad Account id. Please verify that the LinkedIn Ad Account exists and that you have access to it.');
68
49
  }
69
50
  throw e;
@@ -75,25 +56,15 @@ const destination = {
75
56
  return true;
76
57
  },
77
58
  refreshAccessToken: async (request, { auth }) => {
78
- let res;
79
- try {
80
- res = await request('https://www.linkedin.com/oauth/v2/accessToken', {
81
- method: 'POST',
82
- body: new URLSearchParams({
83
- refresh_token: auth.refreshToken,
84
- client_id: auth.clientId,
85
- client_secret: auth.clientSecret,
86
- grant_type: 'refresh_token'
87
- })
88
- });
89
- }
90
- catch (e) {
91
- const error = e;
92
- if (error.response?.data?.error === 'invalid_grant') {
93
- throw new actions_core_2.IntegrationError(`Invalid Authentication: Your refresh token is invalid or expired. Please re-authenticate to fetch a new refresh token.`, 'REFRESH_TOKEN_EXPIRED', 401);
94
- }
95
- throw new actions_core_2.IntegrationError(`Failed to fetch a new access token. Reason: ${error.response?.data?.error}`, 'OAUTH_REFRESH_FAILED', 401);
96
- }
59
+ const res = await request('https://www.linkedin.com/oauth/v2/accessToken', {
60
+ method: 'POST',
61
+ body: new URLSearchParams({
62
+ refresh_token: auth.refreshToken,
63
+ client_id: auth.clientId,
64
+ client_secret: auth.clientSecret,
65
+ grant_type: 'refresh_token'
66
+ })
67
+ });
97
68
  return { accessToken: res?.data?.access_token };
98
69
  }
99
70
  },
@@ -102,7 +73,7 @@ const destination = {
102
73
  return {
103
74
  headers: {
104
75
  authorization: `Bearer ${auth?.accessToken}`,
105
- 'LinkedIn-Version': constants_1.LINKEDIN_API_VERSION
76
+ 'LinkedIn-Version': linkedin_properties_1.LINKEDIN_API_VERSION
106
77
  },
107
78
  agent
108
79
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/linkedin-audiences/index.ts"],"names":[],"mappings":";;;;;AACA,wDAAkE;AAElE,sEAA6C;AAC7C,2CAAkD;AAClD,kDAAyB;AACzB,+BAAyC;AASzC,wDAAwD;AAExD,MAAM,WAAW,GAAoC;IAEnD,IAAI,EAAE,oBAAo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,IAAI,EAAE,YAAY,EAAE,CAAA;QACjD,CAAC;KACF;IACD,aAAa,CAAC,EAAE,IAAI,EAAE;QAGpB,MAAM,KAAK,GAAG,IAAI,eAAK,CAAC,KAAK,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;QAElD,OAAO;YACL,OAAO,EAAE;gBACP,aAAa,EAAE,UAAU,IAAI,EAAE,WAAW,EAAE;gBAC5C,kBAAkB,EAAE,0CAAoB;aACzC;YACD,KAAK;SACN,CAAA;IACH,CAAC;IAED,OAAO,EAAE;QACP,cAAc,EAAd,wBAAc;KACf;CACF,CAAA;AAED,kBAAe,WAAW,CAAA"}
@@ -0,0 +1 @@
1
+ export declare const LINKEDIN_API_VERSION = "202207";
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LINKEDIN_API_VERSION = void 0;
4
+ exports.LINKEDIN_API_VERSION = '202207';
5
+ //# sourceMappingURL=linkedin-properties.js.map