@segment/action-destinations 3.345.2 → 3.346.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 (99) hide show
  1. package/dist/destinations/attentive/customEvents/generated-types.d.ts +14 -0
  2. package/dist/destinations/attentive/customEvents/generated-types.js +3 -0
  3. package/dist/destinations/attentive/customEvents/generated-types.js.map +1 -0
  4. package/dist/destinations/attentive/customEvents/index.d.ts +5 -0
  5. package/dist/destinations/attentive/customEvents/index.js +124 -0
  6. package/dist/destinations/attentive/customEvents/index.js.map +1 -0
  7. package/dist/destinations/attentive/customEvents/types.d.ts +15 -0
  8. package/dist/destinations/attentive/customEvents/types.js +3 -0
  9. package/dist/destinations/attentive/customEvents/types.js.map +1 -0
  10. package/dist/destinations/attentive/generated-types.d.ts +3 -0
  11. package/dist/destinations/attentive/generated-types.js +3 -0
  12. package/dist/destinations/attentive/generated-types.js.map +1 -0
  13. package/dist/destinations/attentive/index.d.ts +4 -0
  14. package/dist/destinations/attentive/index.js +54 -0
  15. package/dist/destinations/attentive/index.js.map +1 -0
  16. package/dist/destinations/drip/identify/index.js +1 -1
  17. package/dist/destinations/drip/identify/index.js.map +1 -1
  18. package/dist/destinations/drip/index.js +1 -1
  19. package/dist/destinations/drip/index.js.map +1 -1
  20. package/dist/destinations/google-enhanced-conversions/functions.js +6 -2
  21. package/dist/destinations/google-enhanced-conversions/functions.js.map +1 -1
  22. package/dist/destinations/google-enhanced-conversions/userList/index.js +2 -1
  23. package/dist/destinations/google-enhanced-conversions/userList/index.js.map +1 -1
  24. package/dist/destinations/hubspot/customEvent/functions/dynamic-field-functions.js +1 -1
  25. package/dist/destinations/hubspot/customEvent/functions/dynamic-field-functions.js.map +1 -1
  26. package/dist/destinations/index.js +2 -0
  27. package/dist/destinations/index.js.map +1 -1
  28. package/dist/destinations/klaviyo/addProfileToList/index.js +10 -1
  29. package/dist/destinations/klaviyo/addProfileToList/index.js.map +1 -1
  30. package/dist/destinations/klaviyo/removeProfile/index.js +10 -1
  31. package/dist/destinations/klaviyo/removeProfile/index.js.map +1 -1
  32. package/dist/destinations/klaviyo/subscribeProfile/index.js +10 -1
  33. package/dist/destinations/klaviyo/subscribeProfile/index.js.map +1 -1
  34. package/dist/destinations/rokt-audiences/constants.js +1 -1
  35. package/dist/destinations/rokt-audiences/constants.js.map +1 -1
  36. package/dist/destinations/rokt-audiences/generated-types.d.ts +3 -1
  37. package/dist/destinations/rokt-audiences/index.js +26 -10
  38. package/dist/destinations/rokt-audiences/index.js.map +1 -1
  39. package/dist/destinations/rokt-audiences/upsertCustomAudiences/custom-audience-operations.d.ts +2 -1
  40. package/dist/destinations/rokt-audiences/upsertCustomAudiences/custom-audience-operations.js +4 -3
  41. package/dist/destinations/rokt-audiences/upsertCustomAudiences/custom-audience-operations.js.map +1 -1
  42. package/dist/destinations/rokt-audiences/upsertCustomAudiences/index.js +4 -4
  43. package/dist/destinations/rokt-audiences/upsertCustomAudiences/index.js.map +1 -1
  44. package/dist/destinations/s3/functions.js +1 -1
  45. package/dist/destinations/s3/functions.js.map +1 -1
  46. package/dist/destinations/schematic/trackEvent/index.js.map +1 -1
  47. package/dist/destinations/sendgrid-audiences/constants.d.ts +1 -0
  48. package/dist/destinations/sendgrid-audiences/constants.js +2 -1
  49. package/dist/destinations/sendgrid-audiences/constants.js.map +1 -1
  50. package/dist/destinations/sendgrid-audiences/syncAudience/dynamic-fields.d.ts +4 -0
  51. package/dist/destinations/sendgrid-audiences/syncAudience/dynamic-fields.js +33 -0
  52. package/dist/destinations/sendgrid-audiences/syncAudience/dynamic-fields.js.map +1 -0
  53. package/dist/destinations/sendgrid-audiences/syncAudience/fields.js +117 -0
  54. package/dist/destinations/sendgrid-audiences/syncAudience/fields.js.map +1 -1
  55. package/dist/destinations/sendgrid-audiences/syncAudience/generated-types.d.ts +13 -0
  56. package/dist/destinations/sendgrid-audiences/syncAudience/index.js +8 -0
  57. package/dist/destinations/sendgrid-audiences/syncAudience/index.js.map +1 -1
  58. package/dist/destinations/sendgrid-audiences/syncAudience/utils.js +16 -1
  59. package/dist/destinations/sendgrid-audiences/syncAudience/utils.js.map +1 -1
  60. package/dist/destinations/sendgrid-audiences/types.d.ts +11 -0
  61. package/dist/destinations/snap-audiences/index.js +17 -77
  62. package/dist/destinations/snap-audiences/index.js.map +1 -1
  63. package/dist/destinations/stackadapt-audiences/forwardAudienceEvent/functions.js +6 -3
  64. package/dist/destinations/stackadapt-audiences/forwardAudienceEvent/functions.js.map +1 -1
  65. package/dist/destinations/stackadapt-audiences/forwardProfile/functions.js +11 -0
  66. package/dist/destinations/stackadapt-audiences/forwardProfile/functions.js.map +1 -1
  67. package/dist/destinations/stackadapt-audiences/index.js +29 -0
  68. package/dist/destinations/stackadapt-audiences/index.js.map +1 -1
  69. package/dist/destinations/taboola-actions/generated-types.d.ts +1 -0
  70. package/dist/destinations/taboola-actions/index.js +12 -1
  71. package/dist/destinations/taboola-actions/index.js.map +1 -1
  72. package/dist/destinations/twilio-messaging/generated-types.d.ts +6 -0
  73. package/dist/destinations/twilio-messaging/generated-types.js +3 -0
  74. package/dist/destinations/twilio-messaging/generated-types.js.map +1 -0
  75. package/dist/destinations/twilio-messaging/index.d.ts +4 -0
  76. package/dist/destinations/twilio-messaging/index.js +61 -0
  77. package/dist/destinations/twilio-messaging/index.js.map +1 -0
  78. package/dist/destinations/twilio-messaging/sendMessage/constants.d.ts +41 -0
  79. package/dist/destinations/twilio-messaging/sendMessage/constants.js +95 -0
  80. package/dist/destinations/twilio-messaging/sendMessage/constants.js.map +1 -0
  81. package/dist/destinations/twilio-messaging/sendMessage/dynamic-fields.d.ts +10 -0
  82. package/dist/destinations/twilio-messaging/sendMessage/dynamic-fields.js +169 -0
  83. package/dist/destinations/twilio-messaging/sendMessage/dynamic-fields.js.map +1 -0
  84. package/dist/destinations/twilio-messaging/sendMessage/fields.d.ts +2 -0
  85. package/dist/destinations/twilio-messaging/sendMessage/fields.js +250 -0
  86. package/dist/destinations/twilio-messaging/sendMessage/fields.js.map +1 -0
  87. package/dist/destinations/twilio-messaging/sendMessage/generated-types.d.ts +23 -0
  88. package/dist/destinations/twilio-messaging/sendMessage/generated-types.js +3 -0
  89. package/dist/destinations/twilio-messaging/sendMessage/generated-types.js.map +1 -0
  90. package/dist/destinations/twilio-messaging/sendMessage/index.d.ts +5 -0
  91. package/dist/destinations/twilio-messaging/sendMessage/index.js +39 -0
  92. package/dist/destinations/twilio-messaging/sendMessage/index.js.map +1 -0
  93. package/dist/destinations/twilio-messaging/sendMessage/types.d.ts +34 -0
  94. package/dist/destinations/twilio-messaging/sendMessage/types.js +3 -0
  95. package/dist/destinations/twilio-messaging/sendMessage/types.js.map +1 -0
  96. package/dist/destinations/twilio-messaging/sendMessage/utils.d.ts +6 -0
  97. package/dist/destinations/twilio-messaging/sendMessage/utils.js +147 -0
  98. package/dist/destinations/twilio-messaging/sendMessage/utils.js.map +1 -0
  99. package/package.json +4 -4
@@ -0,0 +1,169 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.dynamicContentVariables = exports.dynamicMediaUrls = exports.dynamicContentSid = exports.dynamicContentTemplateType = exports.dynamicMessagingServiceSid = exports.dynamicFromPhoneNumber = void 0;
4
+ const constants_1 = require("./constants");
5
+ const utils_1 = require("./utils");
6
+ function isErrorResponse(response) {
7
+ return response.error !== undefined;
8
+ }
9
+ function createErrorResponse(message, code) {
10
+ return {
11
+ choices: [],
12
+ error: { message: message ?? 'Unknown error', code: code ?? '404' }
13
+ };
14
+ }
15
+ async function getData(request, url) {
16
+ try {
17
+ const response = await request(url, {
18
+ method: 'GET',
19
+ skipResponseCloning: true
20
+ });
21
+ return response;
22
+ }
23
+ catch (err) {
24
+ const error = err;
25
+ return createErrorResponse(error.response.data.message, String(error.response.data.status));
26
+ }
27
+ }
28
+ async function dynamicFromPhoneNumber(request, settings) {
29
+ const response = await getData(request, constants_1.GET_INCOMING_PHONE_NUMBERS_URL.replace(constants_1.ACCOUNT_SID_TOKEN, settings.accountSID));
30
+ if (isErrorResponse(response)) {
31
+ return response;
32
+ }
33
+ const numbers = response.data.incoming_phone_numbers ?? [];
34
+ if (numbers.length === 0) {
35
+ return createErrorResponse('No numbers found. Please create a phone number in your Twilio account.');
36
+ }
37
+ return {
38
+ choices: numbers
39
+ .filter((n) => {
40
+ return n.capabilities.sms || n.capabilities.mms;
41
+ })
42
+ .map((n) => {
43
+ return {
44
+ label: `${n.phone_number}`,
45
+ value: `${n.phone_number}`
46
+ };
47
+ })
48
+ };
49
+ }
50
+ exports.dynamicFromPhoneNumber = dynamicFromPhoneNumber;
51
+ async function dynamicMessagingServiceSid(request, settings) {
52
+ const response = await getData(request, constants_1.GET_MESSAGING_SERVICE_SIDS_URL.replace(constants_1.ACCOUNT_SID_TOKEN, settings.accountSID));
53
+ if (isErrorResponse(response)) {
54
+ return response;
55
+ }
56
+ const sids = response.data.services ?? [];
57
+ if (sids.length === 0) {
58
+ return createErrorResponse('No Messaging Services found. Please create a Messaging Service in your Twilio account.');
59
+ }
60
+ return {
61
+ choices: sids.map((s) => {
62
+ return {
63
+ label: `${s.friendly_name} [${s.sid}]`,
64
+ value: `${s.friendly_name} [${s.sid}]`
65
+ };
66
+ })
67
+ };
68
+ }
69
+ exports.dynamicMessagingServiceSid = dynamicMessagingServiceSid;
70
+ async function dynamicContentTemplateType(payload) {
71
+ const { channel } = payload;
72
+ if (!channel) {
73
+ return createErrorResponse("Select from 'Channel' field first.");
74
+ }
75
+ return await Promise.resolve({
76
+ choices: Object.values(constants_1.PREDEFINED_CONTENT_TYPES)
77
+ .filter((t) => t.supported_channels.includes(channel))
78
+ .map((t) => ({
79
+ label: t.friendly_name,
80
+ value: t.friendly_name
81
+ }))
82
+ });
83
+ }
84
+ exports.dynamicContentTemplateType = dynamicContentTemplateType;
85
+ async function dynamicContentSid(request, payload) {
86
+ const { contentTemplateType } = payload;
87
+ if (contentTemplateType === constants_1.INLINE_CONTENT_TYPES.INLINE.friendly_name) {
88
+ return createErrorResponse("Inline messages do not use 'pre-defined' Content Templates.");
89
+ }
90
+ const response = await getData(request, constants_1.GET_ALL_CONTENTS_URL);
91
+ if (isErrorResponse(response)) {
92
+ return response;
93
+ }
94
+ const contents = response.data.contents ?? [];
95
+ if (contents.length === 0) {
96
+ return createErrorResponse('No Content Templates found. Please create a Content Template in Twilio first.');
97
+ }
98
+ const name = Object.values(constants_1.PREDEFINED_CONTENT_TYPES).find((type) => type.friendly_name === contentTemplateType)
99
+ ?.name;
100
+ return {
101
+ choices: contents
102
+ .filter((c) => c.types[name])
103
+ .map((c) => ({
104
+ label: `${c.friendly_name} [${c.sid}]`,
105
+ value: `${c.friendly_name} [${c.sid}]`
106
+ }))
107
+ };
108
+ }
109
+ exports.dynamicContentSid = dynamicContentSid;
110
+ async function dynamicMediaUrls(request, payload) {
111
+ const { contentTemplateType, mediaUrls } = payload;
112
+ const contentSid = utils_1.parseFieldValue(payload.contentSid);
113
+ if (contentTemplateType === constants_1.INLINE_CONTENT_TYPES.INLINE.friendly_name) {
114
+ return createErrorResponse("Use the 'Inline Media URLs' field for specifying Media URLs for an inline message.");
115
+ }
116
+ if ([undefined, '', null].includes(contentSid)) {
117
+ return createErrorResponse("Select 'Content Template SID' first.");
118
+ }
119
+ if (utils_1.validateContentSid(contentSid) === false) {
120
+ return createErrorResponse('Invalid Content Template SID. SID should match with the pattern HX[0-9a-fA-F]{32}');
121
+ }
122
+ const response = await getData(request, constants_1.GET_CONTENT_URL.replace(constants_1.CONTENT_SID_TOKEN, contentSid));
123
+ if (isErrorResponse(response)) {
124
+ return response;
125
+ }
126
+ const name = Object.values(constants_1.PREDEFINED_CONTENT_TYPES).find((type) => type.friendly_name === contentTemplateType)
127
+ ?.name;
128
+ const urls = response.data?.types?.[name]?.media ?? [];
129
+ if (urls.length === 0) {
130
+ return createErrorResponse('No Media URLs found for this Content Template. If media files are required please create them in Twilio first.');
131
+ }
132
+ const selectedUrls = mediaUrls?.map((m) => m.url) ?? [];
133
+ const filteredUrls = urls.filter((url) => !selectedUrls.includes(url));
134
+ if (filteredUrls.length === 0) {
135
+ return createErrorResponse('No additional Media URLs found for this Content Template.');
136
+ }
137
+ return {
138
+ choices: filteredUrls.map((url) => ({
139
+ label: url,
140
+ value: url
141
+ }))
142
+ };
143
+ }
144
+ exports.dynamicMediaUrls = dynamicMediaUrls;
145
+ async function dynamicContentVariables(request, payload) {
146
+ const contentSid = utils_1.parseFieldValue(payload.contentSid);
147
+ if (!contentSid) {
148
+ return createErrorResponse("Select from 'Content Template' field first");
149
+ }
150
+ const response = await getData(request, constants_1.GET_CONTENT_VARIABLES_URL.replace(constants_1.CONTENT_SID_TOKEN, contentSid));
151
+ if (isErrorResponse(response)) {
152
+ return response;
153
+ }
154
+ const types = response?.data?.types ?? {};
155
+ const variables = [...JSON.stringify(types).matchAll(constants_1.TOKEN_REGEX)].map((match) => match[1]);
156
+ if (variables.length === 0) {
157
+ return createErrorResponse('No Variables found for the selected Content Template. If variable are required please createthem in Twilio first.');
158
+ }
159
+ const selectedVariables = Object.keys(payload.contentVariables ?? {}).filter((key) => key.trim() !== '');
160
+ const filteredVariables = variables.filter((v) => !selectedVariables.includes(v));
161
+ return {
162
+ choices: filteredVariables.map((key) => ({
163
+ label: key,
164
+ value: key
165
+ }))
166
+ };
167
+ }
168
+ exports.dynamicContentVariables = dynamicContentVariables;
169
+ //# sourceMappingURL=dynamic-fields.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dynamic-fields.js","sourceRoot":"","sources":["../../../../src/destinations/twilio-messaging/sendMessage/dynamic-fields.ts"],"names":[],"mappings":";;;AAEA,2CAWoB;AAGpB,mCAA6D;AAoB7D,SAAS,eAAe,CAAC,QAAiB;IACxC,OAAQ,QAA0B,CAAC,KAAK,KAAK,SAAS,CAAA;AACxD,CAAC;AAED,SAAS,mBAAmB,CAAC,OAAgB,EAAE,IAAa;IAC1D,OAAO;QACL,OAAO,EAAE,EAAE;QACX,KAAK,EAAE,EAAE,OAAO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AM,KAAK,CAAC,EAAE;QAC1B,OAAO,mBAAmB,CACxB,mHAAmH,CACpH,CAAA;KACF;IAED,MAAM,iBAAiB,GAAa,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,gBAAgB,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAA;IAClH,MAAM,iBAAiB,GAAa,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAA;IAE3F,OAAO;QACL,OAAO,EAAE,iBAAiB,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;YACvC,KAAK,EAAE,GAAG;YACV,KAAK,EAAE,GAAG;SACX,CAAC,CAAC;KACJ,CAAA;AACH,CAAC;AAxCD,0DAwCC"}
@@ -0,0 +1,2 @@
1
+ import { InputField } from '@segment/actions-core';
2
+ export declare const fields: Record<string, InputField>;
@@ -0,0 +1,250 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fields = void 0;
4
+ const constants_1 = require("./constants");
5
+ exports.fields = {
6
+ channel: {
7
+ label: 'Channel',
8
+ description: 'The channel to send the message on.',
9
+ type: 'string',
10
+ required: true,
11
+ choices: [
12
+ { label: 'SMS', value: constants_1.CHANNELS.SMS },
13
+ { label: 'MMS', value: constants_1.CHANNELS.MMS },
14
+ { label: 'WhatsApp', value: constants_1.CHANNELS.WHATSAPP },
15
+ { label: 'Facebook Messenger', value: constants_1.CHANNELS.MESSENGER }
16
+ ],
17
+ default: constants_1.CHANNELS.MMS,
18
+ disabledInputMethods: ['literal', 'variable', 'function', 'freeform', 'enrichment']
19
+ },
20
+ toPhoneNumber: {
21
+ label: 'To Phone Number',
22
+ description: 'The number to send the message to (E.164 format).',
23
+ type: 'string',
24
+ required: true,
25
+ default: undefined,
26
+ depends_on: {
27
+ match: 'all',
28
+ conditions: [
29
+ {
30
+ fieldKey: 'channel',
31
+ operator: 'is_not',
32
+ value: constants_1.CHANNELS.MESSENGER
33
+ }
34
+ ]
35
+ }
36
+ },
37
+ messengerPageUserId: {
38
+ label: 'Messenger Page or User ID',
39
+ description: 'A valid Facebook Messenger Page Id or Messenger User Id.',
40
+ type: 'string',
41
+ required: false,
42
+ default: undefined,
43
+ depends_on: {
44
+ match: 'all',
45
+ conditions: [
46
+ {
47
+ fieldKey: 'channel',
48
+ operator: 'is',
49
+ value: constants_1.CHANNELS.MESSENGER
50
+ }
51
+ ]
52
+ }
53
+ },
54
+ senderType: {
55
+ label: 'Sender Type',
56
+ description: 'Select Sender Type',
57
+ type: 'string',
58
+ required: true,
59
+ choices: [
60
+ { label: constants_1.SENDER_TYPE.PHONE_NUMBER, value: constants_1.SENDER_TYPE.PHONE_NUMBER },
61
+ { label: constants_1.SENDER_TYPE.MESSAGING_SERVICE, value: constants_1.SENDER_TYPE.MESSAGING_SERVICE }
62
+ ],
63
+ default: constants_1.SENDER_TYPE.PHONE_NUMBER
64
+ },
65
+ fromPhoneNumber: {
66
+ label: 'From Phone Number',
67
+ description: 'The Twilio phone number (E.164 format) or short code for sending SMS/MMS. If not in the dropdown, enter it directly and ensure the number supports SMS/MMS.',
68
+ type: 'string',
69
+ dynamic: true,
70
+ required: false,
71
+ default: undefined,
72
+ depends_on: {
73
+ match: 'all',
74
+ conditions: [
75
+ {
76
+ fieldKey: 'senderType',
77
+ operator: 'is',
78
+ value: constants_1.SENDER_TYPE.PHONE_NUMBER
79
+ }
80
+ ]
81
+ }
82
+ },
83
+ messagingServiceSid: {
84
+ label: 'Messaging Service SID',
85
+ description: 'The SID of the messaging service to use. If not in the dropdown, enter it directly.',
86
+ type: 'string',
87
+ dynamic: true,
88
+ required: false,
89
+ default: undefined,
90
+ allowNull: false,
91
+ disabledInputMethods: ['literal', 'variable', 'function', 'freeform', 'enrichment'],
92
+ depends_on: {
93
+ match: 'all',
94
+ conditions: [
95
+ {
96
+ fieldKey: 'senderType',
97
+ operator: 'is',
98
+ value: constants_1.SENDER_TYPE.MESSAGING_SERVICE
99
+ }
100
+ ]
101
+ }
102
+ },
103
+ contentTemplateType: {
104
+ label: 'Content Template Type',
105
+ description: 'Select the Twilio Content Template type to use.',
106
+ type: 'string',
107
+ required: true,
108
+ dynamic: true
109
+ },
110
+ contentSid: {
111
+ label: 'Content Template SID',
112
+ description: 'The SID of the Content Template to use.',
113
+ type: 'string',
114
+ dynamic: true,
115
+ required: false,
116
+ allowNull: false,
117
+ disabledInputMethods: ['literal', 'variable', 'function', 'freeform', 'enrichment'],
118
+ depends_on: {
119
+ match: 'all',
120
+ conditions: [
121
+ {
122
+ fieldKey: 'contentTemplateType',
123
+ operator: 'is_not',
124
+ value: constants_1.ALL_CONTENT_TYPES.INLINE.friendly_name
125
+ }
126
+ ]
127
+ }
128
+ },
129
+ mediaUrls: {
130
+ label: 'Media URLs',
131
+ description: 'The URLs of the media to include with the message. The URLs should be configured in the Content Template in Twilio.',
132
+ type: 'object',
133
+ multiple: true,
134
+ required: false,
135
+ properties: {
136
+ url: {
137
+ label: 'URL',
138
+ type: 'string',
139
+ description: 'The URL of the media to include with the message.',
140
+ required: true,
141
+ dynamic: true,
142
+ allowNull: false,
143
+ disabledInputMethods: ['literal', 'variable', 'function', 'freeform', 'enrichment']
144
+ }
145
+ },
146
+ depends_on: {
147
+ match: 'all',
148
+ conditions: [
149
+ {
150
+ fieldKey: 'contentTemplateType',
151
+ operator: 'is',
152
+ value: Object.values(constants_1.ALL_CONTENT_TYPES)
153
+ .filter((t) => t.supports_media)
154
+ .map((t) => ({ label: t.friendly_name, value: t.friendly_name }))
155
+ }
156
+ ]
157
+ }
158
+ },
159
+ contentVariables: {
160
+ label: 'Content Variables',
161
+ description: 'Variables to be used in the Content Template. The Variables must be defined in the Content Template in Twilio.',
162
+ type: 'object',
163
+ dynamic: true,
164
+ required: false,
165
+ defaultObjectUI: 'keyvalue',
166
+ additionalProperties: true,
167
+ depends_on: {
168
+ match: 'all',
169
+ conditions: [
170
+ {
171
+ fieldKey: 'contentTemplateType',
172
+ operator: 'is_not',
173
+ value: constants_1.ALL_CONTENT_TYPES.INLINE.friendly_name
174
+ }
175
+ ]
176
+ }
177
+ },
178
+ inlineBody: {
179
+ label: 'Inline Template',
180
+ description: 'Define an inline message body to be sent. Variables values can be referenced using {{variable}} format. e.g. Hello {{first_name}}!.',
181
+ type: 'text',
182
+ format: 'text',
183
+ required: false,
184
+ default: undefined,
185
+ depends_on: {
186
+ match: 'all',
187
+ conditions: [
188
+ {
189
+ fieldKey: 'contentTemplateType',
190
+ operator: 'is',
191
+ value: constants_1.ALL_CONTENT_TYPES.INLINE.friendly_name
192
+ }
193
+ ]
194
+ }
195
+ },
196
+ inlineMediaUrls: {
197
+ label: 'Inline Media URLs',
198
+ description: 'The URLs of the media to sent with the inline message. The URLs must be publicaly accessible.',
199
+ type: 'string',
200
+ multiple: true,
201
+ required: false,
202
+ depends_on: {
203
+ match: 'all',
204
+ conditions: [
205
+ {
206
+ fieldKey: 'contentTemplateType',
207
+ operator: 'is',
208
+ value: constants_1.ALL_CONTENT_TYPES.INLINE.friendly_name
209
+ }
210
+ ]
211
+ }
212
+ },
213
+ inlineVariables: {
214
+ label: 'Inline Variables',
215
+ description: "Variables to be send with the inline message. e.g. 'first_name' would match with {{first_name}} in the Inline Template message body.",
216
+ type: 'object',
217
+ required: false,
218
+ defaultObjectUI: 'keyvalue',
219
+ additionalProperties: true,
220
+ default: undefined,
221
+ depends_on: {
222
+ match: 'all',
223
+ conditions: [
224
+ {
225
+ fieldKey: 'contentTemplateType',
226
+ operator: 'is',
227
+ value: constants_1.ALL_CONTENT_TYPES.INLINE.friendly_name
228
+ }
229
+ ]
230
+ }
231
+ },
232
+ validityPeriod: {
233
+ label: 'Validity Period',
234
+ description: 'The number of seconds between 1-14400 that the message is valid for. Default is 14400. If the message is not delivered within this time, it will not be delivered.',
235
+ type: 'number',
236
+ required: false,
237
+ minimum: 1,
238
+ maximum: 14400,
239
+ default: 14400
240
+ },
241
+ sendAt: {
242
+ label: 'Send At',
243
+ description: 'The time that Twilio will send the message. Must be in ISO 8601 format.',
244
+ type: 'string',
245
+ format: 'date-time',
246
+ required: false,
247
+ default: undefined
248
+ }
249
+ };
250
+ //# sourceMappingURL=fields.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fields.js","sourceRoot":"","sources":["../../../../src/destinations/twilio-messaging/sendMessage/fields.ts"],"names":[],"mappings":";;;AACA,2CAAsE;AAEzD,QAAA,MAAM,GAA+B;IAChD,OAAO,EAAE;QACP,KAAK,EAAE,SAAS;QAChB,WAAW,EAAE,qCAAqC;QAClD,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE;YACP,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,oBAAQ,CAAC,GAAG,EAAE;YACrC,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,oBAAQ,CAAC,GAAG,EAAE;YACrC,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,oBAAQ,CAAC,QAAQ,EAAE;YAC/C,EAAE,KAAK,EAAE,oBAAoB,EAAE,KAAK,EAAE,oBAAQ,CAAC,SAAS,EAAE;SAC3D;QACD,OAAO,EAAE,oBAAQ,CAAC,GAAG;QACrB,oBAAoB,EAAE,CAAC,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,YAAY,CAAC;KACpF;IACD,aAAa,EAAE;QACb,KAAK,EAAE,iBAAiB;QACxB,WAAW,EAAE,mDAAmD;QAChE,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,SAAS;QAClB,UAAU,EAAE;YACV,KAAK,EAAE,KAAK;YACZ,UAAU,EAAE;gBACV;oBACE,QAAQ,EAAE,SAAS;oBACnB,QAAQ,EAAE,QAAQ;oBAClB,KAAK,E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9C;aACF;SACF;KACF;IACD,eAAe,EAAE;QACf,KAAK,EAAE,mBAAmB;QAC1B,WAAW,EAAE,+FAA+F;QAC5G,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,IAAI;QACd,QAAQ,EAAE,KAAK;QACf,UAAU,EAAE;YACV,KAAK,EAAE,KAAK;YACZ,UAAU,EAAE;gBACV;oBACE,QAAQ,EAAE,qBAAqB;oBAC/B,QAAQ,EAAE,IAAI;oBACd,KAAK,EAAE,6BAAiB,CAAC,MAAM,CAAC,aAAa;iBAC9C;aACF;SACF;KACF;IACD,eAAe,EAAE;QACf,KAAK,EAAE,kBAAkB;QACzB,WAAW,EACT,sIAAsI;QACxI,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,KAAK;QACf,eAAe,EAAE,UAAU;QAC3B,oBAAoB,EAAE,IAAI;QAC1B,OAAO,EAAE,SAAS;QAClB,UAAU,EAAE;YACV,KAAK,EAAE,KAAK;YACZ,UAAU,EAAE;gBACV;oBACE,QAAQ,EAAE,qBAAqB;oBAC/B,QAAQ,EAAE,IAAI;oBACd,KAAK,EAAE,6BAAiB,CAAC,MAAM,CAAC,aAAa;iBAC9C;aACF;SACF;KACF;IACD,cAAc,EAAE;QACd,KAAK,EAAE,iBAAiB;QACxB,WAAW,EACT,oKAAoK;QACtK,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,KAAK;QACf,OAAO,EAAE,CAAC;QACV,OAAO,EAAE,KAAK;QACd,OAAO,EAAE,KAAK;KACf;IACD,MAAM,EAAE;QACN,KAAK,EAAE,SAAS;QAChB,WAAW,EAAE,yEAAyE;QACtF,IAAI,EAAE,QAAQ;QACd,MAAM,EAAE,WAAW;QACnB,QAAQ,EAAE,KAAK;QACf,OAAO,EAAE,SAAS;KACnB;CACF,CAAA"}
@@ -0,0 +1,23 @@
1
+ export interface Payload {
2
+ channel: string;
3
+ toPhoneNumber: string;
4
+ messengerPageUserId?: string;
5
+ senderType: string;
6
+ fromPhoneNumber?: string;
7
+ messagingServiceSid?: string;
8
+ contentTemplateType: string;
9
+ contentSid?: string;
10
+ mediaUrls?: {
11
+ url: string;
12
+ }[];
13
+ contentVariables?: {
14
+ [k: string]: unknown;
15
+ };
16
+ inlineBody?: string;
17
+ inlineMediaUrls?: string[];
18
+ inlineVariables?: {
19
+ [k: string]: unknown;
20
+ };
21
+ validityPeriod?: number;
22
+ sendAt?: string;
23
+ }
@@ -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/twilio-messaging/sendMessage/generated-types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ import { 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,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const fields_1 = require("./fields");
4
+ const dynamic_fields_1 = require("./dynamic-fields");
5
+ const utils_1 = require("./utils");
6
+ const action = {
7
+ title: 'Send message',
8
+ description: "Send messages with Twilio's REST API.",
9
+ fields: fields_1.fields,
10
+ dynamicFields: {
11
+ fromPhoneNumber: async (request, { settings }) => {
12
+ return await dynamic_fields_1.dynamicFromPhoneNumber(request, settings);
13
+ },
14
+ messagingServiceSid: async (request, { settings }) => {
15
+ return await dynamic_fields_1.dynamicMessagingServiceSid(request, settings);
16
+ },
17
+ contentTemplateType: async (_, { payload }) => {
18
+ return await dynamic_fields_1.dynamicContentTemplateType(payload);
19
+ },
20
+ contentSid: async (request, { payload }) => {
21
+ return await dynamic_fields_1.dynamicContentSid(request, payload);
22
+ },
23
+ mediaUrls: {
24
+ url: async (request, { payload }) => {
25
+ return await dynamic_fields_1.dynamicMediaUrls(request, payload);
26
+ }
27
+ },
28
+ contentVariables: {
29
+ __keys__: async (request, { payload }) => {
30
+ return await dynamic_fields_1.dynamicContentVariables(request, payload);
31
+ }
32
+ }
33
+ },
34
+ perform: async (request, { payload, settings }) => {
35
+ return await utils_1.send(request, payload, settings);
36
+ }
37
+ };
38
+ exports.default = action;
39
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/twilio-messaging/sendMessage/index.ts"],"names":[],"mappings":";;AAGA,qCAAiC;AACjC,qDAOyB;AACzB,mCAA8B;AAE9B,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,cAAc;IACrB,WAAW,EAAE,uCAAuC;IACpD,MAAM,EAAN,eAAM;IACN,aAAa,EAAE;QACb,eAAe,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE;YAC/C,OAAO,MAAM,uCAAsB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAA;QACxD,CAAC;QACD,mBAAmB,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE;YACnD,OAAO,MAAM,2CAA0B,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAA;QAC5D,CAAC;QACD,mBAAmB,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;YAC5C,OAAO,MAAM,2CAA0B,CAAC,OAAO,CAAC,CAAA;QAClD,CAAC;QACD,UAAU,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;YACzC,OAAO,MAAM,kCAAiB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;QAClD,CAAC;QACD,SAAS,EAAE;YACT,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;gBAClC,OAAO,MAAM,iCAAgB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;YACjD,CAAC;SACF;QACD,gBAAgB,EAAE;YAChB,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;gBACvC,OAAO,MAAM,wCAAuB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;YACxD,CAAC;SACF;KACF;IACD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE;QAChD,OAAO,MAAM,YAAI,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAA;IAC/C,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
@@ -0,0 +1,34 @@
1
+ import { PREDEFINED_CONTENT_TYPES, CHANNELS } from './constants';
2
+ export declare type TwilioPayload = {
3
+ To: string;
4
+ SendAt?: string;
5
+ ValidityPeriod?: number;
6
+ MediaUrl?: string[];
7
+ } & Sender & Content;
8
+ export declare type Sender = FromPhone | FromMessagingService;
9
+ declare type FromMessagingService = {
10
+ MessagingServiceSid: string;
11
+ };
12
+ declare type FromPhone = {
13
+ From: string;
14
+ };
15
+ export declare type Content = ContentTemplateMessage | InlineMessage;
16
+ declare type ContentTemplateMessage = {
17
+ ContentSid: string;
18
+ ContentVariables?: string;
19
+ };
20
+ declare type InlineMessage = {
21
+ Body: string;
22
+ };
23
+ export declare type PredefinedContentTypes = {
24
+ [key: string]: PredefinedContentTypeItem;
25
+ };
26
+ export declare type Channel = typeof CHANNELS[keyof typeof CHANNELS];
27
+ export declare type PredefinedContentTypeItem = {
28
+ friendly_name: string;
29
+ name: string;
30
+ supports_media: boolean;
31
+ supported_channels: Array<Channel>;
32
+ };
33
+ export declare type ContentTypeName = typeof PREDEFINED_CONTENT_TYPES[keyof typeof PREDEFINED_CONTENT_TYPES]['name'];
34
+ export {};
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/destinations/twilio-messaging/sendMessage/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ import { RequestClient } from '@segment/actions-core';
2
+ import { Payload } from './generated-types';
3
+ import { Settings } from '../generated-types';
4
+ export declare function send(request: RequestClient, payload: Payload, settings: Settings): Promise<import("@segment/actions-core").ModifiedResponse<unknown>>;
5
+ export declare function parseFieldValue(value: string | undefined | null): string | undefined;
6
+ export declare function validateContentSid(contentSid: string): boolean;