@segment/action-destinations 3.127.1-CHANNELS-329-templated.13 → 3.127.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.
- package/dist/destinations/engage-messaging-twilio/index.js +1 -3
- package/dist/destinations/engage-messaging-twilio/index.js.map +1 -1
- package/dist/destinations/engage-messaging-twilio/sendSms/index.js +104 -2
- package/dist/destinations/engage-messaging-twilio/sendSms/index.js.map +1 -1
- package/dist/destinations/heap/index.js +1 -1
- package/dist/destinations/heap/index.js.map +1 -1
- package/dist/destinations/heap/trackEvent/generated-types.d.ts +1 -3
- package/dist/destinations/heap/trackEvent/index.js +5 -32
- package/dist/destinations/heap/trackEvent/index.js.map +1 -1
- package/package.json +2 -4
- package/dist/destinations/engage-messaging-twilio/sendSms/sms-sender.d.ts +0 -15
- package/dist/destinations/engage-messaging-twilio/sendSms/sms-sender.js +0 -66
- package/dist/destinations/engage-messaging-twilio/sendSms/sms-sender.js.map +0 -1
- package/dist/destinations/engage-messaging-twilio/sendWhatsApp/generated-types.d.ts +0 -23
- package/dist/destinations/engage-messaging-twilio/sendWhatsApp/generated-types.js +0 -3
- package/dist/destinations/engage-messaging-twilio/sendWhatsApp/generated-types.js.map +0 -1
- package/dist/destinations/engage-messaging-twilio/sendWhatsApp/index.d.ts +0 -5
- package/dist/destinations/engage-messaging-twilio/sendWhatsApp/index.js +0 -122
- package/dist/destinations/engage-messaging-twilio/sendWhatsApp/index.js.map +0 -1
- package/dist/destinations/engage-messaging-twilio/sendWhatsApp/whatsapp-sender.d.ts +0 -15
- package/dist/destinations/engage-messaging-twilio/sendWhatsApp/whatsapp-sender.js +0 -66
- package/dist/destinations/engage-messaging-twilio/sendWhatsApp/whatsapp-sender.js.map +0 -1
- package/dist/destinations/engage-messaging-twilio/utils/message-sender.d.ts +0 -23
- package/dist/destinations/engage-messaging-twilio/utils/message-sender.js +0 -97
- package/dist/destinations/engage-messaging-twilio/utils/message-sender.js.map +0 -1
|
@@ -4,7 +4,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const sendSms_1 = __importDefault(require("./sendSms"));
|
|
7
|
-
const sendWhatsApp_1 = __importDefault(require("./sendWhatsApp"));
|
|
8
7
|
const getRange = (val) => {
|
|
9
8
|
return Array(val)
|
|
10
9
|
.fill(1)
|
|
@@ -154,8 +153,7 @@ const destination = {
|
|
|
154
153
|
}
|
|
155
154
|
},
|
|
156
155
|
actions: {
|
|
157
|
-
sendSms: sendSms_1.default
|
|
158
|
-
sendWhatsApp: sendWhatsApp_1.default
|
|
156
|
+
sendSms: sendSms_1.default
|
|
159
157
|
}
|
|
160
158
|
};
|
|
161
159
|
exports.default = destination;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/engage-messaging-twilio/index.ts"],"names":[],"mappings":";;;;;AAEA,wDAA+B;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/engage-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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B;gBACzB,WAAW,EACT,sGAAsG;gBACxG,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,gBAAgB;gBACzB,QAAQ,EAAE,KAAK;aAChB;YACD,mBAAmB,EAAE;gBACnB,KAAK,EAAE,sBAAsB;gBAC7B,WAAW,EACT,8HAA8H;gBAChI,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,KAAK;gBACf,OAAO,EAAE,aAAa;gBACtB,UAAU,EAAE,6BAA6B;aAC1C;SACF;QACD,kBAAkB,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE;YACvC,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,cAAc,IAAI,gBAAgB,CAAA;YACpE,OAAO,OAAO,CAAC,WAAW,QAAQ,aAAa,CAAC,CAAA;QAClD,CAAC;KACF;IASD,OAAO,EAAE;QACP,OAAO,EAAP,iBAAO;KACR;CACF,CAAA;AAED,kBAAe,WAAW,CAAA"}
|
|
@@ -1,6 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
3
|
+
const liquidjs_1 = require("liquidjs");
|
|
4
|
+
const actions_core_1 = require("@segment/actions-core");
|
|
5
|
+
const Liquid = new liquidjs_1.Liquid();
|
|
6
|
+
const getProfileApiEndpoint = (environment) => {
|
|
7
|
+
return `https://profiles.segment.${environment === 'production' ? 'com' : 'build'}`;
|
|
8
|
+
};
|
|
9
|
+
const fetchProfileTraits = async (request, settings, profileId, statsClient, tags) => {
|
|
10
|
+
try {
|
|
11
|
+
const endpoint = getProfileApiEndpoint(settings.profileApiEnvironment);
|
|
12
|
+
const response = await request(`${endpoint}/v1/spaces/${settings.spaceId}/collections/users/profiles/user_id:${profileId}/traits?limit=200`, {
|
|
13
|
+
headers: {
|
|
14
|
+
authorization: `Basic ${Buffer.from(settings.profileApiAccessToken + ':').toString('base64')}`,
|
|
15
|
+
'content-type': 'application/json'
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
tags?.push(`profile_status_code:${response.status}`);
|
|
19
|
+
statsClient?.incr('actions-personas-messaging-twilio.profile_invoked', 1, tags);
|
|
20
|
+
const body = await response.json();
|
|
21
|
+
return body.traits;
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
statsClient?.incr('actions-personas-messaging-twilio.profile_error', 1, tags);
|
|
25
|
+
throw new actions_core_1.IntegrationError('Unable to get profile traits for SMS message', 'SMS trait fetch failure', 500);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
const EXTERNAL_ID_KEY = 'phone';
|
|
29
|
+
const DEFAULT_HOSTNAME = 'api.twilio.com';
|
|
30
|
+
const DEFAULT_CONNECTION_OVERRIDES = 'rp=all&rc=5';
|
|
4
31
|
const action = {
|
|
5
32
|
title: 'Send SMS',
|
|
6
33
|
description: 'Send SMS using Twilio',
|
|
@@ -116,7 +143,82 @@ const action = {
|
|
|
116
143
|
const statsClient = statsContext?.statsClient;
|
|
117
144
|
const tags = statsContext?.tags;
|
|
118
145
|
tags?.push(`space_id:${settings.spaceId}`, `projectid:${settings.sourceId}`);
|
|
119
|
-
|
|
146
|
+
if (!payload.send) {
|
|
147
|
+
statsClient?.incr('actions-personas-messaging-twilio.send-disabled', 1, tags);
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
const externalId = payload.externalIds?.find(({ type }) => type === 'phone');
|
|
151
|
+
if (!externalId?.subscriptionStatus ||
|
|
152
|
+
['unsubscribed', 'did not subscribed', 'false'].includes(externalId.subscriptionStatus)) {
|
|
153
|
+
statsClient?.incr('actions-personas-messaging-twilio.notsubscribed', 1, tags);
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
else if (['subscribed', 'true'].includes(externalId.subscriptionStatus)) {
|
|
157
|
+
statsClient?.incr('actions-personas-messaging-twilio.subscribed', 1, tags);
|
|
158
|
+
const phone = payload.toNumber || externalId.id;
|
|
159
|
+
if (!phone) {
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
let traits;
|
|
163
|
+
if (payload.traitEnrichment) {
|
|
164
|
+
traits = payload?.traits ? payload?.traits : JSON.parse('{}');
|
|
165
|
+
}
|
|
166
|
+
else {
|
|
167
|
+
traits = await fetchProfileTraits(request, settings, payload.userId, statsClient, tags);
|
|
168
|
+
}
|
|
169
|
+
const profile = {
|
|
170
|
+
user_id: payload.userId,
|
|
171
|
+
phone,
|
|
172
|
+
traits
|
|
173
|
+
};
|
|
174
|
+
const token = Buffer.from(`${settings.twilioApiKeySID}:${settings.twilioApiKeySecret}`).toString('base64');
|
|
175
|
+
let parsedBody;
|
|
176
|
+
try {
|
|
177
|
+
parsedBody = await Liquid.parseAndRender(payload.body, { profile });
|
|
178
|
+
}
|
|
179
|
+
catch (error) {
|
|
180
|
+
throw new actions_core_1.IntegrationError(`Unable to parse templating in SMS`, `SMS templating parse failure`, 400);
|
|
181
|
+
}
|
|
182
|
+
const body = new URLSearchParams({
|
|
183
|
+
Body: parsedBody,
|
|
184
|
+
From: payload.from,
|
|
185
|
+
To: phone
|
|
186
|
+
});
|
|
187
|
+
const webhookUrl = settings.webhookUrl;
|
|
188
|
+
const connectionOverrides = settings.connectionOverrides;
|
|
189
|
+
const customArgs = {
|
|
190
|
+
...payload.customArgs,
|
|
191
|
+
space_id: settings.spaceId,
|
|
192
|
+
__segment_internal_external_id_key__: EXTERNAL_ID_KEY,
|
|
193
|
+
__segment_internal_external_id_value__: phone
|
|
194
|
+
};
|
|
195
|
+
if (webhookUrl && customArgs) {
|
|
196
|
+
const webhookUrlWithParams = new URL(webhookUrl);
|
|
197
|
+
for (const key of Object.keys(customArgs)) {
|
|
198
|
+
webhookUrlWithParams.searchParams.append(key, String(customArgs[key]));
|
|
199
|
+
}
|
|
200
|
+
webhookUrlWithParams.hash = connectionOverrides || DEFAULT_CONNECTION_OVERRIDES;
|
|
201
|
+
body.append('StatusCallback', webhookUrlWithParams.toString());
|
|
202
|
+
}
|
|
203
|
+
const hostname = settings.twilioHostname ?? DEFAULT_HOSTNAME;
|
|
204
|
+
const response = await request(`https://${hostname}/2010-04-01/Accounts/${settings.twilioAccountSID}/Messages.json`, {
|
|
205
|
+
method: 'POST',
|
|
206
|
+
headers: {
|
|
207
|
+
authorization: `Basic ${token}`
|
|
208
|
+
},
|
|
209
|
+
body
|
|
210
|
+
});
|
|
211
|
+
tags?.push(`twilio_status_code:${response.status}`);
|
|
212
|
+
statsClient?.incr('actions-personas-messaging-twilio.response', 1, tags);
|
|
213
|
+
if (payload?.eventOccurredTS != undefined) {
|
|
214
|
+
statsClient?.histogram('actions-personas-messaging-twilio.eventDeliveryTS', Date.now() - new Date(payload?.eventOccurredTS).getTime(), tags);
|
|
215
|
+
}
|
|
216
|
+
return response;
|
|
217
|
+
}
|
|
218
|
+
else {
|
|
219
|
+
statsClient?.incr('actions-personas-messaging-twilio.twilio-error', 1, tags);
|
|
220
|
+
throw new actions_core_1.IntegrationError(`Failed to recognize the subscriptionStatus in the payload: "${externalId.subscriptionStatus}".`, 'Invalid subscriptionStatus value', 400);
|
|
221
|
+
}
|
|
120
222
|
}
|
|
121
223
|
};
|
|
122
224
|
exports.default = action;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/engage-messaging-twilio/sendSms/index.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/engage-messaging-twilio/sendSms/index.ts"],"names":[],"mappings":";;AAAA,uCAA6C;AAK7C,wDAAwD;AAExD,MAAM,MAAM,GAAG,IAAI,iBAAQ,EAAE,CAAA;AAE7B,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,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wBAAwB,QAAQ,CAAC,gBAAgB,gBAAgB,EACpF;gBACE,MAAM,EAAE,MAAM;gBACd,OAAO,EAAE;oBACP,aAAa,EAAE,SAAS,KAAK,EAAE;iBAChC;gBACD,IAAI;aACL,CACF,CAAA;YACD,IAAI,EAAE,IAAI,CAAC,sBAAsB,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAA;YACnD,WAAW,EAAE,IAAI,CAAC,4CAA4C,EAAE,CAAC,EAAE,IAAI,CAAC,CAAA;YACxE,IAAI,OAAO,EAAE,eAAe,IAAI,SAAS,EAAE;gBACzC,WAAW,EAAE,SAAS,CACpB,mDAAmD,EACnD,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,IAAI,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC,OAAO,EAAE,EACzD,IAAI,CACL,CAAA;aACF;YACD,OAAO,QAAQ,CAAA;SAChB;aAAM;YACL,WAAW,EAAE,IAAI,CAAC,gDAAgD,EAAE,CAAC,EAAE,IAAI,CAAC,CAAA;YAC5E,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"}
|
|
@@ -9,7 +9,7 @@ const identifyUser_1 = __importDefault(require("./identifyUser"));
|
|
|
9
9
|
const presets = [
|
|
10
10
|
{
|
|
11
11
|
name: 'Track Calls',
|
|
12
|
-
subscribe: 'type = "track"
|
|
12
|
+
subscribe: 'type = "track"',
|
|
13
13
|
partnerAction: 'trackEvent',
|
|
14
14
|
mapping: actions_core_1.defaultValues(trackEvent_1.default.fields)
|
|
15
15
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/heap/index.ts"],"names":[],"mappings":";;;;;AAEA,8DAAqC;AACrC,wDAAqD;AACrD,kEAAyC;AAGzC,MAAM,OAAO,GAAqC;IAChD;QACE,IAAI,EAAE,aAAa;QACnB,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/heap/index.ts"],"names":[],"mappings":";;;;;AAEA,8DAAqC;AACrC,wDAAqD;AACrD,kEAAyC;AAGzC,MAAM,OAAO,GAAqC;IAChD;QACE,IAAI,EAAE,aAAa;QACnB,SAAS,EAAE,gBAAgB;QAC3B,aAAa,EAAE,YAAY;QAC3B,OAAO,EAAE,4BAAa,CAAC,oBAAU,CAAC,MAAM,CAAC;KAC1C;IACD;QACE,IAAI,EAAE,gBAAgB;QACtB,SAAS,EAAE,mBAAmB;QAC9B,aAAa,EAAE,cAAc;QAC7B,OAAO,EAAE,4BAAa,CAAC,sBAAY,CAAC,MAAM,CAAC;KAC5C;CACF,CAAA;AAED,MAAM,WAAW,GAAoC;IACnD,IAAI,EAAE,sBAAsB;IAC5B,IAAI,EAAE,oBAAoB;IAC1B,IAAI,EAAE,OAAO;IACb,cAAc,EAAE;QACd,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE;YACN,KAAK,EAAE;gBACL,KAAK,EAAE,QAAQ;gBACf,WAAW,EAAE,mDAAmD;gBAChE,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,IAAI;aACf;SACF;KACF;IAED,OAAO;IACP,OAAO,EAAE;QACP,UAAU,EAAV,oBAAU;QACV,YAAY,EAAZ,sBAAY;KACb;CACF,CAAA;AAED,kBAAe,WAAW,CAAA"}
|
|
@@ -2,12 +2,10 @@ export interface Payload {
|
|
|
2
2
|
message_id: string;
|
|
3
3
|
identity?: string | null;
|
|
4
4
|
anonymous_id?: string | null;
|
|
5
|
-
event
|
|
5
|
+
event: string;
|
|
6
6
|
properties?: {
|
|
7
7
|
[k: string]: unknown;
|
|
8
8
|
};
|
|
9
9
|
timestamp?: string | number;
|
|
10
10
|
library_name?: string;
|
|
11
|
-
type: string;
|
|
12
|
-
name?: string;
|
|
13
11
|
}
|
|
@@ -11,7 +11,7 @@ const actions_core_1 = require("@segment/actions-core");
|
|
|
11
11
|
const action = {
|
|
12
12
|
title: 'Track Event',
|
|
13
13
|
description: 'Send an event to Heap.',
|
|
14
|
-
defaultSubscription: 'type = "track"
|
|
14
|
+
defaultSubscription: 'type = "track"',
|
|
15
15
|
fields: {
|
|
16
16
|
message_id: {
|
|
17
17
|
label: 'Message ID',
|
|
@@ -41,9 +41,10 @@ const action = {
|
|
|
41
41
|
}
|
|
42
42
|
},
|
|
43
43
|
event: {
|
|
44
|
-
label: '
|
|
44
|
+
label: 'Event Type',
|
|
45
45
|
type: 'string',
|
|
46
|
-
description: '
|
|
46
|
+
description: 'The name of the event. Limited to 1024 characters.',
|
|
47
|
+
required: true,
|
|
47
48
|
default: {
|
|
48
49
|
'@path': '$.event'
|
|
49
50
|
}
|
|
@@ -71,23 +72,6 @@ const action = {
|
|
|
71
72
|
default: {
|
|
72
73
|
'@path': '$.context.library.name'
|
|
73
74
|
}
|
|
74
|
-
},
|
|
75
|
-
type: {
|
|
76
|
-
label: 'Type',
|
|
77
|
-
type: 'string',
|
|
78
|
-
description: 'The type of call. Can be track, page, or screen.',
|
|
79
|
-
required: true,
|
|
80
|
-
default: {
|
|
81
|
-
'@path': '$.type'
|
|
82
|
-
}
|
|
83
|
-
},
|
|
84
|
-
name: {
|
|
85
|
-
label: 'Page or Screen Name',
|
|
86
|
-
type: 'string',
|
|
87
|
-
description: 'The name of the page or screen being viewed. This only exists for page and screen events.',
|
|
88
|
-
default: {
|
|
89
|
-
'@path': '$.name'
|
|
90
|
-
}
|
|
91
75
|
}
|
|
92
76
|
},
|
|
93
77
|
perform: (request, { payload, settings }) => {
|
|
@@ -102,7 +86,7 @@ const action = {
|
|
|
102
86
|
const eventProperties = Object.assign(defaultEventProperties, flatten);
|
|
103
87
|
const event = {
|
|
104
88
|
app_id: settings.appId,
|
|
105
|
-
event:
|
|
89
|
+
event: payload.event,
|
|
106
90
|
properties: eventProperties,
|
|
107
91
|
idempotency_key: payload.message_id
|
|
108
92
|
};
|
|
@@ -121,16 +105,5 @@ const action = {
|
|
|
121
105
|
});
|
|
122
106
|
}
|
|
123
107
|
};
|
|
124
|
-
const getEventName = (payload) => {
|
|
125
|
-
switch (payload.type) {
|
|
126
|
-
case 'track':
|
|
127
|
-
return payload.event;
|
|
128
|
-
case 'page':
|
|
129
|
-
case 'screen':
|
|
130
|
-
return payload.name;
|
|
131
|
-
default:
|
|
132
|
-
return undefined;
|
|
133
|
-
}
|
|
134
|
-
};
|
|
135
108
|
exports.default = action;
|
|
136
109
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/heap/trackEvent/index.ts"],"names":[],"mappings":";;;;;AAGA,+DAAsC;AACtC,4CAAwD;AACxD,8CAA6C;AAC7C,kCAA8B;AAC9B,wDAAwD;AAcxD,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,aAAa;IACpB,WAAW,EAAE,wBAAwB;IACrC,mBAAmB,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/heap/trackEvent/index.ts"],"names":[],"mappings":";;;;;AAGA,+DAAsC;AACtC,4CAAwD;AACxD,8CAA6C;AAC7C,kCAA8B;AAC9B,wDAAwD;AAcxD,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,aAAa;IACpB,WAAW,EAAE,wBAAwB;IACrC,mBAAmB,EAAE,gBAAgB;IACrC,MAAM,EAAE;QACN,UAAU,EAAE;YACV,KAAK,EAAE,YAAY;YACnB,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,uCAAuC;YACpD,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,aAAa;aACvB;SACF;QACD,QAAQ,EAAE;YACR,KAAK,EAAE,UAAU;YACjB,IAAI,EAAE,QAAQ;YACd,SAAS,EAAE,IAAI;YACf,WAAW,EACT,6LAA6L;YAC/L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MAAM,OAAO,GAAG,WAAI,CAAC,OAAO,CAAC,UAAU,IAAI,EAAE,CAAC,CAAA;QAC9C,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC,sBAAsB,EAAE,OAAO,CAAC,CAAA;QACtE,MAAM,KAAK,GAAc;YACvB,MAAM,EAAE,QAAQ,CAAC,KAAK;YACtB,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,UAAU,EAAE,eAAe;YAC3B,eAAe,EAAE,OAAO,CAAC,UAAU;SACpC,CAAA;QAED,IAAI,OAAO,CAAC,YAAY,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE;YAC7C,KAAK,CAAC,OAAO,GAAG,0BAAa,CAAC,OAAO,CAAC,YAAY,CAAC,CAAA;SACpD;QAED,IAAI,OAAO,CAAC,QAAQ,EAAE;YACpB,KAAK,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAA;SAClC;QAED,IAAI,OAAO,CAAC,SAAS,IAAI,eAAK,CAAC,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,EAAE;YAC/D,KAAK,CAAC,SAAS,GAAG,eAAK,CAAC,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE,CAAA;SAC7D;QAED,OAAO,OAAO,CAAC,qCAAqC,EAAE;YACpD,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,KAAK;SACZ,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@segment/action-destinations",
|
|
3
3
|
"description": "Destination Actions engine and definitions.",
|
|
4
|
-
"version": "3.127.1
|
|
4
|
+
"version": "3.127.1",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/segmentio/action-destinations",
|
|
@@ -31,7 +31,6 @@
|
|
|
31
31
|
"typecheck": "tsc -p tsconfig.build.json --noEmit"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@types/google-libphonenumber": "^7.4.23",
|
|
35
34
|
"@types/jest": "^27.0.0",
|
|
36
35
|
"jest": "^27.3.1",
|
|
37
36
|
"nock": "^13.1.4"
|
|
@@ -44,7 +43,6 @@
|
|
|
44
43
|
"cheerio": "^1.0.0-rc.10",
|
|
45
44
|
"dayjs": "^1.10.7",
|
|
46
45
|
"escape-goat": "^3",
|
|
47
|
-
"google-libphonenumber": "^3.2.31",
|
|
48
46
|
"liquidjs": "^9.37.0",
|
|
49
47
|
"lodash": "^4.17.21"
|
|
50
48
|
},
|
|
@@ -67,5 +65,5 @@
|
|
|
67
65
|
"lcov"
|
|
68
66
|
]
|
|
69
67
|
},
|
|
70
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "95dc062bc14f77bb3d424b14502108ea49f61b95"
|
|
71
69
|
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { Settings } from '../generated-types';
|
|
2
|
-
import type { Payload } from './generated-types';
|
|
3
|
-
import { StatsClient, StatsContext } from '@segment/actions-core/src/destination-kit';
|
|
4
|
-
import { MessageSender, RequestFn } from '../utils/message-sender';
|
|
5
|
-
export declare class SmsMessageSender extends MessageSender<Payload> {
|
|
6
|
-
readonly request: RequestFn;
|
|
7
|
-
readonly payload: Payload;
|
|
8
|
-
readonly settings: Settings;
|
|
9
|
-
readonly statsClient: StatsClient | undefined;
|
|
10
|
-
readonly tags: StatsContext['tags'] | undefined;
|
|
11
|
-
constructor(request: RequestFn, payload: Payload, settings: Settings, statsClient: StatsClient | undefined, tags: StatsContext['tags'] | undefined);
|
|
12
|
-
getBody: (phone: string) => Promise<URLSearchParams>;
|
|
13
|
-
getTwilioBase64Token: () => string;
|
|
14
|
-
private getProfileTraits;
|
|
15
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SmsMessageSender = void 0;
|
|
4
|
-
const liquidjs_1 = require("liquidjs");
|
|
5
|
-
const actions_core_1 = require("@segment/actions-core");
|
|
6
|
-
const message_sender_1 = require("../utils/message-sender");
|
|
7
|
-
const Liquid = new liquidjs_1.Liquid();
|
|
8
|
-
class SmsMessageSender extends message_sender_1.MessageSender {
|
|
9
|
-
constructor(request, payload, settings, statsClient, tags) {
|
|
10
|
-
super(request, payload, settings, statsClient, tags);
|
|
11
|
-
this.request = request;
|
|
12
|
-
this.payload = payload;
|
|
13
|
-
this.settings = settings;
|
|
14
|
-
this.statsClient = statsClient;
|
|
15
|
-
this.tags = tags;
|
|
16
|
-
this.getBody = async (phone) => {
|
|
17
|
-
let traits;
|
|
18
|
-
if (this.payload.traitEnrichment) {
|
|
19
|
-
traits = this.payload?.traits ? this.payload?.traits : {};
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
traits = await this.getProfileTraits();
|
|
23
|
-
}
|
|
24
|
-
const profile = {
|
|
25
|
-
user_id: this.payload.userId,
|
|
26
|
-
phone,
|
|
27
|
-
traits
|
|
28
|
-
};
|
|
29
|
-
let parsedBody;
|
|
30
|
-
try {
|
|
31
|
-
parsedBody = await Liquid.parseAndRender(this.payload.body, { profile });
|
|
32
|
-
}
|
|
33
|
-
catch (error) {
|
|
34
|
-
throw new actions_core_1.IntegrationError(`Unable to parse templating in SMS`, `SMS templating parse failure`, 400);
|
|
35
|
-
}
|
|
36
|
-
const body = new URLSearchParams({
|
|
37
|
-
Body: parsedBody,
|
|
38
|
-
From: this.payload.from,
|
|
39
|
-
To: phone
|
|
40
|
-
});
|
|
41
|
-
return body;
|
|
42
|
-
};
|
|
43
|
-
this.getTwilioBase64Token = () => Buffer.from(`${this.settings.twilioApiKeySID}:${this.settings.twilioApiKeySecret}`).toString('base64');
|
|
44
|
-
this.getProfileTraits = async () => {
|
|
45
|
-
try {
|
|
46
|
-
const endpoint = `https://profiles.segment.${this.settings.profileApiEnvironment === 'production' ? 'com' : 'build'}`;
|
|
47
|
-
const response = await this.request(`${endpoint}/v1/spaces/${this.settings.spaceId}/collections/users/profiles/user_id:${this.payload.userId}/traits?limit=200`, {
|
|
48
|
-
headers: {
|
|
49
|
-
authorization: `Basic ${Buffer.from(this.settings.profileApiAccessToken + ':').toString('base64')}`,
|
|
50
|
-
'content-type': 'application/json'
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
this.tags?.push(`profile_status_code:${response.status}`);
|
|
54
|
-
this.statsClient?.incr('actions-personas-messaging-twilio.profile_invoked', 1, this.tags);
|
|
55
|
-
const body = await response.json();
|
|
56
|
-
return body.traits;
|
|
57
|
-
}
|
|
58
|
-
catch (error) {
|
|
59
|
-
this.statsClient?.incr('actions-personas-messaging-twilio.profile_error', 1, this.tags);
|
|
60
|
-
throw new actions_core_1.IntegrationError('Unable to get profile traits for SMS message', 'SMS trait fetch failure', 500);
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
exports.SmsMessageSender = SmsMessageSender;
|
|
66
|
-
//# sourceMappingURL=sms-sender.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sms-sender.js","sourceRoot":"","sources":["../../../../src/destinations/engage-messaging-twilio/sendSms/sms-sender.ts"],"names":[],"mappings":";;;AACA,uCAA6C;AAG7C,wDAAwD;AAExD,4DAAkE;AAElE,MAAM,MAAM,GAAG,IAAI,iBAAQ,EAAE,CAAA;AAE7B,MAAa,gBAAiB,SAAQ,8BAAsB;IAC1D,YACW,OAAkB,EAClB,OAAgB,EAChB,QAAkB,EAClB,WAAoC,EACpC,IAAsC;QAE/C,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,IAAI,CAAC,CAAA;QAN3C,YAAO,GAAP,OAAO,CAAW;QAClB,YAAO,GAAP,OAAO,CAAS;QAChB,aAAQ,GAAR,QAAQ,CAAU;Q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
|
|
9
|
-
[k: string]: unknown;
|
|
10
|
-
};
|
|
11
|
-
connectionOverrides?: string;
|
|
12
|
-
send?: boolean;
|
|
13
|
-
traitEnrichment?: boolean;
|
|
14
|
-
externalIds?: {
|
|
15
|
-
id?: string;
|
|
16
|
-
type?: string;
|
|
17
|
-
subscriptionStatus?: string;
|
|
18
|
-
}[];
|
|
19
|
-
traits?: {
|
|
20
|
-
[k: string]: unknown;
|
|
21
|
-
};
|
|
22
|
-
eventOccurredTS?: string;
|
|
23
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/engage-messaging-twilio/sendWhatsApp/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const whatsapp_sender_1 = require("./whatsapp-sender");
|
|
4
|
-
const action = {
|
|
5
|
-
title: 'Send WhatsApp',
|
|
6
|
-
description: 'Send WhatsApp using Twilio',
|
|
7
|
-
defaultSubscription: 'type = "track" and event = "Audience Entered"',
|
|
8
|
-
fields: {
|
|
9
|
-
contentSid: {
|
|
10
|
-
label: 'WhatsApp template content Sid',
|
|
11
|
-
description: 'The template you sending through WhatsApp',
|
|
12
|
-
type: 'string',
|
|
13
|
-
required: true
|
|
14
|
-
},
|
|
15
|
-
contentVariables: {
|
|
16
|
-
label: 'WhatsApp template variables',
|
|
17
|
-
description: 'Content personalization variables/merge tags for your WhatsApp message',
|
|
18
|
-
type: 'object',
|
|
19
|
-
required: false
|
|
20
|
-
},
|
|
21
|
-
toNumber: {
|
|
22
|
-
label: 'Test Number',
|
|
23
|
-
description: 'Number to send WhatsApp to when testing',
|
|
24
|
-
type: 'string'
|
|
25
|
-
},
|
|
26
|
-
from: {
|
|
27
|
-
label: 'From',
|
|
28
|
-
description: 'The Twilio Phone Number, Short Code, or Messaging Service to send WhatsApp from.',
|
|
29
|
-
type: 'string',
|
|
30
|
-
required: true
|
|
31
|
-
},
|
|
32
|
-
customArgs: {
|
|
33
|
-
label: 'Custom Arguments',
|
|
34
|
-
description: 'Additional custom arguments that will be opaquely sent back on webhook events',
|
|
35
|
-
type: 'object',
|
|
36
|
-
required: false
|
|
37
|
-
},
|
|
38
|
-
connectionOverrides: {
|
|
39
|
-
label: 'Connection Overrides',
|
|
40
|
-
description: 'Connection overrides are configuration supported by twilio webhook services. Must be passed as fragments on the callback url',
|
|
41
|
-
type: 'string',
|
|
42
|
-
required: false
|
|
43
|
-
},
|
|
44
|
-
send: {
|
|
45
|
-
label: 'Send Message',
|
|
46
|
-
description: 'Whether or not the message should actually get sent.',
|
|
47
|
-
type: 'boolean',
|
|
48
|
-
required: false,
|
|
49
|
-
default: false
|
|
50
|
-
},
|
|
51
|
-
traitEnrichment: {
|
|
52
|
-
label: 'Trait Enrich',
|
|
53
|
-
description: 'Whether or not trait enrich from event (i.e without profile api call)',
|
|
54
|
-
type: 'boolean',
|
|
55
|
-
required: false,
|
|
56
|
-
default: true
|
|
57
|
-
},
|
|
58
|
-
externalIds: {
|
|
59
|
-
label: 'External IDs',
|
|
60
|
-
description: 'An array of user profile identity information.',
|
|
61
|
-
type: 'object',
|
|
62
|
-
multiple: true,
|
|
63
|
-
properties: {
|
|
64
|
-
id: {
|
|
65
|
-
label: 'ID',
|
|
66
|
-
description: 'A unique identifier for the collection.',
|
|
67
|
-
type: 'string'
|
|
68
|
-
},
|
|
69
|
-
type: {
|
|
70
|
-
label: 'type',
|
|
71
|
-
description: 'The external ID contact type.',
|
|
72
|
-
type: 'string'
|
|
73
|
-
},
|
|
74
|
-
subscriptionStatus: {
|
|
75
|
-
label: 'ID',
|
|
76
|
-
description: 'The subscription status for the identity.',
|
|
77
|
-
type: 'string'
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
|
-
default: {
|
|
81
|
-
'@arrayPath': [
|
|
82
|
-
'$.external_ids',
|
|
83
|
-
{
|
|
84
|
-
id: {
|
|
85
|
-
'@path': '$.id'
|
|
86
|
-
},
|
|
87
|
-
type: {
|
|
88
|
-
'@path': '$.type'
|
|
89
|
-
},
|
|
90
|
-
subscriptionStatus: {
|
|
91
|
-
'@path': '$.isSubscribed'
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
]
|
|
95
|
-
}
|
|
96
|
-
},
|
|
97
|
-
traits: {
|
|
98
|
-
label: 'Traits',
|
|
99
|
-
description: "A user profile's traits",
|
|
100
|
-
type: 'object',
|
|
101
|
-
required: false,
|
|
102
|
-
default: { '@path': '$.properties' }
|
|
103
|
-
},
|
|
104
|
-
eventOccurredTS: {
|
|
105
|
-
label: 'Event Timestamp',
|
|
106
|
-
description: 'Time of when the actual event happened.',
|
|
107
|
-
type: 'string',
|
|
108
|
-
required: false,
|
|
109
|
-
default: {
|
|
110
|
-
'@path': '$.timestamp'
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
},
|
|
114
|
-
perform: async (request, { settings, payload, statsContext }) => {
|
|
115
|
-
const statsClient = statsContext?.statsClient;
|
|
116
|
-
const tags = statsContext?.tags;
|
|
117
|
-
tags?.push(`space_id:${settings.spaceId}`, `projectid:${settings.sourceId}`);
|
|
118
|
-
return new whatsapp_sender_1.WhatsAppMessageSender(request, payload, settings, statsClient, tags).send();
|
|
119
|
-
}
|
|
120
|
-
};
|
|
121
|
-
exports.default = action;
|
|
122
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/engage-messaging-twilio/sendWhatsApp/index.ts"],"names":[],"mappings":";;AAIA,uDAAyD;AAEzD,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,eAAe;IACtB,WAAW,EAAE,4BAA4B;IACzC,mBAAmB,EAAE,+CAA+C;IACpE,MAAM,EAAE;QACN,UAAU,EAAE;YACV,KAAK,EAAE,+BAA+B;YACtC,WAAW,EAAE,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 +0,0 @@
|
|
|
1
|
-
import type { Settings } from '../generated-types';
|
|
2
|
-
import type { Payload } from './generated-types';
|
|
3
|
-
import { RequestFn, MessageSender } from '../utils/message-sender';
|
|
4
|
-
import { StatsClient, StatsContext } from '@segment/actions-core/src/destination-kit';
|
|
5
|
-
export declare class WhatsAppMessageSender extends MessageSender<Payload> {
|
|
6
|
-
readonly request: RequestFn;
|
|
7
|
-
readonly payload: Payload;
|
|
8
|
-
readonly settings: Settings;
|
|
9
|
-
readonly statsClient: StatsClient | undefined;
|
|
10
|
-
readonly tags: StatsContext['tags'] | undefined;
|
|
11
|
-
constructor(request: RequestFn, payload: Payload, settings: Settings, statsClient: StatsClient | undefined, tags: StatsContext['tags'] | undefined);
|
|
12
|
-
getBody: (phone: string) => Promise<URLSearchParams>;
|
|
13
|
-
getTwilioBase64Token: () => string;
|
|
14
|
-
private getVariables;
|
|
15
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WhatsAppMessageSender = void 0;
|
|
4
|
-
const liquidjs_1 = require("liquidjs");
|
|
5
|
-
const actions_core_1 = require("@segment/actions-core");
|
|
6
|
-
const message_sender_1 = require("../utils/message-sender");
|
|
7
|
-
const google_libphonenumber_1 = require("google-libphonenumber");
|
|
8
|
-
const phoneUtil = google_libphonenumber_1.PhoneNumberUtil.getInstance();
|
|
9
|
-
const Liquid = new liquidjs_1.Liquid();
|
|
10
|
-
class WhatsAppMessageSender extends message_sender_1.MessageSender {
|
|
11
|
-
constructor(request, payload, settings, statsClient, tags) {
|
|
12
|
-
super(request, payload, settings, statsClient, tags);
|
|
13
|
-
this.request = request;
|
|
14
|
-
this.payload = payload;
|
|
15
|
-
this.settings = settings;
|
|
16
|
-
this.statsClient = statsClient;
|
|
17
|
-
this.tags = tags;
|
|
18
|
-
this.getBody = async (phone) => {
|
|
19
|
-
let parsedPhone;
|
|
20
|
-
try {
|
|
21
|
-
parsedPhone = phoneUtil.parse(phone, 'US');
|
|
22
|
-
parsedPhone = phoneUtil.format(parsedPhone, google_libphonenumber_1.PhoneNumberFormat.E164);
|
|
23
|
-
parsedPhone = `whatsapp:${parsedPhone}`;
|
|
24
|
-
}
|
|
25
|
-
catch (error) {
|
|
26
|
-
this.tags?.push('type:invalid_phone_e164');
|
|
27
|
-
this.statsClient?.incr('actions-personas-messaging-twilio.error', 1, this.tags);
|
|
28
|
-
throw new actions_core_1.IntegrationError('The string supplied did not seem to be a phone number. Phone number must be able to be formatted to e164 for whatsapp.', `INVALID_PHONE`, 400);
|
|
29
|
-
}
|
|
30
|
-
if (!this.payload.contentSid) {
|
|
31
|
-
throw new actions_core_1.IntegrationError('A valid whatsApp Content SID was not provided.', `INVALID_CONTENT_SID`, 400);
|
|
32
|
-
}
|
|
33
|
-
const params = {
|
|
34
|
-
ContentSid: this.payload.contentSid,
|
|
35
|
-
From: this.payload.from,
|
|
36
|
-
To: parsedPhone
|
|
37
|
-
};
|
|
38
|
-
const contentVariables = await this.getVariables();
|
|
39
|
-
if (contentVariables)
|
|
40
|
-
params['ContentVariables'] = contentVariables;
|
|
41
|
-
return new URLSearchParams(params);
|
|
42
|
-
};
|
|
43
|
-
this.getTwilioBase64Token = () => Buffer.from(`${this.settings.twilioAccountSID}:${this.settings.twilioApiKeySecret}`).toString('base64');
|
|
44
|
-
this.getVariables = async () => {
|
|
45
|
-
if (!this.payload.contentVariables || !this.payload.traits)
|
|
46
|
-
return null;
|
|
47
|
-
try {
|
|
48
|
-
const profile = {
|
|
49
|
-
profile: {
|
|
50
|
-
traits: this.payload.traits
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
const mapping = {};
|
|
54
|
-
for (const [key, val] of Object.entries(this.payload.contentVariables)) {
|
|
55
|
-
mapping[key] = await Liquid.parseAndRender(val, profile);
|
|
56
|
-
}
|
|
57
|
-
return JSON.stringify(mapping);
|
|
58
|
-
}
|
|
59
|
-
catch (error) {
|
|
60
|
-
throw new actions_core_1.IntegrationError(`Unable to parse templating in content variables`, `Content variables templating parse failure`, 400);
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
exports.WhatsAppMessageSender = WhatsAppMessageSender;
|
|
66
|
-
//# sourceMappingURL=whatsapp-sender.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"whatsapp-sender.js","sourceRoot":"","sources":["../../../../src/destinations/engage-messaging-twilio/sendWhatsApp/whatsapp-sender.ts"],"names":[],"mappings":";;;AACA,uCAA6C;AAG7C,wDAAwD;AACxD,4DAAkE;AAClE,iEAA0E;AAG1E,MAAM,SAAS,GAAG,uCAAe,CAAC,WAAW,EAAE,CAAA;AAC/C,MAAM,MAAM,GAAG,IAAI,iBAAQ,EAAE,CAAA;AAE7B,MAAa,qBAAsB,SAAQ,8BAAsB;IAC/D,YACW,OAAkB,EAClB,OAAgB,EAChB,QAAkB,EAClB,WAAoC,EACpC,IAAsC;QAE/C,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,IAAI,CAAC,CAAA;QAN3C,YAAO,GAAP,OAAO,CAAW;QAClB,YAAO,GAAP,OAAO,CAAS;QAChB,aAAQ,GAAR,QAAQ,CAAU;QAClB,gBAAW,GAAX,WAAW,CAAyB;QACpC,SAAI,GAAJ,IAAI,CAAkC;QAKjD,YAAO,GAAG,KAAK,EAAE,KAAa,EAAE,EAAE;YAChC,IAAI,WAAW,CAAA;YAEf,IAAI;gBAIF,WAAW,GAAG,SAAS,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;gBAC1C,WAAW,GAAG,SAAS,CAAC,MAAM,CAAC,WAAW,EAAE,yCAAiB,CAAC,IAAI,CAAC,CAAA;gBACnE,WAAW,GAAG,YAAY,WAAW,EAAE,CAAA;aACxC;YAAC,OAAO,KAAc,EAAE;gBACvB,IAAI,CAAC,IAAI,EAAE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AC1C,KAAK,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,EAAE;oBACtE,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,MAAM,CAAC,cAAc,CAAC,GAAa,EAAE,OAAO,CAAC,CAAA;iBACnE;gBAED,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAA;aAC/B;YAAC,OAAO,KAAc,EAAE;gBACvB,MAAM,IAAI,+BAAgB,CACxB,iDAAiD,EACjD,4CAA4C,EAC5C,GAAG,CACJ,CAAA;aACF;QACH,CAAC,CAAA;IAlED,CAAC;CAmEF;AA5ED,sDA4EC"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { RequestOptions } from '@segment/actions-core';
|
|
2
|
-
import type { Settings } from '../generated-types';
|
|
3
|
-
import type { Payload } from '../sendSms/generated-types';
|
|
4
|
-
import { StatsClient, StatsContext } from '@segment/actions-core/src/destination-kit';
|
|
5
|
-
export declare type RequestFn = (url: string, options?: RequestOptions) => Promise<Response>;
|
|
6
|
-
declare type MinimalPayload = Pick<Payload, 'from' | 'toNumber' | 'customArgs' | 'externalIds' | 'traits' | 'send' | 'eventOccurredTS'>;
|
|
7
|
-
export declare abstract class MessageSender<SmsPayload extends MinimalPayload> {
|
|
8
|
-
readonly request: RequestFn;
|
|
9
|
-
readonly payload: SmsPayload;
|
|
10
|
-
readonly settings: Settings;
|
|
11
|
-
readonly statsClient: StatsClient | undefined;
|
|
12
|
-
readonly tags: StatsContext['tags'] | undefined;
|
|
13
|
-
private readonly EXTERNAL_ID_KEY;
|
|
14
|
-
private readonly DEFAULT_HOSTNAME;
|
|
15
|
-
private readonly DEFAULT_CONNECTION_OVERRIDES;
|
|
16
|
-
constructor(request: RequestFn, payload: SmsPayload, settings: Settings, statsClient: StatsClient | undefined, tags: StatsContext['tags'] | undefined);
|
|
17
|
-
send: () => Promise<Response | undefined>;
|
|
18
|
-
abstract getBody: (phone: string) => Promise<URLSearchParams>;
|
|
19
|
-
abstract getTwilioBase64Token: () => string;
|
|
20
|
-
private getSendabilityPayload;
|
|
21
|
-
private getWebhookUrlWithParams;
|
|
22
|
-
}
|
|
23
|
-
export {};
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MessageSender = void 0;
|
|
4
|
-
const actions_core_1 = require("@segment/actions-core");
|
|
5
|
-
var SendabilityStatus;
|
|
6
|
-
(function (SendabilityStatus) {
|
|
7
|
-
SendabilityStatus["NoSenderPhone"] = "no_sender_phone";
|
|
8
|
-
SendabilityStatus["ShouldSend"] = "should_send";
|
|
9
|
-
SendabilityStatus["DoNotSend"] = "do_not_send";
|
|
10
|
-
SendabilityStatus["SendDisabled"] = "send_disabled";
|
|
11
|
-
SendabilityStatus["InvalidSubscriptionStatus"] = "invalid_subscription_status";
|
|
12
|
-
})(SendabilityStatus || (SendabilityStatus = {}));
|
|
13
|
-
class MessageSender {
|
|
14
|
-
constructor(request, payload, settings, statsClient, tags) {
|
|
15
|
-
this.request = request;
|
|
16
|
-
this.payload = payload;
|
|
17
|
-
this.settings = settings;
|
|
18
|
-
this.statsClient = statsClient;
|
|
19
|
-
this.tags = tags;
|
|
20
|
-
this.EXTERNAL_ID_KEY = 'phone';
|
|
21
|
-
this.DEFAULT_HOSTNAME = 'api.twilio.com';
|
|
22
|
-
this.DEFAULT_CONNECTION_OVERRIDES = 'rp=all&rc=5';
|
|
23
|
-
this.send = async () => {
|
|
24
|
-
const { phone, sendabilityStatus } = this.getSendabilityPayload();
|
|
25
|
-
if (sendabilityStatus !== SendabilityStatus.ShouldSend || !phone) {
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
const body = await this.getBody(phone);
|
|
29
|
-
const webhookUrlWithParams = this.getWebhookUrlWithParams(phone);
|
|
30
|
-
if (webhookUrlWithParams)
|
|
31
|
-
body.append('StatusCallback', webhookUrlWithParams);
|
|
32
|
-
const twilioHostname = this.settings.twilioHostname ?? this.DEFAULT_HOSTNAME;
|
|
33
|
-
const twilioToken = this.getTwilioBase64Token();
|
|
34
|
-
const response = await this.request(`https://${twilioHostname}/2010-04-01/Accounts/${this.settings.twilioAccountSID}/Messages.json`, {
|
|
35
|
-
method: 'POST',
|
|
36
|
-
headers: {
|
|
37
|
-
authorization: `Basic ${twilioToken}`
|
|
38
|
-
},
|
|
39
|
-
body
|
|
40
|
-
});
|
|
41
|
-
this.tags?.push(`twilio_status_code:${response.status}`);
|
|
42
|
-
this.statsClient?.incr('actions-personas-messaging-twilio.response', 1, this.tags);
|
|
43
|
-
if (this.payload.eventOccurredTS != undefined) {
|
|
44
|
-
this.statsClient?.histogram('actions-personas-messaging-twilio.eventDeliveryTS', Date.now() - new Date(this.payload.eventOccurredTS).getTime(), this.tags);
|
|
45
|
-
}
|
|
46
|
-
return response;
|
|
47
|
-
};
|
|
48
|
-
this.getSendabilityPayload = () => {
|
|
49
|
-
const nonSendableStatuses = ['unsubscribed', 'did not subscribed', 'false'];
|
|
50
|
-
const sendableStatuses = ['subscribed', 'true'];
|
|
51
|
-
const externalId = this.payload.externalIds?.find(({ type }) => type === 'phone');
|
|
52
|
-
let status;
|
|
53
|
-
if (!this.payload.send) {
|
|
54
|
-
this.statsClient?.incr('actions-personas-messaging-twilio.send-disabled', 1, this.tags);
|
|
55
|
-
return { sendabilityStatus: SendabilityStatus.SendDisabled, phone: undefined };
|
|
56
|
-
}
|
|
57
|
-
if (!externalId?.subscriptionStatus || nonSendableStatuses.includes(externalId.subscriptionStatus)) {
|
|
58
|
-
this.statsClient?.incr('actions-personas-messaging-twilio.notsubscribed', 1, this.tags);
|
|
59
|
-
status = SendabilityStatus.DoNotSend;
|
|
60
|
-
}
|
|
61
|
-
else if (sendableStatuses.includes(externalId.subscriptionStatus)) {
|
|
62
|
-
this.statsClient?.incr('actions-personas-messaging-twilio.subscribed', 1, this.tags);
|
|
63
|
-
status = SendabilityStatus.ShouldSend;
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
this.statsClient?.incr('actions-personas-messaging-twilio.twilio-error', 1, this.tags);
|
|
67
|
-
throw new actions_core_1.IntegrationError(`Failed to recognize the subscriptionStatus in the payload: "${externalId.subscriptionStatus}".`, 'Invalid subscriptionStatus value', 400);
|
|
68
|
-
}
|
|
69
|
-
const phone = this.payload.toNumber || externalId?.id;
|
|
70
|
-
if (!phone) {
|
|
71
|
-
status = SendabilityStatus.NoSenderPhone;
|
|
72
|
-
}
|
|
73
|
-
return { sendabilityStatus: status, phone };
|
|
74
|
-
};
|
|
75
|
-
this.getWebhookUrlWithParams = (phone) => {
|
|
76
|
-
const webhookUrl = this.settings.webhookUrl;
|
|
77
|
-
const connectionOverrides = this.settings.connectionOverrides;
|
|
78
|
-
const customArgs = {
|
|
79
|
-
...this.payload.customArgs,
|
|
80
|
-
space_id: this.settings.spaceId,
|
|
81
|
-
__segment_internal_external_id_key__: this.EXTERNAL_ID_KEY,
|
|
82
|
-
__segment_internal_external_id_value__: phone
|
|
83
|
-
};
|
|
84
|
-
if (webhookUrl && customArgs) {
|
|
85
|
-
const webhookUrlWithParams = new URL(webhookUrl);
|
|
86
|
-
for (const key of Object.keys(customArgs)) {
|
|
87
|
-
webhookUrlWithParams.searchParams.append(key, String(customArgs[key]));
|
|
88
|
-
}
|
|
89
|
-
webhookUrlWithParams.hash = connectionOverrides || this.DEFAULT_CONNECTION_OVERRIDES;
|
|
90
|
-
return webhookUrlWithParams.toString();
|
|
91
|
-
}
|
|
92
|
-
return null;
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
exports.MessageSender = MessageSender;
|
|
97
|
-
//# sourceMappingURL=message-sender.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"message-sender.js","sourceRoot":"","sources":["../../../../src/destinations/engage-messaging-twilio/utils/message-sender.ts"],"names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