@segment/action-destinations 3.101.0 → 3.103.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 (34) hide show
  1. package/dist/destinations/google-sheets/postSheet/index.js +1 -1
  2. package/dist/destinations/index.js +2 -0
  3. package/dist/destinations/index.js.map +1 -1
  4. package/dist/destinations/linkedin-audiences/generated-types.d.ts +3 -0
  5. package/dist/destinations/linkedin-audiences/generated-types.js +3 -0
  6. package/dist/destinations/linkedin-audiences/generated-types.js.map +1 -0
  7. package/dist/destinations/linkedin-audiences/index.d.ts +4 -0
  8. package/dist/destinations/linkedin-audiences/index.js +59 -0
  9. package/dist/destinations/linkedin-audiences/index.js.map +1 -0
  10. package/dist/destinations/linkedin-audiences/linkedin-properties.d.ts +1 -0
  11. package/dist/destinations/linkedin-audiences/linkedin-properties.js +5 -0
  12. package/dist/destinations/linkedin-audiences/linkedin-properties.js.map +1 -0
  13. package/dist/destinations/linkedin-audiences/updateAudience/generated-types.d.ts +11 -0
  14. package/dist/destinations/linkedin-audiences/updateAudience/generated-types.js +3 -0
  15. package/dist/destinations/linkedin-audiences/updateAudience/generated-types.js.map +1 -0
  16. package/dist/destinations/linkedin-audiences/updateAudience/index.d.ts +5 -0
  17. package/dist/destinations/linkedin-audiences/updateAudience/index.js +171 -0
  18. package/dist/destinations/linkedin-audiences/updateAudience/index.js.map +1 -0
  19. package/dist/destinations/sendgrid/generated-types.d.ts +3 -0
  20. package/dist/destinations/sendgrid/generated-types.js +3 -0
  21. package/dist/destinations/sendgrid/generated-types.js.map +1 -0
  22. package/dist/destinations/sendgrid/index.d.ts +4 -0
  23. package/dist/destinations/sendgrid/index.js +31 -0
  24. package/dist/destinations/sendgrid/index.js.map +1 -0
  25. package/dist/destinations/sendgrid/sendgrid-properties.d.ts +23 -0
  26. package/dist/destinations/sendgrid/sendgrid-properties.js +23 -0
  27. package/dist/destinations/sendgrid/sendgrid-properties.js.map +1 -0
  28. package/dist/destinations/sendgrid/updateUserProfile/generated-types.d.ts +21 -0
  29. package/dist/destinations/sendgrid/updateUserProfile/generated-types.js +3 -0
  30. package/dist/destinations/sendgrid/updateUserProfile/generated-types.js.map +1 -0
  31. package/dist/destinations/sendgrid/updateUserProfile/index.d.ts +5 -0
  32. package/dist/destinations/sendgrid/updateUserProfile/index.js +239 -0
  33. package/dist/destinations/sendgrid/updateUserProfile/index.js.map +1 -0
  34. package/package.json +4 -5
@@ -16,7 +16,7 @@ const action = {
16
16
  operation_type: {
17
17
  label: 'Operation Type',
18
18
  description: "Describes the nature of the operation being performed. Only supported values are 'new' and 'updated'.",
19
- type: 'string',
19
+ type: 'hidden',
20
20
  required: true,
21
21
  default: { '@path': '$.event' }
22
22
  },
@@ -47,6 +47,7 @@ register('60ae8b97dcb6cc52d5d0d5ab', './google-enhanced-conversions');
47
47
  register('627ea052118e3cd530d28963', './google-sheets');
48
48
  register('62e184d538b54413fe754512', './heap');
49
49
  register('624dddd054ced46facfdb9c0', './launchdarkly');
50
+ register('62f435d1d311567bd5bf0e8d', './linkedin-audiences');
50
51
  register('615c7438d93d9b61b1e9e192', './mixpanel');
51
52
  register('61a8032ea5f157ee37a720be', './metronome');
52
53
  register('620feaa207e70f6c6a765ff7', './moengage');
@@ -62,6 +63,7 @@ register('602efa1f249b9a5e2bf8a813', './twilio');
62
63
  register('614a3c7d791c91c41bae7599', './webhook');
63
64
  register('61dc4e96894a6d7954cc6e45', './voyage');
64
65
  register('62ded0cf5753c743883ca0f3', './intercom');
66
+ register('631a6f32946dd8197e9cab66', './sendgrid');
65
67
  function register(id, destinationPath) {
66
68
  const definition = require(destinationPath).default;
67
69
  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,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AAI,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"}
@@ -0,0 +1,3 @@
1
+ export interface Settings {
2
+ ad_account_id: string;
3
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=generated-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../src/destinations/linkedin-audiences/generated-types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ import type { DestinationDefinition } from '@segment/actions-core';
2
+ import type { Settings } from './generated-types';
3
+ declare const destination: DestinationDefinition<Settings>;
4
+ export default destination;
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const updateAudience_1 = __importDefault(require("./updateAudience"));
7
+ const linkedin_properties_1 = require("./linkedin-properties");
8
+ const destination = {
9
+ name: 'Linkedin Audiences',
10
+ slug: 'actions-linkedin-audiences',
11
+ mode: 'cloud',
12
+ authentication: {
13
+ scheme: 'oauth2',
14
+ fields: {
15
+ ad_account_id: {
16
+ label: 'LinkedIn Ad Account Id',
17
+ description: 'The id of the LinkedIn Ad Account where batches should be synced.',
18
+ type: 'string',
19
+ required: true
20
+ }
21
+ },
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
29
+ }
30
+ });
31
+ },
32
+ refreshAccessToken: async (request, { auth }) => {
33
+ const res = await request('https://www.linkedin.com/oauth/v2/accessToken', {
34
+ method: 'POST',
35
+ body: new URLSearchParams({
36
+ refresh_token: auth.refreshToken,
37
+ client_id: auth.clientId,
38
+ client_secret: auth.clientSecret,
39
+ grant_type: 'refresh_token'
40
+ })
41
+ });
42
+ return { accessToken: res?.data?.access_token };
43
+ }
44
+ },
45
+ extendRequest({ auth }) {
46
+ return {
47
+ headers: {
48
+ authorization: `Bearer ${auth?.accessToken}`,
49
+ 'LinkedIn-Version': linkedin_properties_1.LINKEDIN_API_VERSION,
50
+ 'Content-Type': 'application/json'
51
+ }
52
+ };
53
+ },
54
+ actions: {
55
+ updateAudience: updateAudience_1.default
56
+ }
57
+ };
58
+ exports.default = destination;
59
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/linkedin-audiences/index.ts"],"names":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gBAC5C,kBAAkB,EAAE,0CAAoB;gBACxC,cAAc,EAAE,kBAAkB;aACnC;SACF,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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"linkedin-properties.js","sourceRoot":"","sources":["../../../src/destinations/linkedin-audiences/linkedin-properties.ts"],"names":[],"mappings":";;;AAAa,QAAA,oBAAoB,GAAG,QAAQ,CAAA"}
@@ -0,0 +1,11 @@
1
+ export interface Payload {
2
+ dmp_segment_name?: string;
3
+ enable_batching?: boolean;
4
+ email?: string;
5
+ send_email?: boolean;
6
+ google_advertising_id?: string;
7
+ send_google_advertising_id?: boolean;
8
+ source_segment_id?: string;
9
+ personas_audience_key: string;
10
+ event_name?: string;
11
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=generated-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/linkedin-audiences/updateAudience/generated-types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ import type { ActionDefinition } from '@segment/actions-core';
2
+ import type { Settings } from '../generated-types';
3
+ import type { Payload } from './generated-types';
4
+ declare const action: ActionDefinition<Settings, Payload>;
5
+ export default action;
@@ -0,0 +1,171 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const actions_core_1 = require("@segment/actions-core");
4
+ const crypto_1 = require("crypto");
5
+ const actions_core_2 = require("@segment/actions-core");
6
+ const action = {
7
+ title: 'Sync To LinkedIn DMP Segment',
8
+ description: 'Syncs contacts from a Personas Audience to a LinkedIn DMP Segment.',
9
+ fields: {
10
+ dmp_segment_name: {
11
+ label: 'DMP Segment Display Name',
12
+ description: 'The display name of the LinkedIn DMP Segment.',
13
+ type: 'string',
14
+ default: {
15
+ '@path': '$.properties.audience_key'
16
+ }
17
+ },
18
+ enable_batching: {
19
+ label: 'Enable Batching',
20
+ description: 'Enable batching of requests to the LinkedIn DMP Segment.',
21
+ type: 'boolean',
22
+ default: true
23
+ },
24
+ email: {
25
+ label: 'User Email',
26
+ description: "The user's email address to send to LinkedIn.",
27
+ type: 'hidden',
28
+ default: {
29
+ '@path': '$.context.traits.email'
30
+ }
31
+ },
32
+ send_email: {
33
+ label: 'Send Email',
34
+ description: 'Whether to send `email` to LinkedIn.',
35
+ type: 'boolean',
36
+ default: true
37
+ },
38
+ google_advertising_id: {
39
+ label: 'User Google Advertising ID',
40
+ description: "The user's Google Advertising ID to send to LinkedIn.",
41
+ type: 'hidden',
42
+ default: {
43
+ '@path': '$.context.device.advertisingId'
44
+ }
45
+ },
46
+ send_google_advertising_id: {
47
+ label: 'Send Google Advertising ID',
48
+ description: 'Whether to send Google Advertising ID to LinkedIn.',
49
+ type: 'boolean',
50
+ default: true
51
+ },
52
+ source_segment_id: {
53
+ label: 'LinkedIn Source Segment ID',
54
+ 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.",
55
+ type: 'hidden',
56
+ default: {
57
+ '@path': '$.properties.audience_key'
58
+ }
59
+ },
60
+ personas_audience_key: {
61
+ label: 'Segment Personas Audience Key',
62
+ description: 'The `audience_key` of the Personas 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.',
63
+ type: 'string',
64
+ required: true
65
+ },
66
+ event_name: {
67
+ label: 'Event Name',
68
+ description: 'The name of the current Segment event.',
69
+ type: 'hidden',
70
+ default: {
71
+ '@path': '$.event'
72
+ }
73
+ }
74
+ },
75
+ perform: async (request, { settings, payload }) => {
76
+ return processPayload(request, settings, [payload]);
77
+ },
78
+ performBatch: async (request, { settings, payload }) => {
79
+ return processPayload(request, settings, payload);
80
+ }
81
+ };
82
+ async function processPayload(request, settings, payloads) {
83
+ if (payloads[0].source_segment_id !== payloads[0].personas_audience_key) {
84
+ throw new actions_core_2.IntegrationError('The value of `source_segment_id` and `personas_audience_key` must match.', 'Invalid settings.', 400);
85
+ }
86
+ const dmpSegmentId = await getDmpSegmentId(request, settings, payloads[0]);
87
+ const elements = extractUsers(payloads);
88
+ return request(`https://api.linkedin.com/rest/dmpSegments/${dmpSegmentId}/users`, {
89
+ method: 'POST',
90
+ headers: {
91
+ 'X-RestLi-Method': 'BATCH_CREATE'
92
+ },
93
+ json: {
94
+ elements
95
+ }
96
+ });
97
+ }
98
+ async function getDmpSegmentId(request, settings, payload) {
99
+ const res = await getDmpSegment(request, settings, payload);
100
+ const body = await res.json();
101
+ if (body.elements?.length > 0) {
102
+ return body.elements[0].id;
103
+ }
104
+ return createDmpSegment(request, settings, payload);
105
+ }
106
+ async function getDmpSegment(request, settings, payload) {
107
+ return request(`https://api.linkedin.com/rest/dmpSegments?q=account&account=urn:li:sponsoredAccount:${settings.ad_account_id}&sourceSegmentId=${payload.source_segment_id}&sourcePlatform=SEGMENT`);
108
+ }
109
+ async function createDmpSegment(request, settings, payload) {
110
+ await request('https://api.linkedin.com/rest/dmpSegments', {
111
+ method: 'POST',
112
+ json: {
113
+ name: payload.dmp_segment_name,
114
+ sourcePlatform: 'SEGMENT',
115
+ sourceSegmentId: payload.source_segment_id,
116
+ account: `urn:li:sponsoredAccount:${settings.ad_account_id}`,
117
+ accessPolicy: 'PRIVATE',
118
+ type: 'USER',
119
+ destinations: [
120
+ {
121
+ destination: 'LINKEDIN'
122
+ }
123
+ ]
124
+ }
125
+ });
126
+ const res = await getDmpSegment(request, settings, payload);
127
+ const body = await res.json();
128
+ if (body.elements?.length > 0) {
129
+ return body.elements[0].id;
130
+ }
131
+ throw new actions_core_1.RetryableError('Failed to fetch or create a LinkedIn DMP Segment.');
132
+ }
133
+ function extractUsers(payloads) {
134
+ const elements = [];
135
+ payloads.forEach((payload) => {
136
+ if (!payload.email && !payload.google_advertising_id) {
137
+ return;
138
+ }
139
+ elements.push({
140
+ action: getAction(payload),
141
+ userIds: getUserIds(payload)
142
+ });
143
+ });
144
+ return elements;
145
+ }
146
+ function getAction(payload) {
147
+ if (payload.event_name === 'Audience Entered') {
148
+ return 'ADD';
149
+ }
150
+ else if (payload.event_name === 'Audience Exited') {
151
+ return 'REMOVE';
152
+ }
153
+ }
154
+ function getUserIds(payload) {
155
+ const users = [];
156
+ if (payload.email) {
157
+ users.push({
158
+ idType: 'SHA256_EMAIL',
159
+ idValue: crypto_1.createHash('sha256').update(payload.email).digest('hex')
160
+ });
161
+ }
162
+ if (payload.google_advertising_id) {
163
+ users.push({
164
+ idType: 'GOOGLE_AID',
165
+ idValue: payload.google_advertising_id
166
+ });
167
+ }
168
+ return users;
169
+ }
170
+ exports.default = action;
171
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/linkedin-audiences/updateAudience/index.ts"],"names":[],"mappings":";;AAEA,wDAAsD;AAGtD,mCAAmC;AACnC,wDAAwD;AAExD,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,8BAA8B;IACrC,WAAW,EAAE,oEAAoE;IACjF,MAAM,EAAE;QACN,gBAAgB,EAAE;YAChB,KAAK,EAAE,0BAA0B;YACjC,WAAW,EAAE,+CAA+C;YAC5D,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,2BAA2B;aACrC;SACF;QACD,eAAe,EAAE;YACf,KAAK,EAAE,iBAAiB;YACxB,WAAW,EAAE,0DAA0D;YACvE,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,IAAI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AO,QAAQ,CAAA;AACjB,CAAC;AAED,SAAS,SAAS,CAAC,OAAgB;IACjC,IAAI,OAAO,CAAC,UAAU,KAAK,kBAAkB,EAAE;QAC7C,OAAO,KAAK,CAAA;KACb;SAAM,IAAI,OAAO,CAAC,UAAU,KAAK,iBAAiB,EAAE;QACnD,OAAO,QAAQ,CAAA;KAChB;AACH,CAAC;AAED,SAAS,UAAU,CAAC,OAAgB;IAClC,MAAM,KAAK,GAAG,EAAE,CAAA;IAEhB,IAAI,OAAO,CAAC,KAAK,EAAE;QACjB,KAAK,CAAC,IAAI,CAAC;YACT,MAAM,EAAE,cAAc;YACtB,OAAO,EAAE,mBAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;SAClE,CAAC,CAAA;KACH;IAED,IAAI,OAAO,CAAC,qBAAqB,EAAE;QACjC,KAAK,CAAC,IAAI,CAAC;YACT,MAAM,EAAE,YAAY;YACpB,OAAO,EAAE,OAAO,CAAC,qBAAqB;SACvC,CAAC,CAAA;KACH;IAED,OAAO,KAAK,CAAA;AACd,CAAC;AAED,kBAAe,MAAM,CAAA"}
@@ -0,0 +1,3 @@
1
+ export interface Settings {
2
+ sendGridApiKey: string;
3
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=generated-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../src/destinations/sendgrid/generated-types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ import type { DestinationDefinition } from '@segment/actions-core';
2
+ import type { Settings } from './generated-types';
3
+ declare const destination: DestinationDefinition<Settings>;
4
+ export default destination;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const updateUserProfile_1 = __importDefault(require("./updateUserProfile"));
7
+ const destination = {
8
+ name: 'SendGrid Marketing Campaigns',
9
+ slug: 'actions-sendgrid',
10
+ mode: 'cloud',
11
+ description: 'This destination sends data to SendGrid Marketing Campaigns.',
12
+ authentication: {
13
+ scheme: 'custom',
14
+ fields: {
15
+ sendGridApiKey: {
16
+ label: 'API Key',
17
+ type: 'password',
18
+ description: 'The Api key for your SendGrid account.',
19
+ required: true
20
+ }
21
+ },
22
+ testAuthentication: (request) => {
23
+ return request('https://api.sendgrid.com/v3/marketing/contacts');
24
+ }
25
+ },
26
+ actions: {
27
+ updateUserProfile: updateUserProfile_1.default
28
+ }
29
+ };
30
+ exports.default = destination;
31
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/sendgrid/index.ts"],"names":[],"mappings":";;;;;AAGA,4EAAmD;AAEnD,MAAM,WAAW,GAAoC;IACnD,IAAI,EAAE,8BAA8B;IACpC,IAAI,EAAE,kBAAkB;IACxB,IAAI,EAAE,OAAO;IACb,WAAW,EAAE,8DAA8D;IAE3E,cAAc,EAAE;QACd,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE;YACN,cAAc,EAAE;gBACd,KAAK,EAAE,SAAS;gBAChB,IAAI,EAAE,UAAU;gBAChB,WAAW,EAAE,wCAAwC;gBACrD,QAAQ,EAAE,IAAI;aACf;SACF;QACD,kBAAkB,EAAE,CAAC,OAAO,EAAE,EAAE;YAI9B,OAAO,OAAO,CAAC,gDAAgD,CAAC,CAAA;QAClE,CAAC;KACF;IAED,OAAO,EAAE;QACP,iBAAiB,EAAjB,2BAAiB;KAClB;CACF,CAAA;AAED,kBAAe,WAAW,CAAA"}
@@ -0,0 +1,23 @@
1
+ import { InputField } from '@segment/actions-core';
2
+ import { Payload } from './updateUserProfile/generated-types';
3
+ export declare const customFields: InputField;
4
+ export declare const convertPayload: (payload: Payload) => {
5
+ state_province_region: string | null | undefined;
6
+ email: string;
7
+ custom_fields: {
8
+ [k: string]: unknown;
9
+ } | undefined;
10
+ first_name?: string | null | undefined;
11
+ last_name?: string | null | undefined;
12
+ country?: string | null | undefined;
13
+ postal_code?: string | null | undefined;
14
+ city?: string | null | undefined;
15
+ address_line_1?: string | null | undefined;
16
+ address_line_2?: string | null | undefined;
17
+ phone_number?: string | null | undefined;
18
+ whatsapp?: string | null | undefined;
19
+ line?: string | null | undefined;
20
+ facebook?: string | null | undefined;
21
+ unique_name?: string | null | undefined;
22
+ identity?: string | null | undefined;
23
+ };
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.convertPayload = exports.customFields = void 0;
4
+ exports.customFields = {
5
+ label: 'Other Fields',
6
+ description: `
7
+ Additional fields to send to SendGrid. On the left-hand side, input the SendGrid Custom Fields Id. On the right-hand side, map the Segment field that contains the value.
8
+
9
+ Custom Fields must be predefined in your SendGrid account and you can retrieve corresponding Id using get all field definitions endpoint.
10
+
11
+ Reference: [Get All field definitions](https://docs.sendgrid.com/api-reference/custom-fields/get-all-field-definitions)
12
+ ---
13
+
14
+ `,
15
+ type: 'object',
16
+ defaultObjectUI: 'keyvalue'
17
+ };
18
+ const convertPayload = (payload) => {
19
+ const { state, primary_email, enable_batching, customFields, ...rest } = payload;
20
+ return { ...rest, state_province_region: state, email: primary_email, custom_fields: customFields };
21
+ };
22
+ exports.convertPayload = convertPayload;
23
+ //# sourceMappingURL=sendgrid-properties.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sendgrid-properties.js","sourceRoot":"","sources":["../../../src/destinations/sendgrid/sendgrid-properties.ts"],"names":[],"mappings":";;;AAGa,QAAA,YAAY,GAAe;IACtC,KAAK,EAAE,cAAc;IACrB,WAAW,EAAE;;;;;;;;GAQZ;IACD,IAAI,EAAE,QAAQ;IACd,eAAe,EAAE,UAAU;CAC5B,CAAA;AAEM,MAAM,cAAc,GAAG,CAAC,OAAgB,EAAE,EAAE;IACjD,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,YAAY,EAAE,GAAG,IAAI,EAAE,GAAG,OAAO,CAAA;IAChF,OAAO,EAAE,GAAG,IAAI,EAAE,qBAAqB,EAAE,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,YAAY,EAAE,CAAA;AACrG,CAAC,CAAA;AAHY,QAAA,cAAc,kBAG1B"}
@@ -0,0 +1,21 @@
1
+ export interface Payload {
2
+ enable_batching?: boolean;
3
+ first_name?: string | null;
4
+ last_name?: string | null;
5
+ country?: string | null;
6
+ postal_code?: string | null;
7
+ city?: string | null;
8
+ state?: string | null;
9
+ address_line_1?: string | null;
10
+ address_line_2?: string | null;
11
+ phone_number?: string | null;
12
+ whatsapp?: string | null;
13
+ line?: string | null;
14
+ facebook?: string | null;
15
+ unique_name?: string | null;
16
+ identity?: string | null;
17
+ primary_email: string;
18
+ customFields?: {
19
+ [k: string]: unknown;
20
+ };
21
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=generated-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/sendgrid/updateUserProfile/generated-types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ import type { ActionDefinition } from '@segment/actions-core';
2
+ import type { Settings } from '../generated-types';
3
+ import type { Payload } from './generated-types';
4
+ declare const action: ActionDefinition<Settings, Payload>;
5
+ export default action;
@@ -0,0 +1,239 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const sendgrid_properties_1 = require("../sendgrid-properties");
4
+ const actions_core_1 = require("@segment/actions-core");
5
+ const action = {
6
+ title: 'Upsert Contact',
7
+ description: 'Add or update a Contact in SendGrid.',
8
+ fields: {
9
+ enable_batching: {
10
+ type: 'boolean',
11
+ label: 'Batch Data to SendGrid Contacts PUT API',
12
+ description: 'When enabled, the action will use the SendGrid Contacts PUT API to perform the batch operation. Batches can contain up to 30k records in a request.',
13
+ default: true
14
+ },
15
+ first_name: {
16
+ label: 'First Name',
17
+ description: `The contact's first name.`,
18
+ type: 'string',
19
+ allowNull: true,
20
+ default: {
21
+ '@if': {
22
+ exists: { '@path': '$.traits.first_name' },
23
+ then: { '@path': '$.traits.first_name' },
24
+ else: { '@path': '$.properties.first_name' }
25
+ }
26
+ }
27
+ },
28
+ last_name: {
29
+ label: 'Last Name',
30
+ description: `The contact's last name.`,
31
+ type: 'string',
32
+ allowNull: true,
33
+ default: {
34
+ '@if': {
35
+ exists: { '@path': '$.traits.last_name' },
36
+ then: { '@path': '$.traits.last_name' },
37
+ else: { '@path': '$.properties.last_name' }
38
+ }
39
+ }
40
+ },
41
+ country: {
42
+ label: 'Country',
43
+ description: `The contact's country.`,
44
+ type: 'string',
45
+ allowNull: true,
46
+ default: {
47
+ '@if': {
48
+ exists: { '@path': '$.traits.address.country' },
49
+ then: { '@path': '$.traits.address.country' },
50
+ else: { '@path': '$.properties.address.country' }
51
+ }
52
+ }
53
+ },
54
+ postal_code: {
55
+ label: 'Postal Code',
56
+ description: `The contact's postal code.`,
57
+ type: 'string',
58
+ allowNull: true,
59
+ default: {
60
+ '@if': {
61
+ exists: { '@path': '$.traits.address.postal_code' },
62
+ then: { '@path': '$.traits.address.postal_code' },
63
+ else: { '@path': '$.properties.address.postal_code' }
64
+ }
65
+ }
66
+ },
67
+ city: {
68
+ label: 'City',
69
+ description: `The contact's city.`,
70
+ type: 'string',
71
+ allowNull: true,
72
+ default: {
73
+ '@if': {
74
+ exists: { '@path': '$.traits.address.city' },
75
+ then: { '@path': '$.traits.address.city' },
76
+ else: { '@path': '$.properties.address.city' }
77
+ }
78
+ }
79
+ },
80
+ state: {
81
+ label: 'State',
82
+ description: `The contact's state.`,
83
+ type: 'string',
84
+ allowNull: true,
85
+ default: {
86
+ '@if': {
87
+ exists: { '@path': '$.traits.address.state' },
88
+ then: { '@path': '$.traits.address.state' },
89
+ else: { '@path': '$.properties.address.state' }
90
+ }
91
+ }
92
+ },
93
+ address_line_1: {
94
+ label: 'Address Line 1',
95
+ description: `The contact's address line 1.`,
96
+ type: 'string',
97
+ allowNull: true,
98
+ default: {
99
+ '@if': {
100
+ exists: { '@path': '$.traits.address.line1' },
101
+ then: { '@path': '$.traits.address.line1' },
102
+ else: { '@path': '$.properties.address.line1' }
103
+ }
104
+ }
105
+ },
106
+ address_line_2: {
107
+ label: 'Address Line 2',
108
+ description: `The contact's address line 2.`,
109
+ type: 'string',
110
+ allowNull: true,
111
+ default: {
112
+ '@if': {
113
+ exists: { '@path': '$.traits.address.line2' },
114
+ then: { '@path': '$.traits.address.line2' },
115
+ else: { '@path': '$.properties.address.line2' }
116
+ }
117
+ }
118
+ },
119
+ phone_number: {
120
+ label: 'Phone Number',
121
+ description: `The contact's phone number.`,
122
+ type: 'string',
123
+ allowNull: true,
124
+ default: {
125
+ '@if': {
126
+ exists: { '@path': '$.traits.phone' },
127
+ then: { '@path': '$.traits.phone' },
128
+ else: { '@path': '$.properties.phone' }
129
+ }
130
+ }
131
+ },
132
+ whatsapp: {
133
+ label: 'WhatsApp',
134
+ description: `The contact's WhatsApp.`,
135
+ type: 'string',
136
+ allowNull: true,
137
+ default: {
138
+ '@if': {
139
+ exists: { '@path': '$.traits.whatsapp' },
140
+ then: { '@path': '$.traits.whatsapp' },
141
+ else: { '@path': '$.properties.whatsapp' }
142
+ }
143
+ }
144
+ },
145
+ line: {
146
+ label: 'LINE ID',
147
+ description: `The contact's LINE ID.`,
148
+ type: 'string',
149
+ allowNull: true,
150
+ default: {
151
+ '@if': {
152
+ exists: { '@path': '$.traits.line' },
153
+ then: { '@path': '$.traits.line' },
154
+ else: { '@path': '$.properties.line' }
155
+ }
156
+ }
157
+ },
158
+ facebook: {
159
+ label: 'Facebook ID',
160
+ description: `The contact's Facebook ID.`,
161
+ type: 'string',
162
+ allowNull: true,
163
+ default: {
164
+ '@if': {
165
+ exists: { '@path': '$.traits.facebook' },
166
+ then: { '@path': '$.traits.facebook' },
167
+ else: { '@path': '$.properties.facebook' }
168
+ }
169
+ }
170
+ },
171
+ unique_name: {
172
+ label: 'Unique Name',
173
+ description: `The contact's unique name.`,
174
+ type: 'string',
175
+ allowNull: true,
176
+ default: {
177
+ '@if': {
178
+ exists: { '@path': '$.traits.unique_name' },
179
+ then: { '@path': '$.traits.unique_name' },
180
+ else: { '@path': '$.properties.unique_name' }
181
+ }
182
+ }
183
+ },
184
+ identity: {
185
+ label: 'Identity',
186
+ description: `The contact's identity.`,
187
+ type: 'string',
188
+ allowNull: true,
189
+ default: {
190
+ '@if': {
191
+ exists: { '@path': '$.traits.identity' },
192
+ then: { '@path': '$.traits.identity' },
193
+ else: { '@path': '$.properties.identity' }
194
+ }
195
+ }
196
+ },
197
+ primary_email: {
198
+ label: 'Email Address',
199
+ description: `The contact's email address.`,
200
+ type: 'string',
201
+ allowNull: false,
202
+ required: true,
203
+ default: {
204
+ '@if': {
205
+ exists: { '@path': '$.traits.email' },
206
+ then: { '@path': '$.traits.email' },
207
+ else: { '@path': '$.properties.email' }
208
+ }
209
+ }
210
+ },
211
+ customFields: sendgrid_properties_1.customFields
212
+ },
213
+ perform: (request, data) => {
214
+ const formattedData = { contacts: [sendgrid_properties_1.convertPayload(data.payload)] };
215
+ return request('https://api.sendgrid.com/v3/marketing/contacts', {
216
+ method: 'put',
217
+ headers: {
218
+ authorization: `Bearer ${data.settings.sendGridApiKey}`
219
+ },
220
+ json: formattedData
221
+ });
222
+ },
223
+ performBatch: (request, data) => {
224
+ const n = data.payload.length;
225
+ if (n < 1) {
226
+ throw new actions_core_1.IntegrationError('No record to send', 'No data', 400);
227
+ }
228
+ const formattedData = { contacts: data.payload.map(sendgrid_properties_1.convertPayload) };
229
+ return request('https://api.sendgrid.com/v3/marketing/contacts', {
230
+ method: 'put',
231
+ headers: {
232
+ authorization: `Bearer ${data.settings.sendGridApiKey}`
233
+ },
234
+ json: formattedData
235
+ });
236
+ }
237
+ };
238
+ exports.default = action;
239
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/sendgrid/updateUserProfile/index.ts"],"names":[],"mappings":";;AAGA,gEAAqE;AACrE,wDAAwD;AAExD,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,gBAAgB;IACvB,WAAW,EAAE,sCAAsC;IACnD,MAAM,EAAE;QACN,eAAe,EAAE;YACf,IAAI,EAAE,SAAS;YACf,KAAK,EAAE,yCAAyC;YAChD,WAAW,EACT,qJAAqJ;YACvJ,OAAO,EAAE,IAAI;SACd;QACD,UAAU,EAAE;YACV,KAAK,EAAE,YAAY;YACnB,WAAW,EAAE,2BAA2B;YACxC,IAAI,EAAE,QAAQ;YACd,SAAS,EAAE,IAAI;YACf,OAAO,EAAE;gBACP,KAAK,EAAE;oBACL,MAAM,EAAE,EAAE,OAAO,EAAE,qBAAqB,EAAE;oBAC1C,IAAI,EAAE,EAAE,OAAO,EAAE,qBAAqB,EAAE;oBACxC,IAAI,EAAE,EAAE,OAAO,EAAE,yBAAyB,EAAE;iBAC7C;aACF;SACF;QACD,SAAS,EAAE;YACT,KAAK,EAAE,WAAW;YAClB,WAAW,EAAE,0BAA0B;YACvC,IAAI,EAAE,QAAQ;YACd,SAAS,EAAE,IAAI;YACf,OAAO,EAAE;gBACP,KAAK,EAAE;oBACL,MAAM,EAAE,EAAE,OAAO,EAAE,oBAAoB,EAAE;oBACzC,IAAI,EAAE,EAAE,OAAO,EAAE,oBAAoB,EAAE;oBACvC,IAAI,EAAE,EAAE,OAAO,EAAE,wBAAwB,EAAE;iBAC5C;aACF;SACF;QACD,OAAO,EAAE;YACP,KAAK,EAAE,SAAS;YAChB,WAAW,EAAE,wBAAwB;YACrC,IAAI,EAAE,QAAQ;YACd,SAAS,EAAE,IAAI;YACf,OAAO,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,CAAC,QAAQ,CAAC,cAAc,EAAE;aACxD;YACD,IAAI,EAAE,aAAa;SACpB,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@segment/action-destinations",
3
3
  "description": "Destination Actions engine and definitions.",
4
- "version": "3.101.0",
4
+ "version": "3.103.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/segmentio/action-destinations",
@@ -38,8 +38,8 @@
38
38
  "dependencies": {
39
39
  "@amplitude/ua-parser-js": "^0.7.25",
40
40
  "@segment/a1-notation": "^2.1.4",
41
- "@segment/actions-core": "^3.32.0",
42
- "@segment/actions-shared": "^1.15.0",
41
+ "@segment/actions-core": "^3.33.0",
42
+ "@segment/actions-shared": "^1.16.0",
43
43
  "cheerio": "^1.0.0-rc.10",
44
44
  "dayjs": "^1.10.7",
45
45
  "escape-goat": "^3",
@@ -64,6 +64,5 @@
64
64
  "coverageReporters": [
65
65
  "lcov"
66
66
  ]
67
- },
68
- "gitHead": "3feb303f6e089596ab934a8d5544f4e2aefa31c7"
67
+ }
69
68
  }