@segment/action-destinations 3.53.0 → 3.54.1-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/destinations/google-analytics-4/addPaymentInfo/index.js +4 -1
- package/dist/destinations/google-analytics-4/addPaymentInfo/index.js.map +1 -1
- package/dist/destinations/personas-messaging-sendgrid/sendEmail/generated-types.d.ts +5 -0
- package/dist/destinations/personas-messaging-sendgrid/sendEmail/index.js +126 -96
- package/dist/destinations/personas-messaging-sendgrid/sendEmail/index.js.map +1 -1
- package/dist/destinations/personas-messaging-twilio/sendSms/generated-types.d.ts +5 -0
- package/dist/destinations/personas-messaging-twilio/sendSms/index.js +83 -51
- package/dist/destinations/personas-messaging-twilio/sendSms/index.js.map +1 -1
- package/dist/destinations/salesforce/account/generated-types.d.ts +25 -0
- package/dist/destinations/salesforce/account/generated-types.js +3 -0
- package/dist/destinations/salesforce/account/generated-types.js.map +1 -0
- package/dist/destinations/salesforce/account/index.d.ts +5 -0
- package/dist/destinations/salesforce/account/index.js +187 -0
- package/dist/destinations/salesforce/account/index.js.map +1 -0
- package/dist/destinations/salesforce/index.js +5 -1
- package/dist/destinations/salesforce/index.js.map +1 -1
- package/dist/destinations/salesforce/opportunity/generated-types.d.ts +14 -0
- package/dist/destinations/salesforce/opportunity/generated-types.js +3 -0
- package/dist/destinations/salesforce/opportunity/generated-types.js.map +1 -0
- package/dist/destinations/salesforce/opportunity/index.d.ts +5 -0
- package/dist/destinations/salesforce/opportunity/index.js +63 -0
- package/dist/destinations/salesforce/opportunity/index.js.map +1 -0
- package/dist/destinations/salesforce/sf-object-to-shape.js +32 -1
- package/dist/destinations/salesforce/sf-object-to-shape.js.map +1 -1
- package/dist/destinations/salesforce/sf-types.d.ts +29 -2
- package/package.json +2 -2
|
@@ -21,13 +21,16 @@ const action = {
|
|
|
21
21
|
params: ga4_properties_1.params
|
|
22
22
|
},
|
|
23
23
|
perform: (request, { payload }) => {
|
|
24
|
+
if (payload.items && !payload.items.length) {
|
|
25
|
+
throw new actions_core_1.IntegrationError('Google requires one or more products in add_payment_info events.', 'Misconfigured required field', 400);
|
|
26
|
+
}
|
|
24
27
|
if (payload.currency && !constants_1.CURRENCY_ISO_CODES.includes(payload.currency)) {
|
|
25
28
|
throw new actions_core_1.IntegrationError(`${payload.currency} is not a valid currency code.`, 'Incorrect value format', 400);
|
|
26
29
|
}
|
|
27
30
|
if (payload.value && payload.currency === undefined) {
|
|
28
31
|
throw new actions_core_1.IntegrationError('Currency is required if value is set.', 'Misconfigured required field', 400);
|
|
29
32
|
}
|
|
30
|
-
if (payload.currency === undefined && payload.items
|
|
33
|
+
if (payload.currency === undefined && payload.items[0].currency === undefined) {
|
|
31
34
|
throw new actions_core_1.IntegrationError('One of item-level currency or top-level currency is required.', 'Misconfigured required field', 400);
|
|
32
35
|
}
|
|
33
36
|
let googleItems = [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/google-analytics-4/addPaymentInfo/index.ts"],"names":[],"mappings":";;AAAA,wDAA0E;AAC1E,4CAAiD;AAIjD,sDAS0B;AAE1B,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,kBAAkB;IACzB,WAAW,EAAE,0DAA0D;IACvE,mBAAmB,EAAE,mDAAmD;IACxE,MAAM,EAAE;QACN,SAAS,EAAE,EAAE,GAAG,0BAAS,EAAE;QAC3B,OAAO,EAAE,EAAE,GAAG,wBAAO,EAAE;QACvB,QAAQ,EAAE,EAAE,GAAG,yBAAQ,EAAE;QACzB,KAAK,EAAE,EAAE,GAAG,sBAAK,EAAE;QACnB,MAAM,EAAE,EAAE,GAAG,uBAAM,EAAE;QACrB,YAAY,EAAE,EAAE,GAAG,6BAAY,EAAE;QACjC,KAAK,EAAE;YACL,GAAG,qCAAoB;YACvB,QAAQ,EAAE,IAAI;SACf;QACD,MAAM,EAAE,uBAAM;KACf;IACD,OAAO,EAAE,CAAC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,KAAK,EAAE,WAAW;4BAClB,GAAG,OAAO,CAAC,MAAM;yBAClB;qBACF;iBACF;aACF;SACF,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -10,11 +10,11 @@ const escape_goat_1 = require("escape-goat");
|
|
|
10
10
|
const insertEmailPreviewText = (html, previewText) => {
|
|
11
11
|
const $ = cheerio_1.default.load(html);
|
|
12
12
|
$('body').prepend(`
|
|
13
|
-
<div style=
|
|
13
|
+
<div style='display: none; max-height: 0px; overflow: hidden;'>
|
|
14
14
|
${escape_goat_1.htmlEscape(previewText)}
|
|
15
15
|
</div>
|
|
16
16
|
|
|
17
|
-
<div style=
|
|
17
|
+
<div style='display: none; max-height: 0px; overflow: hidden;'>
|
|
18
18
|
${' ‌'.repeat(13)}
|
|
19
19
|
</div>
|
|
20
20
|
`);
|
|
@@ -34,21 +34,6 @@ const fetchProfileTraits = async (request, settings, profileId) => {
|
|
|
34
34
|
const body = await response.json();
|
|
35
35
|
return body.traits;
|
|
36
36
|
};
|
|
37
|
-
const fetchProfileExternalIds = async (request, settings, profileId) => {
|
|
38
|
-
const endpoint = getProfileApiEndpoint(settings.profileApiEnvironment);
|
|
39
|
-
const response = await request(`${endpoint}/v1/spaces/${settings.spaceId}/collections/users/profiles/user_id:${profileId}/external_ids?limit=25`, {
|
|
40
|
-
headers: {
|
|
41
|
-
authorization: `Basic ${Buffer.from(settings.profileApiAccessToken + ':').toString('base64')}`,
|
|
42
|
-
'content-type': 'application/json'
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
const body = await response.json();
|
|
46
|
-
const externalIds = {};
|
|
47
|
-
for (const externalId of body.data) {
|
|
48
|
-
externalIds[externalId.type] = externalId.id;
|
|
49
|
-
}
|
|
50
|
-
return externalIds;
|
|
51
|
-
};
|
|
52
37
|
const isRestrictedDomain = (email) => {
|
|
53
38
|
const restricted = ['gmailx.com', 'yahoox.com', 'aolx.com', 'hotmailx.com'];
|
|
54
39
|
const matches = /^.+@(.+)$/.exec(email.toLowerCase());
|
|
@@ -171,6 +156,45 @@ const action = {
|
|
|
171
156
|
description: 'The HTML content of the body',
|
|
172
157
|
type: 'string'
|
|
173
158
|
},
|
|
159
|
+
externalIds: {
|
|
160
|
+
label: 'External IDs',
|
|
161
|
+
description: 'An array of user profile identity information.',
|
|
162
|
+
type: 'object',
|
|
163
|
+
multiple: true,
|
|
164
|
+
properties: {
|
|
165
|
+
id: {
|
|
166
|
+
label: 'ID',
|
|
167
|
+
description: 'A unique identifier for the collection.',
|
|
168
|
+
type: 'string'
|
|
169
|
+
},
|
|
170
|
+
type: {
|
|
171
|
+
label: 'type',
|
|
172
|
+
description: 'The external ID contact type.',
|
|
173
|
+
type: 'string'
|
|
174
|
+
},
|
|
175
|
+
subscriptionStatus: {
|
|
176
|
+
label: 'ID',
|
|
177
|
+
description: 'The subscription status for the identity.',
|
|
178
|
+
type: 'string'
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
default: {
|
|
182
|
+
'@arrayPath': [
|
|
183
|
+
'$.external_ids',
|
|
184
|
+
{
|
|
185
|
+
id: {
|
|
186
|
+
'@path': '$.id'
|
|
187
|
+
},
|
|
188
|
+
type: {
|
|
189
|
+
'@path': '$.type'
|
|
190
|
+
},
|
|
191
|
+
subscriptionStatus: {
|
|
192
|
+
'@path': '$.isSubscribed'
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
]
|
|
196
|
+
}
|
|
197
|
+
},
|
|
174
198
|
customArgs: {
|
|
175
199
|
label: 'Custom Args',
|
|
176
200
|
description: 'Additional custom args that we be passed back opaquely on webhook events',
|
|
@@ -182,92 +206,98 @@ const action = {
|
|
|
182
206
|
if (!payload.send) {
|
|
183
207
|
return;
|
|
184
208
|
}
|
|
185
|
-
const
|
|
186
|
-
|
|
187
|
-
fetchProfileExternalIds(request, settings, payload.userId)
|
|
188
|
-
]);
|
|
189
|
-
const profile = {
|
|
190
|
-
...externalIds,
|
|
191
|
-
traits
|
|
192
|
-
};
|
|
193
|
-
const toEmail = payload.toEmail || profile.email;
|
|
194
|
-
if (!toEmail) {
|
|
209
|
+
const emailProfile = payload?.externalIds?.find(meta => meta.type === 'email');
|
|
210
|
+
if (!emailProfile?.subscriptionStatus || ['unsubscribed', 'did not subscribed', 'false'].includes(emailProfile.subscriptionStatus)) {
|
|
195
211
|
return;
|
|
196
212
|
}
|
|
197
|
-
if (
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
}
|
|
207
|
-
else if (traits.name) {
|
|
208
|
-
name = traits.name;
|
|
209
|
-
}
|
|
210
|
-
else {
|
|
211
|
-
name = traits.first_name || traits.last_name || traits.firstName || traits.lastName || 'User';
|
|
212
|
-
}
|
|
213
|
-
const bcc = JSON.parse(payload.bcc ?? '[]');
|
|
214
|
-
let bodyHtml = payload.bodyHtml ?? '';
|
|
215
|
-
if (payload.bodyUrl && settings.unlayerApiKey) {
|
|
216
|
-
const response = await request(payload.bodyUrl);
|
|
217
|
-
const body = await response.text();
|
|
218
|
-
bodyHtml = payload.bodyType === 'html' ? body : await generateEmailHtml(request, settings.unlayerApiKey, body);
|
|
219
|
-
if (payload.previewText) {
|
|
220
|
-
bodyHtml = insertEmailPreviewText(bodyHtml, payload.previewText);
|
|
213
|
+
else if (['subscribed', 'true'].includes(emailProfile?.subscriptionStatus)) {
|
|
214
|
+
const traits = await fetchProfileTraits(request, settings, payload.userId);
|
|
215
|
+
const profile = {
|
|
216
|
+
email: emailProfile.id,
|
|
217
|
+
traits
|
|
218
|
+
};
|
|
219
|
+
const toEmail = payload.toEmail || profile.email;
|
|
220
|
+
if (!toEmail) {
|
|
221
|
+
return;
|
|
221
222
|
}
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
223
|
+
if (isRestrictedDomain(toEmail)) {
|
|
224
|
+
throw new actions_core_1.IntegrationError('Emails with gmailx.com, yahoox.com, aolx.com, and hotmailx.com domains are blocked.', 'Invalid input', 400);
|
|
225
|
+
}
|
|
226
|
+
let name;
|
|
227
|
+
if (traits.first_name && traits.last_name) {
|
|
228
|
+
name = `${traits.first_name} ${traits.last_name}`;
|
|
229
|
+
}
|
|
230
|
+
else if (traits.firstName && traits.lastName) {
|
|
231
|
+
name = `${traits.firstName} ${traits.lastName}`;
|
|
232
|
+
}
|
|
233
|
+
else if (traits.name) {
|
|
234
|
+
name = traits.name;
|
|
235
|
+
}
|
|
236
|
+
else {
|
|
237
|
+
name = traits.first_name || traits.last_name || traits.firstName || traits.lastName || 'User';
|
|
238
|
+
}
|
|
239
|
+
const bcc = JSON.parse(payload.bcc ?? '[]');
|
|
240
|
+
let bodyHtml = payload.bodyHtml ?? '';
|
|
241
|
+
if (payload.bodyUrl && settings.unlayerApiKey) {
|
|
242
|
+
const response = await request(payload.bodyUrl);
|
|
243
|
+
const body = await response.text();
|
|
244
|
+
bodyHtml = payload.bodyType === 'html' ? body : await generateEmailHtml(request, settings.unlayerApiKey, body);
|
|
245
|
+
if (payload.previewText) {
|
|
246
|
+
bodyHtml = insertEmailPreviewText(bodyHtml, payload.previewText);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
return request('https://api.sendgrid.com/v3/mail/send', {
|
|
250
|
+
method: 'post',
|
|
251
|
+
headers: {
|
|
252
|
+
authorization: `Bearer ${settings.sendGridApiKey}`
|
|
253
|
+
},
|
|
254
|
+
json: {
|
|
255
|
+
personalizations: [
|
|
256
|
+
{
|
|
257
|
+
to: [
|
|
258
|
+
{
|
|
259
|
+
email: toEmail,
|
|
260
|
+
name: name
|
|
261
|
+
}
|
|
262
|
+
],
|
|
263
|
+
bcc: bcc.length > 0 ? bcc : undefined,
|
|
264
|
+
custom_args: {
|
|
265
|
+
...payload.customArgs,
|
|
266
|
+
source_id: settings.sourceId,
|
|
267
|
+
space_id: settings.spaceId,
|
|
268
|
+
user_id: payload.userId,
|
|
269
|
+
__segment_internal_external_id_key__: EXTERNAL_ID_KEY,
|
|
270
|
+
__segment_internal_external_id_value__: profile[EXTERNAL_ID_KEY]
|
|
235
271
|
}
|
|
236
|
-
],
|
|
237
|
-
bcc: bcc.length > 0 ? bcc : undefined,
|
|
238
|
-
custom_args: {
|
|
239
|
-
...payload.customArgs,
|
|
240
|
-
source_id: settings.sourceId,
|
|
241
|
-
space_id: settings.spaceId,
|
|
242
|
-
user_id: payload.userId,
|
|
243
|
-
__segment_internal_external_id_key__: EXTERNAL_ID_KEY,
|
|
244
|
-
__segment_internal_external_id_value__: profile[EXTERNAL_ID_KEY]
|
|
245
272
|
}
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
273
|
+
],
|
|
274
|
+
from: {
|
|
275
|
+
email: payload.fromEmail,
|
|
276
|
+
name: payload.fromName
|
|
277
|
+
},
|
|
278
|
+
reply_to: {
|
|
279
|
+
email: payload.replyToEmail,
|
|
280
|
+
name: payload.replyToName
|
|
281
|
+
},
|
|
282
|
+
subject: mustache_1.default.render(payload.subject, { profile }),
|
|
283
|
+
content: [
|
|
284
|
+
{
|
|
285
|
+
type: 'text/html',
|
|
286
|
+
value: mustache_1.default.render(bodyHtml, { profile })
|
|
287
|
+
}
|
|
288
|
+
],
|
|
289
|
+
tracking_settings: {
|
|
290
|
+
subscription_tracking: {
|
|
291
|
+
enable: true,
|
|
292
|
+
substitution_tag: '[unsubscribe]'
|
|
293
|
+
}
|
|
267
294
|
}
|
|
268
295
|
}
|
|
269
|
-
}
|
|
270
|
-
}
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
else {
|
|
299
|
+
throw new actions_core_1.IntegrationError(`Failed to process the subscription state: "${emailProfile.subscriptionStatus}"`, 'Invalid subscriptionStatus value', 400);
|
|
300
|
+
}
|
|
271
301
|
}
|
|
272
302
|
};
|
|
273
303
|
exports.default = action;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/personas-messaging-sendgrid/sendEmail/index.ts"],"names":[],"mappings":";;;;;AAAA,wDAA0F;AAG1F,wDAA+B;AAC/B,sDAA6B;AAC7B,6CAAwC;AAExC,MAAM,sBAAsB,GAAG,CAAC,IAAY,EAAE,WAAmB,EAAU,EAAE;IAC3E,MAAM,CAAC,GAAG,iBAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAG5B,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC;;QAEZ,wBAAU,CAAC,WAAW,CAAC;;;;QAIvB,cAAc,CAAC,MAAM,CAAC,EAAE,CAAC;;GAE9B,CAAC,CAAA;IAEF,OAAO,CAAC,CAAC,IAAI,EAAE,CAAA;AACjB,CAAC,CAAA;AAGD,MAAM,qBAAqB,GAAG,CAAC,WAAmB,EAAU,EAAE;IAC5D,OAAO,4BAA4B,WAAW,KAAK,YAAY,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,EAAE,CAAA;AACrF,CAAC,CAAA;AAID,MAAM,kBAAkB,GAAG,KAAK,EAC9B,OAAkB,EAClB,QAAkB,EAClB,SAAiB,EACgB,EAAE;IACnC,MAAM,QAAQ,GAAG,qBAAqB,CAAC,QAAQ,CAAC,qBAAqB,CAAC,CAAA;IACtE,MAAM,QAAQ,GAAG,MAAM,OAAO,CAC5B,GAAG,QAAQ,cAAc,QAAQ,CAAC,OAAO,uCAAuC,SAAS,mBAAmB,EAC5G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AC;yBAC9C;qBACF;oBACD,iBAAiB,EAAE;wBACjB,qBAAqB,EAAE;4BACrB,MAAM,EAAE,IAAI;4BACZ,gBAAgB,EAAE,eAAe;yBAClC;qBACF;iBACF;aACF,CAAC,CAAA;SACH;aAAM;YACL,MAAM,IAAI,+BAAgB,CACxB,8CAA8C,YAAY,CAAC,kBAAkB,GAAG,EAChF,kCAAkC,EAClC,GAAG,CACJ,CAAA;SACF;IACH,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const mustache_1 = __importDefault(require("mustache"));
|
|
7
|
+
const actions_core_1 = require("@segment/actions-core");
|
|
7
8
|
const getProfileApiEndpoint = (environment) => {
|
|
8
9
|
return `https://profiles.segment.${environment === 'production' ? 'com' : 'build'}`;
|
|
9
10
|
};
|
|
@@ -18,21 +19,6 @@ const fetchProfileTraits = async (request, settings, profileId) => {
|
|
|
18
19
|
const body = await response.json();
|
|
19
20
|
return body.traits;
|
|
20
21
|
};
|
|
21
|
-
const fetchProfileExternalIds = async (request, settings, profileId) => {
|
|
22
|
-
const endpoint = getProfileApiEndpoint(settings.profileApiEnvironment);
|
|
23
|
-
const response = await request(`${endpoint}/v1/spaces/${settings.spaceId}/collections/users/profiles/user_id:${profileId}/external_ids?limit=25`, {
|
|
24
|
-
headers: {
|
|
25
|
-
authorization: `Basic ${Buffer.from(settings.profileApiAccessToken + ':').toString('base64')}`,
|
|
26
|
-
'content-type': 'application/json'
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
const body = await response.json();
|
|
30
|
-
const externalIds = {};
|
|
31
|
-
for (const externalId of body.data) {
|
|
32
|
-
externalIds[externalId.type] = externalId.id;
|
|
33
|
-
}
|
|
34
|
-
return externalIds;
|
|
35
|
-
};
|
|
36
22
|
const EXTERNAL_ID_KEY = 'phone';
|
|
37
23
|
const DEFAULT_CONNECTION_OVERRIDES = 'rp=all&rc=5';
|
|
38
24
|
const action = {
|
|
@@ -82,52 +68,98 @@ const action = {
|
|
|
82
68
|
type: 'boolean',
|
|
83
69
|
required: false,
|
|
84
70
|
default: false
|
|
71
|
+
},
|
|
72
|
+
externalIds: {
|
|
73
|
+
label: 'External IDs',
|
|
74
|
+
description: 'An array of user profile identity information.',
|
|
75
|
+
type: 'object',
|
|
76
|
+
multiple: true,
|
|
77
|
+
properties: {
|
|
78
|
+
id: {
|
|
79
|
+
label: 'ID',
|
|
80
|
+
description: 'A unique identifier for the collection.',
|
|
81
|
+
type: 'string'
|
|
82
|
+
},
|
|
83
|
+
type: {
|
|
84
|
+
label: 'type',
|
|
85
|
+
description: 'The external ID contact type.',
|
|
86
|
+
type: 'string'
|
|
87
|
+
},
|
|
88
|
+
subscriptionStatus: {
|
|
89
|
+
label: 'ID',
|
|
90
|
+
description: 'The subscription status for the identity.',
|
|
91
|
+
type: 'string'
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
default: {
|
|
95
|
+
'@arrayPath': [
|
|
96
|
+
'$.external_ids',
|
|
97
|
+
{
|
|
98
|
+
id: {
|
|
99
|
+
'@path': '$.id'
|
|
100
|
+
},
|
|
101
|
+
type: {
|
|
102
|
+
'@path': '$.type'
|
|
103
|
+
},
|
|
104
|
+
subscriptionStatus: {
|
|
105
|
+
'@path': '$.isSubscribed'
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
]
|
|
109
|
+
}
|
|
85
110
|
}
|
|
86
111
|
},
|
|
87
112
|
perform: async (request, { settings, payload }) => {
|
|
88
113
|
if (!payload.send) {
|
|
89
114
|
return;
|
|
90
115
|
}
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
fetchProfileExternalIds(request, settings, payload.userId)
|
|
94
|
-
]);
|
|
95
|
-
const profile = {
|
|
96
|
-
...externalIds,
|
|
97
|
-
traits
|
|
98
|
-
};
|
|
99
|
-
const phone = payload.toNumber || profile.phone;
|
|
100
|
-
if (!phone) {
|
|
116
|
+
const externalId = payload.externalIds?.find(({ type }) => type === 'phone');
|
|
117
|
+
if (!externalId?.subscriptionStatus || ['unsubscribed', 'did not subscribed', 'false'].includes(externalId.subscriptionStatus)) {
|
|
101
118
|
return;
|
|
102
119
|
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
+
else if (['subscribed', 'true'].includes(externalId.subscriptionStatus)) {
|
|
121
|
+
const traits = await fetchProfileTraits(request, settings, payload.userId);
|
|
122
|
+
const phone = payload.toNumber || externalId.id;
|
|
123
|
+
if (!phone) {
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
const profile = {
|
|
127
|
+
user_id: payload.userId,
|
|
128
|
+
phone,
|
|
129
|
+
traits
|
|
130
|
+
};
|
|
131
|
+
const token = Buffer.from(`${settings.twilioAccountId}:${settings.twilioAuthToken}`).toString('base64');
|
|
132
|
+
const body = new URLSearchParams({
|
|
133
|
+
Body: mustache_1.default.render(payload.body, { profile }),
|
|
134
|
+
From: payload.from,
|
|
135
|
+
To: phone
|
|
136
|
+
});
|
|
137
|
+
const webhookUrl = settings.webhookUrl;
|
|
138
|
+
const connectionOverrides = settings.connectionOverrides;
|
|
139
|
+
const customArgs = {
|
|
140
|
+
...payload.customArgs,
|
|
141
|
+
__segment_internal_external_id_key__: EXTERNAL_ID_KEY,
|
|
142
|
+
__segment_internal_external_id_value__: phone
|
|
143
|
+
};
|
|
144
|
+
if (webhookUrl && customArgs) {
|
|
145
|
+
const webhookUrlWithParams = new URL(webhookUrl);
|
|
146
|
+
for (const key of Object.keys(customArgs)) {
|
|
147
|
+
webhookUrlWithParams.searchParams.append(key, String(customArgs[key]));
|
|
148
|
+
}
|
|
149
|
+
webhookUrlWithParams.hash = connectionOverrides || DEFAULT_CONNECTION_OVERRIDES;
|
|
150
|
+
body.append('StatusCallback', webhookUrlWithParams.toString());
|
|
120
151
|
}
|
|
121
|
-
|
|
122
|
-
|
|
152
|
+
return request(`https://api.twilio.com/2010-04-01/Accounts/${settings.twilioAccountId}/Messages.json`, {
|
|
153
|
+
method: 'POST',
|
|
154
|
+
headers: {
|
|
155
|
+
authorization: `Basic ${token}`
|
|
156
|
+
},
|
|
157
|
+
body
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
throw new actions_core_1.IntegrationError(`Failed to recognize the subscriptionStatus in the payload: "${externalId.subscriptionStatus}".`, 'Invalid subscriptionStatus value', 400);
|
|
123
162
|
}
|
|
124
|
-
return request(`https://api.twilio.com/2010-04-01/Accounts/${settings.twilioAccountId}/Messages.json`, {
|
|
125
|
-
method: 'POST',
|
|
126
|
-
headers: {
|
|
127
|
-
authorization: `Basic ${token}`
|
|
128
|
-
},
|
|
129
|
-
body
|
|
130
|
-
});
|
|
131
163
|
}
|
|
132
164
|
};
|
|
133
165
|
exports.default = action;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/personas-messaging-twilio/sendSms/index.ts"],"names":[],"mappings":";;;;;AAAA,wDAA+B;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/personas-messaging-twilio/sendSms/index.ts"],"names":[],"mappings":";;;;;AAAA,wDAA+B;AAI/B,wDAAwD;AAExD,MAAM,qBAAqB,GAAG,CAAC,WAAmB,EAAU,EAAE;IAC5D,OAAO,4BAA4B,WAAW,KAAK,YAAY,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,EAAE,CAAA;AACrF,CAAC,CAAA;AAID,MAAM,kBAAkB,GAAG,KAAK,EAC9B,OAAkB,EA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rB,oCAAoC,EAAE,eAAe;gBACrD,sCAAsC,EAAE,KAAK;aAC9C,CAAA;YAED,IAAI,UAAU,IAAI,UAAU,EAAE;gBAI5B,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,CAAA;gBAChD,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE;oBACzC,oBAAoB,CAAC,YAAY,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;iBACvE;gBAED,oBAAoB,CAAC,IAAI,GAAG,mBAAmB,IAAI,4BAA4B,CAAA;gBAE/E,IAAI,CAAC,MAAM,CAAC,gBAAgB,EAAE,oBAAoB,CAAC,QAAQ,EAAE,CAAC,CAAA;aAC/D;YAED,OAAO,OAAO,CAAC,8CAA8C,QAAQ,CAAC,eAAe,gBAAgB,EAAE;gBACrG,MAAM,EAAE,MAAM;gBACd,OAAO,EAAE;oBACP,aAAa,EAAE,SAAS,KAAK,EAAE;iBAChC;gBACD,IAAI;aACL,CAAC,CAAA;SACH;aAAM;YACL,MAAM,IAAI,+BAAgB,CACxB,+DAA+D,UAAU,CAAC,kBAAkB,IAAI,EAChG,kCAAkC,EAClC,GAAG,CACJ,CAAA;SACF;IACH,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export interface Payload {
|
|
2
|
+
operation: string;
|
|
3
|
+
traits?: {
|
|
4
|
+
[k: string]: unknown;
|
|
5
|
+
};
|
|
6
|
+
name?: string;
|
|
7
|
+
account_number?: string;
|
|
8
|
+
number_of_employees?: number;
|
|
9
|
+
billing_city?: string;
|
|
10
|
+
billing_postal_code?: string;
|
|
11
|
+
billing_country?: string;
|
|
12
|
+
billing_street?: string;
|
|
13
|
+
billing_state?: string;
|
|
14
|
+
shipping_city?: string;
|
|
15
|
+
shipping_postal_code?: string;
|
|
16
|
+
shipping_country?: string;
|
|
17
|
+
shipping_street?: string;
|
|
18
|
+
shipping_state?: string;
|
|
19
|
+
phone?: string;
|
|
20
|
+
description?: string;
|
|
21
|
+
website?: string;
|
|
22
|
+
customFields?: {
|
|
23
|
+
[k: string]: unknown;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/salesforce/account/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const actions_core_1 = require("@segment/actions-core");
|
|
7
|
+
const sf_operations_1 = __importDefault(require("../sf-operations"));
|
|
8
|
+
const sf_properties_1 = require("../sf-properties");
|
|
9
|
+
const action = {
|
|
10
|
+
title: 'Account',
|
|
11
|
+
description: 'Account action',
|
|
12
|
+
fields: {
|
|
13
|
+
operation: sf_properties_1.operation,
|
|
14
|
+
traits: sf_properties_1.traits,
|
|
15
|
+
name: {
|
|
16
|
+
label: 'Name',
|
|
17
|
+
description: 'Name of the account. This is required to create an account.',
|
|
18
|
+
type: 'string',
|
|
19
|
+
default: {
|
|
20
|
+
'@path': '$.name'
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
account_number: {
|
|
24
|
+
label: 'Account Number',
|
|
25
|
+
description: 'Account number assigned to the account. This is not the unique, system-generated ID assigned during creation.',
|
|
26
|
+
type: 'string',
|
|
27
|
+
default: {
|
|
28
|
+
'@path': '$.groupId'
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
number_of_employees: {
|
|
32
|
+
label: 'Number of employees',
|
|
33
|
+
description: 'Number of employees working at the company represented by the account.',
|
|
34
|
+
type: 'integer',
|
|
35
|
+
default: {
|
|
36
|
+
'@if': {
|
|
37
|
+
exists: { '@path': '$.traits.employees' },
|
|
38
|
+
then: { '@path': '$.traits.employees' },
|
|
39
|
+
else: { '@path': '$.properties.employees' }
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
billing_city: {
|
|
44
|
+
label: 'Billing City',
|
|
45
|
+
description: 'City for the billing address of the account.',
|
|
46
|
+
type: 'string',
|
|
47
|
+
default: {
|
|
48
|
+
'@if': {
|
|
49
|
+
exists: { '@path': '$.traits.address.city' },
|
|
50
|
+
then: { '@path': '$.traits.address.city' },
|
|
51
|
+
else: { '@path': '$.properties.address.city' }
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
billing_postal_code: {
|
|
56
|
+
label: 'Billing Postal Code',
|
|
57
|
+
description: 'Postal code for the billing address of the account.',
|
|
58
|
+
type: 'string',
|
|
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
|
+
billing_country: {
|
|
68
|
+
label: 'Billing Country',
|
|
69
|
+
description: 'Country for the billing address of the account.',
|
|
70
|
+
type: 'string',
|
|
71
|
+
default: {
|
|
72
|
+
'@if': {
|
|
73
|
+
exists: { '@path': '$.traits.address.country' },
|
|
74
|
+
then: { '@path': '$.traits.address.country' },
|
|
75
|
+
else: { '@path': '$.properties.address.country' }
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
billing_street: {
|
|
80
|
+
label: 'Billing Street',
|
|
81
|
+
description: 'Street address for the billing address of the account.',
|
|
82
|
+
type: 'string',
|
|
83
|
+
default: {
|
|
84
|
+
'@if': {
|
|
85
|
+
exists: { '@path': '$.traits.address.street' },
|
|
86
|
+
then: { '@path': '$.traits.address.street' },
|
|
87
|
+
else: { '@path': '$.properties.address.street' }
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
billing_state: {
|
|
92
|
+
label: 'Billing State',
|
|
93
|
+
description: 'State for the billing address of the account.',
|
|
94
|
+
type: 'string',
|
|
95
|
+
default: {
|
|
96
|
+
'@if': {
|
|
97
|
+
exists: { '@path': '$.traits.address.state' },
|
|
98
|
+
then: { '@path': '$.traits.address.state' },
|
|
99
|
+
else: { '@path': '$.properties.address.state' }
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
shipping_city: {
|
|
104
|
+
label: 'Shipping City',
|
|
105
|
+
description: 'City for the shipping address of the account.',
|
|
106
|
+
type: 'string'
|
|
107
|
+
},
|
|
108
|
+
shipping_postal_code: {
|
|
109
|
+
label: 'Shipping Postal Code',
|
|
110
|
+
description: 'Postal code for the shipping address of the account.',
|
|
111
|
+
type: 'string'
|
|
112
|
+
},
|
|
113
|
+
shipping_country: {
|
|
114
|
+
label: 'Shipping Country',
|
|
115
|
+
description: 'Country for the shipping address of the account.',
|
|
116
|
+
type: 'string'
|
|
117
|
+
},
|
|
118
|
+
shipping_street: {
|
|
119
|
+
label: 'Shipping Street',
|
|
120
|
+
description: 'Street address for the shipping address of the account.',
|
|
121
|
+
type: 'string'
|
|
122
|
+
},
|
|
123
|
+
shipping_state: {
|
|
124
|
+
label: 'Shipping State',
|
|
125
|
+
description: 'State for the shipping address of the account.',
|
|
126
|
+
type: 'string'
|
|
127
|
+
},
|
|
128
|
+
phone: {
|
|
129
|
+
label: 'Phone',
|
|
130
|
+
description: 'Phone number for the account.',
|
|
131
|
+
type: 'string',
|
|
132
|
+
default: {
|
|
133
|
+
'@if': {
|
|
134
|
+
exists: { '@path': '$.traits.phone' },
|
|
135
|
+
then: { '@path': '$.traits.phone' },
|
|
136
|
+
else: { '@path': '$.properties.phone' }
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
description: {
|
|
141
|
+
label: 'Description',
|
|
142
|
+
description: 'Text description of the account.',
|
|
143
|
+
type: 'string',
|
|
144
|
+
default: {
|
|
145
|
+
'@if': {
|
|
146
|
+
exists: { '@path': '$.traits.description' },
|
|
147
|
+
then: { '@path': '$.traits.description' },
|
|
148
|
+
else: { '@path': '$.properties.description' }
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
website: {
|
|
153
|
+
label: 'Website',
|
|
154
|
+
description: 'The website of the account.',
|
|
155
|
+
type: 'string',
|
|
156
|
+
default: {
|
|
157
|
+
'@if': {
|
|
158
|
+
exists: { '@path': '$.traits.website' },
|
|
159
|
+
then: { '@path': '$.traits.website' },
|
|
160
|
+
else: { '@path': '$.properties.website' }
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
customFields: sf_properties_1.customFields
|
|
165
|
+
},
|
|
166
|
+
perform: async (request, { settings, payload }) => {
|
|
167
|
+
const sf = new sf_operations_1.default(settings.instanceUrl, request);
|
|
168
|
+
if (payload.operation === 'create') {
|
|
169
|
+
if (!payload.name) {
|
|
170
|
+
throw new actions_core_1.IntegrationError('Missing name value', 'Misconfigured required field', 400);
|
|
171
|
+
}
|
|
172
|
+
return await sf.createRecord(payload, 'Account');
|
|
173
|
+
}
|
|
174
|
+
sf_properties_1.validateLookup(payload);
|
|
175
|
+
if (payload.operation === 'update') {
|
|
176
|
+
return await sf.updateRecord(payload, 'Account');
|
|
177
|
+
}
|
|
178
|
+
if (payload.operation === 'upsert') {
|
|
179
|
+
if (!payload.name) {
|
|
180
|
+
throw new actions_core_1.IntegrationError('Missing name value', 'Misconfigured required field', 400);
|
|
181
|
+
}
|
|
182
|
+
return await sf.upsertRecord(payload, 'Account');
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
exports.default = action;
|
|
187
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/salesforce/account/index.ts"],"names":[],"mappings":";;;;;AAAA,wDAA0E;AAE1E,qEAAyC;AACzC,oDAAkF;AAGlF,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,SAAS;IAChB,WAAW,EAAE,gBAAgB;IAC7B,MAAM,EAAE;QACN,SAAS,EAAE,yBAAS;QACpB,MAAM,EAAE,sBAAM;QACd,IAAI,EAAE;YACJ,KAAK,EAAE,MAAM;YACb,WAAW,EAAE,6DAA6D;YAC1E,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,QAAQ;aAClB;SACF;QACD,cAAc,EAAE;YACd,KAAK,EAAE,gBAAgB;YACvB,WAAW,EACT,+GAA+G;YACjH,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,WAAW;aACrB;SACF;QACD,mBAAmB,EAAE;YACnB,KAAK,EAAE,qBAAqB;YAC5B,WAAW,EAAE,wEAAwE;YACrF,IAAI,EAAE,SAAS;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,YAAY,EAAE;YACZ,KAAK,EAAE,cAAc;YACrB,WAAW,EAAE,8CAA8C;YAC3D,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE;gBACP,KAAK,EAAE;oBACL,MAAM,EAAE,EAAE,OAAO,EAAE,uBAAuB,EAAE;oBAC5C,IAAI,EAAE,EAAE,OAAO,EAAE,uBAAuB,EAAE;oBAC1C,IAAI,EAAE,EAAE,OAAO,EAAE,2BAA2B,EAAE;iBAC/C;aACF;SACF;QACD,mBAAmB,EAAE;YACnB,KAAK,EAAE,qBAAqB;YAC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,OAAO,EAAE,kBAAkB,EAAE;oBACrC,IAAI,EAAE,EAAE,OAAO,EAAE,sBAAsB,EAAE;iBAC1C;aACF;SACF;QACD,YAAY,EAAE,4BAAY;KAC3B;IACD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE;QAChD,MAAM,EAAE,GAAe,IAAI,uBAAU,CAAC,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC,CAAA;QAEpE,IAAI,OAAO,CAAC,SAAS,KAAK,QAAQ,EAAE;YAClC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE;gBACjB,MAAM,IAAI,+BAAgB,CAAC,oBAAoB,EAAE,8BAA8B,EAAE,GAAG,CAAC,CAAA;aACtF;YACD,OAAO,MAAM,EAAE,CAAC,YAAY,CAAC,OAAO,EAAE,SAAS,CAAC,CAAA;SACjD;QAED,8BAAc,CAAC,OAAO,CAAC,CAAA;QAEvB,IAAI,OAAO,CAAC,SAAS,KAAK,QAAQ,EAAE;YAClC,OAAO,MAAM,EAAE,CAAC,YAAY,CAAC,OAAO,EAAE,SAAS,CAAC,CAAA;SACjD;QAED,IAAI,OAAO,CAAC,SAAS,KAAK,QAAQ,EAAE;YAClC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE;gBACjB,MAAM,IAAI,+BAAgB,CAAC,oBAAoB,EAAE,8BAA8B,EAAE,GAAG,CAAC,CAAA;aACtF;YACD,OAAO,MAAM,EAAE,CAAC,YAAY,CAAC,OAAO,EAAE,SAAS,CAAC,CAAA;SACjD;IACH,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -5,7 +5,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const case_1 = __importDefault(require("./case"));
|
|
7
7
|
const lead_1 = __importDefault(require("./lead"));
|
|
8
|
+
const opportunity_1 = __importDefault(require("./opportunity"));
|
|
8
9
|
const customObject_1 = __importDefault(require("./customObject"));
|
|
10
|
+
const account_1 = __importDefault(require("./account"));
|
|
9
11
|
const destination = {
|
|
10
12
|
name: 'Salesforce (Actions)',
|
|
11
13
|
slug: 'actions-salesforce',
|
|
@@ -43,7 +45,9 @@ const destination = {
|
|
|
43
45
|
actions: {
|
|
44
46
|
lead: lead_1.default,
|
|
45
47
|
customObject: customObject_1.default,
|
|
46
|
-
cases: case_1.default
|
|
48
|
+
cases: case_1.default,
|
|
49
|
+
opportunity: opportunity_1.default,
|
|
50
|
+
account: account_1.default
|
|
47
51
|
}
|
|
48
52
|
};
|
|
49
53
|
exports.default = destination;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/salesforce/index.ts"],"names":[],"mappings":";;;;;AAGA,kDAA0B;AAC1B,kDAAyB;AACzB,kEAAyC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/salesforce/index.ts"],"names":[],"mappings":";;;;;AAGA,kDAA0B;AAC1B,kDAAyB;AACzB,gEAAuC;AACvC,kEAAyC;AAEzC,wDAA+B;AAM/B,MAAM,WAAW,GAAoC;IACnD,IAAI,EAAE,sBAAsB;IAC5B,IAAI,EAAE,oBAAoB;IAC1B,IAAI,EAAE,OAAO;IAEb,cAAc,EAAE;QACd,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE;YACN,WAAW,EAAE;gBACX,KAAK,EAAE,cAAc;gBACrB,WAAW,EACT,2HAA2H;gBAC7H,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,IAAI;aACf;SACF;QACD,kBAAkB,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;YAE9C,MAAM,GAAG,GAAG,MAAM,OAAO,CAAuB,oDAAoD,EAAE;gBACpG,MAAM,EAAE,MAAM;gBACd,IAAI,EAAE,IAAI,eAAe,CAAC;oBACxB,aAAa,EAAE,IAAI,CAAC,YAAY;oBAChC,SAAS,EAAE,IAAI,CAAC,QAAQ;oBACxB,aAAa,EAAE,IAAI,CAAC,YAAY;oBAChC,UAAU,EAAE,eAAe;iBAC5B,CAAC;aACH,CAAC,CAAA;YACF,OAAO,EAAE,WAAW,EAAE,GAAG,CAAC,IAAI,CAAC,YAAY,EAAE,CAAA;QAC/C,CAAC;KACF;IACD,aAAa,CAAC,EAAE,IAAI,EAAE;QACpB,OAAO;YACL,OAAO,EAAE;gBACP,aAAa,EAAE,UAAU,IAAI,EAAE,WAAW,EAAE;aAC7C;SACF,CAAA;IACH,CAAC;IAED,OAAO,EAAE;QACP,IAAI,EAAJ,cAAI;QACJ,YAAY,EAAZ,sBAAY;QACZ,KAAK,EAAL,cAAK;QACL,WAAW,EAAX,qBAAW;QACX,OAAO,EAAP,iBAAO;KACR;CACF,CAAA;AAED,kBAAe,WAAW,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/salesforce/opportunity/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const actions_core_1 = require("@segment/actions-core");
|
|
7
|
+
const sf_operations_1 = __importDefault(require("../sf-operations"));
|
|
8
|
+
const sf_properties_1 = require("../sf-properties");
|
|
9
|
+
const action = {
|
|
10
|
+
title: 'Opportunity',
|
|
11
|
+
description: 'Opportunity action',
|
|
12
|
+
fields: {
|
|
13
|
+
operation: sf_properties_1.operation,
|
|
14
|
+
traits: sf_properties_1.traits,
|
|
15
|
+
amount: {
|
|
16
|
+
label: 'Amount',
|
|
17
|
+
description: 'Estimated total sale amount',
|
|
18
|
+
type: 'string'
|
|
19
|
+
},
|
|
20
|
+
close_date: {
|
|
21
|
+
label: 'Close Date',
|
|
22
|
+
description: 'Date when the opportunity is expected to close. This is required to create an opportunity.',
|
|
23
|
+
type: 'string'
|
|
24
|
+
},
|
|
25
|
+
description: {
|
|
26
|
+
label: 'Description',
|
|
27
|
+
description: 'A text description of the opportunity.',
|
|
28
|
+
type: 'string'
|
|
29
|
+
},
|
|
30
|
+
name: {
|
|
31
|
+
label: 'Name',
|
|
32
|
+
description: 'A name for the opportunity. This is required to create an opportunity.',
|
|
33
|
+
type: 'string'
|
|
34
|
+
},
|
|
35
|
+
stage_name: {
|
|
36
|
+
label: 'Stage Name',
|
|
37
|
+
description: 'Current stage of the opportunity. This is required to create an opportunity. The Stage Name value must match available picklist values in the OpportunityStage object.',
|
|
38
|
+
type: 'string'
|
|
39
|
+
},
|
|
40
|
+
customFields: sf_properties_1.customFields
|
|
41
|
+
},
|
|
42
|
+
perform: async (request, { settings, payload }) => {
|
|
43
|
+
const sf = new sf_operations_1.default(settings.instanceUrl, request);
|
|
44
|
+
if (payload.operation === 'create') {
|
|
45
|
+
if (!payload.close_date || !payload.name || !payload.stage_name) {
|
|
46
|
+
throw new actions_core_1.IntegrationError('Missing close_date, name or stage_name value', 'Misconfigured required field', 400);
|
|
47
|
+
}
|
|
48
|
+
return await sf.createRecord(payload, 'Opportunity');
|
|
49
|
+
}
|
|
50
|
+
sf_properties_1.validateLookup(payload);
|
|
51
|
+
if (payload.operation === 'update') {
|
|
52
|
+
return await sf.updateRecord(payload, 'Opportunity');
|
|
53
|
+
}
|
|
54
|
+
if (payload.operation === 'upsert') {
|
|
55
|
+
if (!payload.close_date || !payload.name || !payload.stage_name) {
|
|
56
|
+
throw new actions_core_1.IntegrationError('Missing close_date, name or stage_name value', 'Misconfigured required field', 400);
|
|
57
|
+
}
|
|
58
|
+
return await sf.upsertRecord(payload, 'Opportunity');
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
exports.default = action;
|
|
63
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/salesforce/opportunity/index.ts"],"names":[],"mappings":";;;;;AAAA,wDAA0E;AAE1E,qEAAyC;AACzC,oDAAkF;AAGlF,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,aAAa;IACpB,WAAW,EAAE,oBAAoB;IACjC,MAAM,EAAE;QACN,SAAS,EAAE,yBAAS;QACpB,MAAM,EAAE,sBAAM;QACd,MAAM,EAAE;YACN,KAAK,EAAE,QAAQ;YACf,WAAW,EAAE,6BAA6B;YAC1C,IAAI,EAAE,QAAQ;SACf;QACD,UAAU,EAAE;YACV,KAAK,EAAE,YAAY;YACnB,WAAW,EAAE,4FAA4F;YACzG,IAAI,EAAE,QAAQ;SACf;QACD,WAAW,EAAE;YACX,KAAK,EAAE,aAAa;YACpB,WAAW,EAAE,wCAAwC;YACrD,IAAI,EAAE,QAAQ;SACf;QACD,IAAI,EAAE;YACJ,KAAK,EAAE,MAAM;YACb,WAAW,EAAE,wEAAwE;YACrF,IAAI,EAAE,QAAQ;SACf;QACD,UAAU,EAAE;YACV,KAAK,EAAE,YAAY;YACnB,WAAW,EACT,wKAAwK;YAC1K,IAAI,EAAE,QAAQ;SACf;QACD,YAAY,EAAE,4BAAY;KAC3B;IACD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE;QAChD,MAAM,EAAE,GAAe,IAAI,uBAAU,CAAC,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC,CAAA;QAEpE,IAAI,OAAO,CAAC,SAAS,KAAK,QAAQ,EAAE;YAClC,IAAI,CAAC,OAAO,CAAC,UAAU,IAAI,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE;gBAC/D,MAAM,IAAI,+BAAgB,CAAC,8CAA8C,EAAE,8BAA8B,EAAE,GAAG,CAAC,CAAA;aAChH;YACD,OAAO,MAAM,EAAE,CAAC,YAAY,CAAC,OAAO,EAAE,aAAa,CAAC,CAAA;SACrD;QAED,8BAAc,CAAC,OAAO,CAAC,CAAA;QAEvB,IAAI,OAAO,CAAC,SAAS,KAAK,QAAQ,EAAE;YAClC,OAAO,MAAM,EAAE,CAAC,YAAY,CAAC,OAAO,EAAE,aAAa,CAAC,CAAA;SACrD;QAED,IAAI,OAAO,CAAC,SAAS,KAAK,QAAQ,EAAE;YAClC,IAAI,CAAC,OAAO,CAAC,UAAU,IAAI,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE;gBAC/D,MAAM,IAAI,+BAAgB,CAAC,8CAA8C,EAAE,8BAA8B,EAAE,GAAG,CAAC,CAAA;aAChH;YACD,OAAO,MAAM,EAAE,CAAC,YAAY,CAAC,OAAO,EAAE,aAAa,CAAC,CAAA;SACrD;IACH,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -19,9 +19,40 @@ const CaseShape = (payload) => {
|
|
|
19
19
|
Description: payload.description
|
|
20
20
|
};
|
|
21
21
|
};
|
|
22
|
+
const OpportunityShape = (payload) => {
|
|
23
|
+
return {
|
|
24
|
+
Amount: payload.amount,
|
|
25
|
+
CloseDate: payload.close_date,
|
|
26
|
+
Description: payload.description,
|
|
27
|
+
Name: payload.name,
|
|
28
|
+
StageName: payload.stage_name
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
const AccountShape = (payload) => {
|
|
32
|
+
return {
|
|
33
|
+
Name: payload.name,
|
|
34
|
+
AccountNumber: payload.account_number,
|
|
35
|
+
NumberOfEmployees: payload.number_of_employees,
|
|
36
|
+
BillingCity: payload.billing_city,
|
|
37
|
+
BillingPostalCode: payload.billing_postal_code,
|
|
38
|
+
BillingCountry: payload.billing_country,
|
|
39
|
+
BillingStreet: payload.billing_street,
|
|
40
|
+
BillingState: payload.billing_state,
|
|
41
|
+
ShippingCity: payload.shipping_city,
|
|
42
|
+
ShippingPostalCode: payload.shipping_postal_code,
|
|
43
|
+
ShippingCountry: payload.shipping_country,
|
|
44
|
+
ShippingStreet: payload.shipping_street,
|
|
45
|
+
ShippingState: payload.shipping_state,
|
|
46
|
+
Phone: payload.phone,
|
|
47
|
+
Description: payload.description,
|
|
48
|
+
Website: payload.website
|
|
49
|
+
};
|
|
50
|
+
};
|
|
22
51
|
const objectToShape = new Map([
|
|
23
52
|
['lead', LeadShape],
|
|
24
|
-
['case', CaseShape]
|
|
53
|
+
['case', CaseShape],
|
|
54
|
+
['opportunity', OpportunityShape],
|
|
55
|
+
['account', AccountShape]
|
|
25
56
|
]);
|
|
26
57
|
const mapObjectToShape = (payload, sobject) => {
|
|
27
58
|
const shapeFunction = objectToShape.get(sobject.toLowerCase());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sf-object-to-shape.js","sourceRoot":"","sources":["../../../src/destinations/salesforce/sf-object-to-shape.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"sf-object-to-shape.js","sourceRoot":"","sources":["../../../src/destinations/salesforce/sf-object-to-shape.ts"],"names":[],"mappings":";;;AASA,MAAM,SAAS,GAAG,CAAC,OAAuB,EAAqB,EAAE;IAC/D,OAAO;QACL,QAAQ,EAAE,OAAO,CAAC,SAAS;QAC3B,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,SAAS,EAAE,OAAO,CAAC,UAAU;QAC7B,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,UAAU,EAAE,OAAO,CAAC,WAAW;QAC/B,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,KAAK,EAAE,OAAO,CAAC,KAAK;KACrB,CAAA;AACH,CAAC,CAAA;AAED,MAAM,SAAS,GAAG,CAAC,OAAuB,EAAqB,EAAE;IAC/D,OA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AA;AAEK,MAAM,gBAAgB,GAAG,CAAC,OAAuB,EAAE,OAAe,EAAoB,EAAE;IAC7F,MAAM,aAAa,GAAG,aAAa,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,CAAA;IAE9D,IAAI,CAAC,aAAa,EAAE;QAClB,MAAM,IAAI,KAAK,CAAC,2BAA2B,OAAO,EAAE,CAAC,CAAA;KACtD;IAED,OAAO,aAAa,CAAC,OAAO,CAAC,CAAA;AAC/B,CAAC,CAAA;AARY,QAAA,gBAAgB,oBAQ5B"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { Payload as LeadPayload } from './lead/generated-types';
|
|
2
2
|
import type { Payload as CustomPayload } from './customObject/generated-types';
|
|
3
3
|
import type { Payload as CasePayload } from './case/generated-types';
|
|
4
|
-
|
|
4
|
+
import type { Payload as OpportunityPayload } from './opportunity/generated-types';
|
|
5
|
+
import type { Payload as AccountPayload } from './account/generated-types';
|
|
6
|
+
export declare type GenericPayload = Partial<LeadPayload & CustomPayload & CasePayload & AccountPayload & OpportunityPayload>;
|
|
5
7
|
export declare type LeadBaseShapeType = {
|
|
6
8
|
LastName?: string;
|
|
7
9
|
Company?: string;
|
|
@@ -16,4 +18,29 @@ export declare type LeadBaseShapeType = {
|
|
|
16
18
|
export declare type CaseBaseShapeType = {
|
|
17
19
|
Description?: string;
|
|
18
20
|
};
|
|
19
|
-
export declare type
|
|
21
|
+
export declare type OpportunityBaseShapeType = {
|
|
22
|
+
Amount?: string;
|
|
23
|
+
CloseDate?: string;
|
|
24
|
+
Description?: string;
|
|
25
|
+
Name?: string;
|
|
26
|
+
StageName?: string;
|
|
27
|
+
};
|
|
28
|
+
export declare type AccountBaseShapeType = {
|
|
29
|
+
Name?: string;
|
|
30
|
+
AccountNumber?: string;
|
|
31
|
+
NumberOfEmployees?: number;
|
|
32
|
+
BillingCity?: string;
|
|
33
|
+
BillingPostalCode?: string;
|
|
34
|
+
BillingCountry?: string;
|
|
35
|
+
BillingStreet?: string;
|
|
36
|
+
BillingState?: string;
|
|
37
|
+
ShippingCity?: string;
|
|
38
|
+
ShippingPostalCode?: string;
|
|
39
|
+
ShippingCountry?: string;
|
|
40
|
+
ShippingStreet?: string;
|
|
41
|
+
ShippingState?: string;
|
|
42
|
+
Phone?: string;
|
|
43
|
+
Description?: string;
|
|
44
|
+
Website?: string;
|
|
45
|
+
};
|
|
46
|
+
export declare type GenericBaseShape = Partial<LeadBaseShapeType & CaseBaseShapeType & AccountBaseShapeType & OpportunityBaseShapeType>;
|
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.
|
|
4
|
+
"version": "3.54.1-alpha.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/segmentio/action-destinations",
|
|
@@ -62,5 +62,5 @@
|
|
|
62
62
|
"<rootDir>/test/setup-after-env.ts"
|
|
63
63
|
]
|
|
64
64
|
},
|
|
65
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "3cf1e428769232fcaf1ad421021c40eb7c62a256"
|
|
66
66
|
}
|