@segment/action-destinations 3.73.0 → 3.74.1-alpha.1

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 (63) hide show
  1. package/dist/destinations/gainsight-px-cloud-action/index.js +30 -36
  2. package/dist/destinations/gainsight-px-cloud-action/index.js.map +1 -1
  3. package/dist/destinations/gainsight-px-cloud-action/regional-endpoints.js +3 -3
  4. package/dist/destinations/gainsight-px-cloud-action/regional-endpoints.js.map +1 -1
  5. package/dist/destinations/gainsight-px-cloud-action/sendEvent/generated-types.d.ts +5 -0
  6. package/dist/destinations/gainsight-px-cloud-action/{groupIdentify → sendEvent}/generated-types.js +0 -0
  7. package/dist/destinations/gainsight-px-cloud-action/sendEvent/generated-types.js.map +1 -0
  8. package/dist/destinations/gainsight-px-cloud-action/{identifyUser → sendEvent}/index.d.ts +0 -0
  9. package/dist/destinations/gainsight-px-cloud-action/{groupIdentify → sendEvent}/index.js +5 -5
  10. package/dist/destinations/gainsight-px-cloud-action/sendEvent/index.js.map +1 -0
  11. package/dist/destinations/snap-conversions-api/index.js +1 -1
  12. package/dist/destinations/talon-one/t1-properties.js +10 -4
  13. package/dist/destinations/talon-one/t1-properties.js.map +1 -1
  14. package/dist/destinations/talon-one/trackEvent/index.js +10 -2
  15. package/dist/destinations/talon-one/trackEvent/index.js.map +1 -1
  16. package/dist/destinations/talon-one/updateCustomerProfile/index.js +1 -1
  17. package/dist/destinations/talon-one/updateCustomerProfile/index.js.map +1 -1
  18. package/package.json +2 -2
  19. package/dist/destinations/gainsight-px-cloud-action/groupIdentify/generated-types.d.ts +0 -2
  20. package/dist/destinations/gainsight-px-cloud-action/groupIdentify/generated-types.js.map +0 -1
  21. package/dist/destinations/gainsight-px-cloud-action/groupIdentify/index.d.ts +0 -5
  22. package/dist/destinations/gainsight-px-cloud-action/groupIdentify/index.js.map +0 -1
  23. package/dist/destinations/gainsight-px-cloud-action/identifyUser/generated-types.d.ts +0 -2
  24. package/dist/destinations/gainsight-px-cloud-action/identifyUser/generated-types.js +0 -3
  25. package/dist/destinations/gainsight-px-cloud-action/identifyUser/generated-types.js.map +0 -1
  26. package/dist/destinations/gainsight-px-cloud-action/identifyUser/index.js +0 -17
  27. package/dist/destinations/gainsight-px-cloud-action/identifyUser/index.js.map +0 -1
  28. package/dist/destinations/gainsight-px-cloud-action/trackEvent/generated-types.d.ts +0 -2
  29. package/dist/destinations/gainsight-px-cloud-action/trackEvent/generated-types.js +0 -3
  30. package/dist/destinations/gainsight-px-cloud-action/trackEvent/generated-types.js.map +0 -1
  31. package/dist/destinations/gainsight-px-cloud-action/trackEvent/index.d.ts +0 -5
  32. package/dist/destinations/gainsight-px-cloud-action/trackEvent/index.js +0 -17
  33. package/dist/destinations/gainsight-px-cloud-action/trackEvent/index.js.map +0 -1
  34. package/dist/destinations/gainsight-px-cloud-action/trackPageView/generated-types.d.ts +0 -2
  35. package/dist/destinations/gainsight-px-cloud-action/trackPageView/generated-types.js +0 -3
  36. package/dist/destinations/gainsight-px-cloud-action/trackPageView/generated-types.js.map +0 -1
  37. package/dist/destinations/gainsight-px-cloud-action/trackPageView/index.d.ts +0 -5
  38. package/dist/destinations/gainsight-px-cloud-action/trackPageView/index.js +0 -17
  39. package/dist/destinations/gainsight-px-cloud-action/trackPageView/index.js.map +0 -1
  40. package/dist/destinations/personas-messaging-sendgrid/generated-types.d.ts +0 -8
  41. package/dist/destinations/personas-messaging-sendgrid/generated-types.js +0 -3
  42. package/dist/destinations/personas-messaging-sendgrid/generated-types.js.map +0 -1
  43. package/dist/destinations/personas-messaging-sendgrid/index.d.ts +0 -4
  44. package/dist/destinations/personas-messaging-sendgrid/index.js +0 -59
  45. package/dist/destinations/personas-messaging-sendgrid/index.js.map +0 -1
  46. package/dist/destinations/personas-messaging-sendgrid/sendEmail/generated-types.d.ts +0 -26
  47. package/dist/destinations/personas-messaging-sendgrid/sendEmail/generated-types.js +0 -3
  48. package/dist/destinations/personas-messaging-sendgrid/sendEmail/generated-types.js.map +0 -1
  49. package/dist/destinations/personas-messaging-sendgrid/sendEmail/index.d.ts +0 -5
  50. package/dist/destinations/personas-messaging-sendgrid/sendEmail/index.js +0 -310
  51. package/dist/destinations/personas-messaging-sendgrid/sendEmail/index.js.map +0 -1
  52. package/dist/destinations/personas-messaging-twilio/generated-types.d.ts +0 -11
  53. package/dist/destinations/personas-messaging-twilio/generated-types.js +0 -3
  54. package/dist/destinations/personas-messaging-twilio/generated-types.js.map +0 -1
  55. package/dist/destinations/personas-messaging-twilio/index.d.ts +0 -4
  56. package/dist/destinations/personas-messaging-twilio/index.js +0 -150
  57. package/dist/destinations/personas-messaging-twilio/index.js.map +0 -1
  58. package/dist/destinations/personas-messaging-twilio/sendSms/generated-types.d.ts +0 -16
  59. package/dist/destinations/personas-messaging-twilio/sendSms/generated-types.js +0 -3
  60. package/dist/destinations/personas-messaging-twilio/sendSms/generated-types.js.map +0 -1
  61. package/dist/destinations/personas-messaging-twilio/sendSms/index.d.ts +0 -5
  62. package/dist/destinations/personas-messaging-twilio/sendSms/index.js +0 -166
  63. package/dist/destinations/personas-messaging-twilio/sendSms/index.js.map +0 -1
@@ -1,310 +0,0 @@
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 liquidjs_1 = require("liquidjs");
8
- const cheerio_1 = __importDefault(require("cheerio"));
9
- const escape_goat_1 = require("escape-goat");
10
- const Liquid = new liquidjs_1.Liquid();
11
- const insertEmailPreviewText = (html, previewText) => {
12
- const $ = cheerio_1.default.load(html);
13
- $('body').prepend(`
14
- <div style='display: none; max-height: 0px; overflow: hidden;'>
15
- ${escape_goat_1.htmlEscape(previewText)}
16
- </div>
17
-
18
- <div style='display: none; max-height: 0px; overflow: hidden;'>
19
- ${'&nbsp;&zwnj;'.repeat(13)}&nbsp;
20
- </div>
21
- `);
22
- return $.html();
23
- };
24
- const getProfileApiEndpoint = (environment) => {
25
- return `https://profiles.segment.${environment === 'production' ? 'com' : 'build'}`;
26
- };
27
- const fetchProfileTraits = async (request, settings, profileId) => {
28
- const endpoint = getProfileApiEndpoint(settings.profileApiEnvironment);
29
- const response = await request(`${endpoint}/v1/spaces/${settings.spaceId}/collections/users/profiles/user_id:${profileId}/traits?limit=200`, {
30
- headers: {
31
- authorization: `Basic ${Buffer.from(settings.profileApiAccessToken + ':').toString('base64')}`,
32
- 'content-type': 'application/json'
33
- }
34
- });
35
- const body = await response.json();
36
- return body.traits;
37
- };
38
- const isRestrictedDomain = (email) => {
39
- const restricted = ['gmailx.com', 'yahoox.com', 'aolx.com', 'hotmailx.com'];
40
- const matches = /^.+@(.+)$/.exec(email.toLowerCase());
41
- if (!matches) {
42
- return false;
43
- }
44
- const domain = matches[1];
45
- return restricted.includes(domain);
46
- };
47
- const generateEmailHtml = async (request, apiKey, design) => {
48
- const response = await request('https://api.unlayer.com/v2/export/html', {
49
- method: 'POST',
50
- headers: {
51
- authorization: `Basic ${Buffer.from(`${apiKey}:`).toString('base64')}`,
52
- 'content-type': 'application/json'
53
- },
54
- body: JSON.stringify({
55
- displayMode: 'email',
56
- design: JSON.parse(design)
57
- })
58
- });
59
- const body = await response.json();
60
- return body.data.html;
61
- };
62
- const EXTERNAL_ID_KEY = 'email';
63
- const action = {
64
- title: 'Send Email',
65
- description: 'Sends Email to a user powered by SendGrid',
66
- defaultSubscription: 'type = "track" and event = "Audience Entered"',
67
- fields: {
68
- send: {
69
- label: 'Send Message',
70
- description: 'Whether or not the message should actually get sent.',
71
- type: 'boolean',
72
- required: false,
73
- default: false
74
- },
75
- userId: {
76
- label: 'User ID',
77
- description: 'User ID in Segment',
78
- type: 'string',
79
- required: true,
80
- default: { '@path': '$.userId' }
81
- },
82
- toEmail: {
83
- label: 'Test Email',
84
- description: 'Email to send to when testing',
85
- type: 'string'
86
- },
87
- fromDomain: {
88
- label: 'From Domain',
89
- description: 'Verified domain in Sendgrid',
90
- type: 'string',
91
- allowNull: true
92
- },
93
- fromEmail: {
94
- label: 'From Email',
95
- description: 'From Email',
96
- type: 'string',
97
- required: true
98
- },
99
- fromName: {
100
- label: 'From Name',
101
- description: 'From Name displayed to end user email',
102
- type: 'string',
103
- required: true
104
- },
105
- replyToEqualsFrom: {
106
- label: 'Reply To Equals From',
107
- description: 'Whether "reply to" settings are the same as "from"',
108
- type: 'boolean'
109
- },
110
- replyToEmail: {
111
- label: 'Reply To Email',
112
- description: 'The Email used by user to Reply To',
113
- type: 'string',
114
- required: true
115
- },
116
- replyToName: {
117
- label: 'Reply To Name',
118
- description: 'The Name used by user to Reply To',
119
- type: 'string',
120
- required: true
121
- },
122
- bcc: {
123
- label: 'BCC',
124
- description: 'BCC list of emails',
125
- type: 'string',
126
- required: true
127
- },
128
- previewText: {
129
- label: 'Preview Text',
130
- description: 'Preview Text',
131
- type: 'string'
132
- },
133
- subject: {
134
- label: 'Subject',
135
- description: 'Subject for the email to be sent',
136
- type: 'string',
137
- required: true
138
- },
139
- body: {
140
- label: 'Body',
141
- description: 'The message body',
142
- type: 'text'
143
- },
144
- bodyUrl: {
145
- label: 'Body URL',
146
- description: 'URL to the message body',
147
- type: 'text'
148
- },
149
- bodyType: {
150
- label: 'Body Type',
151
- description: 'The type of body which is used generally html | design',
152
- type: 'string',
153
- required: true
154
- },
155
- bodyHtml: {
156
- label: 'Body Html',
157
- description: 'The HTML content of the body',
158
- type: 'string'
159
- },
160
- externalIds: {
161
- label: 'External IDs',
162
- description: 'An array of user profile identity information.',
163
- type: 'object',
164
- multiple: true,
165
- properties: {
166
- id: {
167
- label: 'ID',
168
- description: 'A unique identifier for the collection.',
169
- type: 'string'
170
- },
171
- type: {
172
- label: 'type',
173
- description: 'The external ID contact type.',
174
- type: 'string'
175
- },
176
- subscriptionStatus: {
177
- label: 'ID',
178
- description: 'The subscription status for the identity.',
179
- type: 'string'
180
- }
181
- },
182
- default: {
183
- '@arrayPath': [
184
- '$.external_ids',
185
- {
186
- id: {
187
- '@path': '$.id'
188
- },
189
- type: {
190
- '@path': '$.type'
191
- },
192
- subscriptionStatus: {
193
- '@path': '$.isSubscribed'
194
- }
195
- }
196
- ]
197
- }
198
- },
199
- customArgs: {
200
- label: 'Custom Args',
201
- description: 'Additional custom args that we be passed back opaquely on webhook events',
202
- type: 'object',
203
- required: false
204
- }
205
- },
206
- perform: async (request, { settings, payload }) => {
207
- if (!payload.send) {
208
- return;
209
- }
210
- const emailProfile = payload?.externalIds?.find((meta) => meta.type === 'email');
211
- if (!emailProfile?.subscriptionStatus ||
212
- ['unsubscribed', 'did not subscribed', 'false'].includes(emailProfile.subscriptionStatus)) {
213
- return;
214
- }
215
- else if (['subscribed', 'true'].includes(emailProfile?.subscriptionStatus)) {
216
- const traits = await fetchProfileTraits(request, settings, payload.userId);
217
- const profile = {
218
- email: emailProfile.id,
219
- traits
220
- };
221
- const toEmail = payload.toEmail || profile.email;
222
- if (!toEmail) {
223
- return;
224
- }
225
- if (isRestrictedDomain(toEmail)) {
226
- throw new actions_core_1.IntegrationError('Emails with gmailx.com, yahoox.com, aolx.com, and hotmailx.com domains are blocked.', 'Invalid input', 400);
227
- }
228
- let name;
229
- if (traits.first_name && traits.last_name) {
230
- name = `${traits.first_name} ${traits.last_name}`;
231
- }
232
- else if (traits.firstName && traits.lastName) {
233
- name = `${traits.firstName} ${traits.lastName}`;
234
- }
235
- else if (traits.name) {
236
- name = traits.name;
237
- }
238
- else {
239
- name = traits.first_name || traits.last_name || traits.firstName || traits.lastName || 'User';
240
- }
241
- const bcc = JSON.parse(payload.bcc ?? '[]');
242
- let bodyHtml = payload.bodyHtml ?? '';
243
- if (payload.bodyUrl && settings.unlayerApiKey) {
244
- const response = await request(payload.bodyUrl);
245
- const body = await response.text();
246
- bodyHtml = payload.bodyType === 'html' ? body : await generateEmailHtml(request, settings.unlayerApiKey, body);
247
- if (payload.previewText) {
248
- bodyHtml = insertEmailPreviewText(bodyHtml, payload.previewText);
249
- }
250
- }
251
- const [parsedSubject, parsedBody] = await Promise.all([
252
- Liquid.parseAndRender(payload.subject, { profile }),
253
- Liquid.parseAndRender(bodyHtml, { profile })
254
- ]);
255
- return request('https://api.sendgrid.com/v3/mail/send', {
256
- method: 'post',
257
- headers: {
258
- authorization: `Bearer ${settings.sendGridApiKey}`
259
- },
260
- json: {
261
- personalizations: [
262
- {
263
- to: [
264
- {
265
- email: toEmail,
266
- name: name
267
- }
268
- ],
269
- bcc: bcc.length > 0 ? bcc : undefined,
270
- custom_args: {
271
- ...payload.customArgs,
272
- source_id: settings.sourceId,
273
- space_id: settings.spaceId,
274
- user_id: payload.userId,
275
- __segment_internal_external_id_key__: EXTERNAL_ID_KEY,
276
- __segment_internal_external_id_value__: profile[EXTERNAL_ID_KEY]
277
- }
278
- }
279
- ],
280
- from: {
281
- email: payload.fromEmail,
282
- name: payload.fromName
283
- },
284
- reply_to: {
285
- email: payload.replyToEmail,
286
- name: payload.replyToName
287
- },
288
- subject: parsedSubject,
289
- content: [
290
- {
291
- type: 'text/html',
292
- value: parsedBody
293
- }
294
- ],
295
- tracking_settings: {
296
- subscription_tracking: {
297
- enable: true,
298
- substitution_tag: '[unsubscribe]'
299
- }
300
- }
301
- }
302
- });
303
- }
304
- else {
305
- throw new actions_core_1.IntegrationError(`Failed to process the subscription state: "${emailProfile.subscriptionStatus}"`, 'Invalid subscriptionStatus value', 400);
306
- }
307
- }
308
- };
309
- exports.default = action;
310
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/personas-messaging-sendgrid/sendEmail/index.ts"],"names":[],"mappings":";;;;;AAAA,wDAA0F;AAG1F,uCAA6C;AAC7C,sDAA6B;AAC7B,6CAAwC;AAExC,MAAM,MAAM,GAAG,IAAI,iBAAQ,EAAE,CAAA;AAE7B,MAAM,sBAAsB,GAAG,CAAC,IAAY,EAAE,WAAmB,EAAU,EAAE;I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,EAAE;iBACnD;gBACD,IAAI,EAAE;oBACJ,gBAAgB,EAAE;wBAChB;4BACE,EAAE,EAAE;gCACF;oCACE,KAAK,EAAE,OAAO;oCACd,IAAI,EAAE,IAAI;iCACX;6BACF;4BACD,GAAG,EAAE,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS;4BACrC,WAAW,EAAE;gCACX,GAAG,OAAO,CAAC,UAAU;gCACrB,SAAS,EAAE,QAAQ,CAAC,QAAQ;gCAC5B,QAAQ,EAAE,QAAQ,CAAC,OAAO;gCAC1B,OAAO,EAAE,OAAO,CAAC,MAAM;gCAEvB,oCAAoC,EAAE,eAAe;gCACrD,sCAAsC,EAAE,OAAO,CAAC,eAAe,CAAC;6BACjE;yBACF;qBACF;oBACD,IAAI,EAAE;wBACJ,KAAK,EAAE,OAAO,CAAC,SAAS;wBACxB,IAAI,EAAE,OAAO,CAAC,QAAQ;qBACvB;oBACD,QAAQ,EAAE;wBACR,KAAK,EAAE,OAAO,CAAC,YAAY;wBAC3B,IAAI,EAAE,OAAO,CAAC,WAAW;qBAC1B;oBACD,OAAO,EAAE,aAAa;oBACtB,OAAO,EAAE;wBACP;4BACE,IAAI,EAAE,WAAW;4BACjB,KAAK,EAAE,UAAU;yBAClB;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"}
@@ -1,11 +0,0 @@
1
- export interface Settings {
2
- twilioAccountSID: string;
3
- twilioApiKeySID: string;
4
- twilioApiKeySecret: string;
5
- profileApiEnvironment: string;
6
- profileApiAccessToken: string;
7
- spaceId: string;
8
- sourceId: string;
9
- webhookUrl?: string;
10
- connectionOverrides?: string;
11
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=generated-types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../src/destinations/personas-messaging-twilio/generated-types.ts"],"names":[],"mappings":""}
@@ -1,4 +0,0 @@
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;
@@ -1,150 +0,0 @@
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 sendSms_1 = __importDefault(require("./sendSms"));
7
- const getRange = (val) => {
8
- return Array(val)
9
- .fill(1)
10
- .map((x, y) => ({ value: x + y, label: `${x + y}` }));
11
- };
12
- const ConnectionOverridesProperties = {
13
- ct: {
14
- label: 'Connection timeout',
15
- description: 'The timeout in milliseconds Twilio will wait to establish its TCP connection to your webserver',
16
- type: 'number',
17
- default: 5000,
18
- choices: getRange(10000)
19
- },
20
- rt: {
21
- label: 'Read timeout',
22
- description: 'The amount of time in milliseconds after sending your webhook an HTTP request that Twilio will wait for the initial HTTP response packet',
23
- type: 'number',
24
- default: 15000,
25
- choices: getRange(15000)
26
- },
27
- tt: {
28
- label: 'Total timeout',
29
- description: 'The total time allowed for all timeouts including retries',
30
- type: 'number',
31
- default: 15000,
32
- choices: getRange(15000)
33
- },
34
- rc: {
35
- label: 'Retry count',
36
- description: 'The number of retry attempts Twilio will make if its connection to your webhook fails',
37
- type: 'number',
38
- default: 1,
39
- choices: getRange(5)
40
- },
41
- rp: {
42
- label: 'Retry policy',
43
- description: 'The type of failure to retry on',
44
- type: 'string',
45
- default: 'ct',
46
- choices: ['ct', '4xx', '5xx', 'rt', 'all']
47
- },
48
- sni: {
49
- label: 'SNI',
50
- description: 'The type of failure to retry on',
51
- type: 'string',
52
- default: 'unset',
53
- choices: ['y', 'n', 'unser']
54
- },
55
- e: {
56
- label: 'Edge location',
57
- description: 'The Twilio edge location where webhooks egress. This can be a list and we rotate through the list as retries happen.',
58
- type: 'string',
59
- default: 'ashburn',
60
- choices: [
61
- 'ashburn',
62
- 'ashburn-ix',
63
- 'dublin',
64
- 'frankfurt',
65
- 'frankfurt-ix',
66
- 'sao-paulo',
67
- 'singapore',
68
- 'sydney',
69
- 'tokyo',
70
- 'umatilla',
71
- 'london-ix',
72
- 'san-jose-ix',
73
- 'singapore-ix'
74
- ]
75
- }
76
- };
77
- const destination = {
78
- name: 'Personas Messaging Twilio (Actions)',
79
- mode: 'cloud',
80
- authentication: {
81
- scheme: 'custom',
82
- fields: {
83
- twilioAccountSID: {
84
- label: 'Twilio Account SID',
85
- description: 'Twilio Account SID',
86
- type: 'string',
87
- required: true
88
- },
89
- twilioApiKeySID: {
90
- label: 'Twilio API Key SID',
91
- description: 'Twilio API Key SID',
92
- type: 'string',
93
- required: true
94
- },
95
- twilioApiKeySecret: {
96
- label: 'Twilio API Key Secret',
97
- description: 'Twilio API Key Secret',
98
- type: 'password',
99
- required: true
100
- },
101
- profileApiEnvironment: {
102
- label: 'Profile API Environment',
103
- description: 'Profile API Environment',
104
- type: 'string',
105
- required: true
106
- },
107
- profileApiAccessToken: {
108
- label: 'Profile API Access Token',
109
- description: 'Profile API Access Token',
110
- type: 'password',
111
- required: true
112
- },
113
- spaceId: {
114
- label: 'Space ID',
115
- description: 'Space ID',
116
- type: 'string',
117
- required: true
118
- },
119
- sourceId: {
120
- label: 'Source ID',
121
- description: 'Source ID',
122
- type: 'string',
123
- required: true
124
- },
125
- webhookUrl: {
126
- label: 'Webhook URL',
127
- description: 'Webhook URL that will receive all events for the sent message',
128
- type: 'string',
129
- format: 'uri',
130
- required: false
131
- },
132
- connectionOverrides: {
133
- label: 'Connection Overrides',
134
- description: 'Connection overrides are configuration supported by twilio webhook services. Must be passed as fragments on the callback url',
135
- type: 'string',
136
- required: false,
137
- default: 'rp=all&rc=5',
138
- properties: ConnectionOverridesProperties
139
- }
140
- },
141
- testAuthentication: (request) => {
142
- return request('https://api.twilio.com/2010-04-01');
143
- }
144
- },
145
- actions: {
146
- sendSms: sendSms_1.default
147
- }
148
- };
149
- exports.default = destination;
150
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/personas-messaging-twilio/index.ts"],"names":[],"mappings":";;;;;AAEA,wDAA+B;AAE/B,MAAM,QAAQ,GAAG,CAAC,GAAW,EAAsC,EAAE;IACnE,OAAO,KAAK,CAAC,GAAG,CAAC;SACd,IAAI,CAAC,CAAC,CAAC;SACP,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,GAAG,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,CAAA;AACzD,CAAC,CAAA;AAED,MAAM,6BAA6B,GAA+B;IAChE,EAAE,EAAE;QACF,KAAK,EAAE,oBAAoB;QAC3B,WAAW,EAAE,gGAAgG;QAC7G,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,IAAI;QACb,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC;KACzB;IACD,EAAE,EAAE;QACF,KAAK,EAAE,cAAc;QACrB,WAAW,EACT,0IAA0I;QAC5I,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,KAAK;QACd,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC;KACzB;IACD,EAAE,EAAE;QACF,KAAK,EAAE,eAAe;QACtB,WAAW,EAAE,2DAA2D;QACxE,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,KAAK;QACd,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC;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
3
- toNumber?: string;
4
- from: string;
5
- body: string;
6
- customArgs?: {
7
- [k: string]: unknown;
8
- };
9
- connectionOverrides?: string;
10
- send?: boolean;
11
- externalIds?: {
12
- id?: string;
13
- type?: string;
14
- subscriptionStatus?: string;
15
- }[];
16
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=generated-types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/personas-messaging-twilio/sendSms/generated-types.ts"],"names":[],"mappings":""}
@@ -1,5 +0,0 @@
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;