@segment/action-destinations 3.174.1-CONMAN-443.7 → 3.177.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/destinations/acoustic/Utility/eventprocessing.js +4 -3
- package/dist/destinations/acoustic/Utility/eventprocessing.js.map +1 -1
- package/dist/destinations/acoustic/Utility/tablemaintutilities.d.ts +0 -5
- package/dist/destinations/acoustic/Utility/tablemaintutilities.js +11 -121
- package/dist/destinations/acoustic/Utility/tablemaintutilities.js.map +1 -1
- package/dist/destinations/acoustic/receiveEvents/index.js +2 -3
- package/dist/destinations/acoustic/receiveEvents/index.js.map +1 -1
- package/dist/destinations/algolia-insights/algolia-insight-api.d.ts +1 -1
- package/dist/destinations/algolia-insights/conversionEvents/generated-types.d.ts +1 -1
- package/dist/destinations/algolia-insights/conversionEvents/index.js +2 -2
- package/dist/destinations/algolia-insights/conversionEvents/index.js.map +1 -1
- package/dist/destinations/algolia-insights/productClickedEvents/generated-types.d.ts +1 -1
- package/dist/destinations/algolia-insights/productClickedEvents/index.js +1 -1
- package/dist/destinations/algolia-insights/productClickedEvents/index.js.map +1 -1
- package/dist/destinations/algolia-insights/productViewedEvents/generated-types.d.ts +1 -1
- package/dist/destinations/algolia-insights/productViewedEvents/index.js +2 -2
- package/dist/destinations/algolia-insights/productViewedEvents/index.js.map +1 -1
- package/dist/destinations/blackbaud-raisers-edge-nxt/index.js +1 -0
- package/dist/destinations/blackbaud-raisers-edge-nxt/index.js.map +1 -1
- package/dist/destinations/engage-messaging-sendgrid/sendEmail/generated-types.d.ts +0 -3
- package/dist/destinations/engage-messaging-sendgrid/sendEmail/index.js +1 -44
- package/dist/destinations/engage-messaging-sendgrid/sendEmail/index.js.map +1 -1
- package/dist/destinations/engage-messaging-twilio/sendMobilePush/index.js +1 -8
- package/dist/destinations/engage-messaging-twilio/sendMobilePush/index.js.map +1 -1
- package/dist/destinations/engage-messaging-twilio/sendMobilePush/push-sender.js +8 -8
- package/dist/destinations/engage-messaging-twilio/sendMobilePush/push-sender.js.map +1 -1
- package/dist/destinations/engage-messaging-twilio/sendSms/index.js +1 -8
- package/dist/destinations/engage-messaging-twilio/sendSms/index.js.map +1 -1
- package/dist/destinations/engage-messaging-twilio/sendSms/sms-sender.js +2 -2
- package/dist/destinations/engage-messaging-twilio/sendSms/sms-sender.js.map +1 -1
- package/dist/destinations/engage-messaging-twilio/sendWhatsApp/index.js +1 -8
- package/dist/destinations/engage-messaging-twilio/sendWhatsApp/index.js.map +1 -1
- package/dist/destinations/engage-messaging-twilio/sendWhatsApp/whatsapp-sender.js +1 -1
- package/dist/destinations/engage-messaging-twilio/sendWhatsApp/whatsapp-sender.js.map +1 -1
- package/dist/destinations/engage-messaging-twilio/utils/message-sender.d.ts +50 -11
- package/dist/destinations/engage-messaging-twilio/utils/message-sender.js +152 -44
- package/dist/destinations/engage-messaging-twilio/utils/message-sender.js.map +1 -1
- package/dist/destinations/engage-messaging-twilio/utils/phone-message.js +8 -8
- package/dist/destinations/engage-messaging-twilio/utils/phone-message.js.map +1 -1
- package/dist/destinations/index.js +2 -0
- package/dist/destinations/index.js.map +1 -1
- package/dist/destinations/iqm/generated-types.d.ts +3 -0
- package/dist/destinations/iqm/generated-types.js +3 -0
- package/dist/destinations/iqm/generated-types.js.map +1 -0
- package/dist/destinations/iqm/index.d.ts +5 -0
- package/dist/destinations/iqm/index.js +47 -0
- package/dist/destinations/iqm/index.js.map +1 -0
- package/dist/destinations/iqm/postEvent/generated-types.d.ts +5 -0
- package/dist/destinations/iqm/postEvent/generated-types.js +3 -0
- package/dist/destinations/iqm/postEvent/generated-types.js.map +1 -0
- package/dist/destinations/iqm/postEvent/index.d.ts +5 -0
- package/dist/destinations/iqm/postEvent/index.js +29 -0
- package/dist/destinations/iqm/postEvent/index.js.map +1 -0
- package/dist/destinations/iterable/index.js +1 -1
- package/dist/destinations/iterable/index.js.map +1 -1
- package/dist/destinations/playerzero-cloud/generated-types.d.ts +3 -0
- package/dist/destinations/playerzero-cloud/generated-types.js +3 -0
- package/dist/destinations/playerzero-cloud/generated-types.js.map +1 -0
- package/dist/destinations/playerzero-cloud/identifyUser/generated-types.d.ts +2 -0
- package/dist/destinations/playerzero-cloud/identifyUser/generated-types.js +3 -0
- package/dist/destinations/playerzero-cloud/identifyUser/generated-types.js.map +1 -0
- package/dist/destinations/playerzero-cloud/identifyUser/index.d.ts +4 -0
- package/dist/destinations/playerzero-cloud/identifyUser/index.js +16 -0
- package/dist/destinations/playerzero-cloud/identifyUser/index.js.map +1 -0
- package/dist/destinations/playerzero-cloud/index.d.ts +4 -0
- package/dist/destinations/playerzero-cloud/index.js +45 -0
- package/dist/destinations/playerzero-cloud/index.js.map +1 -0
- package/dist/destinations/playerzero-cloud/trackEvent/generated-types.d.ts +2 -0
- package/dist/destinations/playerzero-cloud/trackEvent/generated-types.js +3 -0
- package/dist/destinations/playerzero-cloud/trackEvent/generated-types.js.map +1 -0
- package/dist/destinations/playerzero-cloud/trackEvent/index.d.ts +4 -0
- package/dist/destinations/playerzero-cloud/trackEvent/index.js +16 -0
- package/dist/destinations/playerzero-cloud/trackEvent/index.js.map +1 -0
- package/dist/destinations/playerzero-cloud/util.d.ts +4 -0
- package/dist/destinations/playerzero-cloud/util.js +14 -0
- package/dist/destinations/playerzero-cloud/util.js.map +1 -0
- package/dist/lib/engage-test-data/create-messaging-test-event.d.ts +0 -3
- package/dist/lib/engage-test-data/create-messaging-test-event.js +2 -5
- package/dist/lib/engage-test-data/create-messaging-test-event.js.map +1 -1
- package/package.json +9 -4
- package/dist/destinations/engage-messaging-twilio/utils/test-utils.d.ts +0 -37
- package/dist/destinations/engage-messaging-twilio/utils/test-utils.js +0 -35
- package/dist/destinations/engage-messaging-twilio/utils/test-utils.js.map +0 -1
|
@@ -19,17 +19,17 @@ class PushSender extends message_sender_1.MessageSender {
|
|
|
19
19
|
async doSend() {
|
|
20
20
|
if (!this.payload.send) {
|
|
21
21
|
this.logInfo(`not sending push notification, payload.send = ${this.payload.send} - ${this.settings.spaceId}`);
|
|
22
|
-
this.
|
|
22
|
+
this.stats('incr', 'send_disabled', 1);
|
|
23
23
|
return;
|
|
24
24
|
}
|
|
25
25
|
const allPushDevices = this.payload.externalIds?.filter((extId) => extId.type && PushSender.externalIdTypes.includes(extId.type)) || [];
|
|
26
26
|
const recipientDevices = allPushDevices?.filter((extId) => extId.subscriptionStatus && message_sender_1.MessageSender.sendableStatuses.includes(extId.subscriptionStatus?.toLowerCase())) || [];
|
|
27
27
|
if (recipientDevices.length) {
|
|
28
|
-
this.
|
|
28
|
+
this.stats('incr', 'subscribed', 1);
|
|
29
29
|
}
|
|
30
30
|
const totalUnsubscribed = allPushDevices.length - recipientDevices.length;
|
|
31
31
|
if (totalUnsubscribed > 0) {
|
|
32
|
-
this.
|
|
32
|
+
this.stats('incr', 'notsubscribed', totalUnsubscribed);
|
|
33
33
|
}
|
|
34
34
|
if (!recipientDevices?.length) {
|
|
35
35
|
this.logInfo(`not sending push notification, no devices are subscribed - ${this.settings.spaceId}`);
|
|
@@ -63,7 +63,7 @@ class PushSender extends message_sender_1.MessageSender {
|
|
|
63
63
|
if (webhookUrl) {
|
|
64
64
|
body.append('DeliveryCallbackUrl', webhookUrl);
|
|
65
65
|
}
|
|
66
|
-
this.
|
|
66
|
+
this.stats('set', 'message_body_size', body?.toString().length);
|
|
67
67
|
const response = await this.request(`https://${twilioHostname}/v1/Services/${this.payload.from}/Notifications`, {
|
|
68
68
|
method: 'POST',
|
|
69
69
|
headers: {
|
|
@@ -72,7 +72,7 @@ class PushSender extends message_sender_1.MessageSender {
|
|
|
72
72
|
body
|
|
73
73
|
});
|
|
74
74
|
this.tags.push(`twilio_status_code:${response.status}`);
|
|
75
|
-
this.
|
|
75
|
+
this.stats('incr', 'response', 1);
|
|
76
76
|
responses.push(response);
|
|
77
77
|
}
|
|
78
78
|
catch (error) {
|
|
@@ -87,7 +87,7 @@ class PushSender extends message_sender_1.MessageSender {
|
|
|
87
87
|
}
|
|
88
88
|
failedSends.push({ ...recipientDevice, id: this.redactPii(recipientDevice.id) });
|
|
89
89
|
this.logDetails['failed-recipient-devices'] = failedSends;
|
|
90
|
-
this.
|
|
90
|
+
this.getRethrowableError(error, 'Twilio Push API');
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
if (failedSends.length === recipientDevices.length) {
|
|
@@ -100,7 +100,7 @@ class PushSender extends message_sender_1.MessageSender {
|
|
|
100
100
|
this.tags.push(`total_succeeded:${recipientDevices.length - failedSends.length}`);
|
|
101
101
|
this.tags.push(`total_failed:${failedSends.length}`);
|
|
102
102
|
if (this.payload.eventOccurredTS != undefined) {
|
|
103
|
-
this.
|
|
103
|
+
this.stats('histogram', 'eventDeliveryTS', Date.now() - new Date(this.payload.eventOccurredTS).getTime());
|
|
104
104
|
}
|
|
105
105
|
return responses;
|
|
106
106
|
}
|
|
@@ -154,7 +154,7 @@ class PushSender extends message_sender_1.MessageSender {
|
|
|
154
154
|
}
|
|
155
155
|
catch (error) {
|
|
156
156
|
this.tags.push('reason:invalid_payload');
|
|
157
|
-
this.
|
|
157
|
+
this.stats('incr', 'error', 1);
|
|
158
158
|
this.logError(`unable to construct Notify API request body - ${this.settings.spaceId}`, JSON.stringify(error));
|
|
159
159
|
throw new actions_core_2.PayloadValidationError('Unable to construct Notify API request body');
|
|
160
160
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"push-sender.js","sourceRoot":"","sources":["../../../../src/destinations/engage-messaging-twilio/sendMobilePush/push-sender.ts"],"names":[],"mappings":";;;AACA,wDAAmF;AACnF,4DAAuD;AAGvD,wDAA8D;AAU9D,MAAM,YAAa,SAAQ,wBAAS;CAQnC;AAED,MAAa,UAAwC,SAAQ,8BAAsB;IAAnF;;QAEY,2BAAsB,GAAa,CAAC,aAAa,EAAE,cAAc,CAAC,CAAA;QACpE,yBAAoB,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;QACjC,qBAAgB,GAAG,6BAA6B,CAAA;
|
|
1
|
+
{"version":3,"file":"push-sender.js","sourceRoot":"","sources":["../../../../src/destinations/engage-messaging-twilio/sendMobilePush/push-sender.ts"],"names":[],"mappings":";;;AACA,wDAAmF;AACnF,4DAAuD;AAGvD,wDAA8D;AAU9D,MAAM,YAAa,SAAQ,wBAAS;CAQnC;AAED,MAAa,UAAwC,SAAQ,8BAAsB;IAAnF;;QAEY,2BAAsB,GAAa,CAAC,aAAa,EAAE,cAAc,CAAC,CAAA;QACpE,yBAAoB,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;QACjC,qBAAgB,GAAG,6BAA6B,CAAA;IAoO1D,CAAC;IAlOC,cAAc;QACZ,OAAO,YAAY,CAAA;IACrB,CAAC;IAED,KAAK,CAAC,MAAM;QACV,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE;YACtB,IAAI,CAAC,OAAO,CAAC,iDAAiD,IAAI,CAAC,OAAO,CAAC,IAAI,MAAM,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAA;YAC7G,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,eAAe,EAAE,CAAC,CAAC,CAAA;YACtC,OAAM;SACP;QAED,MAAM,cAAc,GAClB,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,IAAI,UAAU,CAAC,eAAe,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAA;QAClH,MAAM,gBAAgB,GACpB,cAAc,EAAE,MAAM,CACpB,CAAC,KAAK,EAAE,EAAE,CACR,KAAK,CAAC,kBAAkB,IAAI,8BAAa,CAAC,gBAAgB,CAAC,QAAQ,CAAC,KAAK,CAAC,kBAAkB,EAAE,WAAW,EAAE,CAAC,CAC/G,IAAI,EAAE,CAAA;QAET,IAAI,gBAAgB,CAAC,MAAM,EAAE;YAC3B,IAAI,CAAC,KAA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AM,EAAE,OAAO,EAAE,CAAC,CAAC,CAAA;YAC9B,IAAI,CAAC,QAAQ,CAAC,iDAAiD,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAA;YAC9G,MAAM,IAAI,qCAAsB,CAAC,6CAA6C,CAAC,CAAA;SAChF;IACH,CAAC;IAMO,aAAa,CAAC,GAA4B;QAChD,OAAO,IAAI,CAAC,KAAK,CACf,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE;YAC/B,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,EAAE,MAAM,KAAK,CAAC,IAAI,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,EAAE;gBAC1G,OAAO,SAAS,CAAA;aACjB;YACD,OAAO,KAAK,CAAA;QACd,CAAC,CAAC,CACH,CAAA;IACH,CAAC;;AAvOH,gCAwOC;AAvOiB,0BAAe,GAAG,CAAC,gBAAgB,EAAE,oBAAoB,CAAC,CAAA"}
|
|
@@ -140,14 +140,7 @@ const action = {
|
|
|
140
140
|
}
|
|
141
141
|
},
|
|
142
142
|
perform: async (request, data) => {
|
|
143
|
-
|
|
144
|
-
const statsClient = statsContext?.statsClient;
|
|
145
|
-
const tags = statsContext?.tags || [];
|
|
146
|
-
if (!settings.region) {
|
|
147
|
-
settings.region = 'us-west-1';
|
|
148
|
-
}
|
|
149
|
-
tags.push(`space_id:${settings.spaceId}`, `projectid:${settings.sourceId}`, `region:${settings.region}`, `channel:sms`);
|
|
150
|
-
return new sms_sender_1.SmsMessageSender(request, payload, settings, statsClient, tags, logger, data).send();
|
|
143
|
+
return new sms_sender_1.SmsMessageSender(request, data).send();
|
|
151
144
|
}
|
|
152
145
|
};
|
|
153
146
|
exports.default = action;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/engage-messaging-twilio/sendSms/index.ts"],"names":[],"mappings":";;AAIA,6CAA+C;AAE/C,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,UAAU;IACjB,WAAW,EAAE,uBAAuB;IACpC,mBAAmB,EAAE,+CAA+C;IACpE,MAAM,EAAE;QACN,MAAM,EAAE;YACN,KAAK,EAAE,SAAS;YAChB,WAAW,EAAE,oBAAoB;YACjC,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE;SACjC;QACD,QAAQ,EAAE;YACR,KAAK,EAAE,aAAa;YACpB,WAAW,EAAE,oCAAoC;YACjD,IAAI,EAAE,QAAQ;SACf;QACD,IAAI,EAAE;YACJ,KAAK,EAAE,MAAM;YACb,WAAW,EAAE,6EAA6E;YAC1F,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;SACf;QACD,IAAI,EAAE;YACJ,KAAK,EAAE,SAAS;YAChB,WAAW,EAAE,iBAAiB;YAC9B,IAAI,EAAE,MAAM;YACZ,QAAQ,EAAE,KAAK;SAChB;QACD,KAAK,EAAE;YACL,KAAK,EAAE,YAAY;YACnB,WAAW,EAAE,4BAA4B;YACzC,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;YACf,QAAQ,EAAE,IAAI;SACf;QACD,UAAU,EAAE;YACV,KAAK,EAAE,0BAA0B;YACjC,WAAW,EAAE,6CAA6C;YAC1D,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;SAChB;QACD,UAAU,EAAE;YACV,KAAK,EAAE,kBAAkB;YACzB,WAAW,EAAE,+EAA+E;YAC5F,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;SAChB;QACD,mBAAmB,EAAE;YACnB,KAAK,EAAE,sBAAsB;YAC7B,WAAW,EACT,8HAA8H;YAChI,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK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AAE,KAAK;YACf,OAAO,EAAE,EAAE,OAAO,EAAE,cAAc,EAAE;SACrC;QACD,eAAe,EAAE;YACf,KAAK,EAAE,iBAAiB;YACxB,WAAW,EAAE,yCAAyC;YACtD,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE;gBACP,OAAO,EAAE,aAAa;aACvB;SACF;QACD,SAAS,EAAE;YACT,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;YACf,WAAW,EAAE,uBAAuB;YACpC,KAAK,EAAE,WAAW;YAClB,OAAO,EAAE,EAAE,OAAO,EAAE,aAAa,EAAE;SACpC;KACF;IACD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;QAC/B,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/engage-messaging-twilio/sendSms/index.ts"],"names":[],"mappings":";;AAIA,6CAA+C;AAE/C,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,UAAU;IACjB,WAAW,EAAE,uBAAuB;IACpC,mBAAmB,EAAE,+CAA+C;IACpE,MAAM,EAAE;QACN,MAAM,EAAE;YACN,KAAK,EAAE,SAAS;YAChB,WAAW,EAAE,oBAAoB;YACjC,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE;SACjC;QACD,QAAQ,EAAE;YACR,KAAK,EAAE,aAAa;YACpB,WAAW,EAAE,oCAAoC;YACjD,IAAI,EAAE,QAAQ;SACf;QACD,IAAI,EAAE;YACJ,KAAK,EAAE,MAAM;YACb,WAAW,EAAE,6EAA6E;YAC1F,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;SACf;QACD,IAAI,EAAE;YACJ,KAAK,EAAE,SAAS;YAChB,WAAW,EAAE,iBAAiB;YAC9B,IAAI,EAAE,MAAM;YACZ,QAAQ,EAAE,KAAK;SAChB;QACD,KAAK,EAAE;YACL,KAAK,EAAE,Y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oBAClB,KAAK,EAAE,IAAI;oBACX,WAAW,EAAE,2CAA2C;oBACxD,IAAI,EAAE,QAAQ;iBACf;aACF;YACD,OAAO,EAAE;gBACP,YAAY,EAAE;oBACZ,gBAAgB;oBAChB;wBACE,EAAE,EAAE;4BACF,OAAO,EAAE,MAAM;yBAChB;wBACD,IAAI,EAAE;4BACJ,OAAO,EAAE,QAAQ;yBAClB;wBACD,WAAW,EAAE;4BACX,OAAO,EAAE,eAAe;yBACzB;wBACD,kBAAkB,EAAE;4BAClB,OAAO,EAAE,gBAAgB;yBAC1B;qBACF;iBACF;aACF;SACF;QACD,MAAM,EAAE;YACN,KAAK,EAAE,QAAQ;YACf,WAAW,EAAE,yBAAyB;YACtC,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE,EAAE,OAAO,EAAE,cAAc,EAAE;SACrC;QACD,eAAe,EAAE;YACf,KAAK,EAAE,iBAAiB;YACxB,WAAW,EAAE,yCAAyC;YACtD,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE;gBACP,OAAO,EAAE,aAAa;aACvB;SACF;QACD,SAAS,EAAE;YACT,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;YACf,WAAW,EAAE,uBAAuB;YACpC,KAAK,EAAE,WAAW;YAClB,OAAO,EAAE,EAAE,OAAO,EAAE,aAAa,EAAE;SACpC;KACF;IACD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;QAC/B,OAAO,IAAI,6BAAgB,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,IAAI,EAAE,CAAA;IACnD,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -74,12 +74,12 @@ class SmsMessageSender extends phone_message_1.PhoneMessage {
|
|
|
74
74
|
}
|
|
75
75
|
});
|
|
76
76
|
this.tags.push(`profile_status_code:${response.status}`);
|
|
77
|
-
this.
|
|
77
|
+
this.stats('incr', 'profile_invoked', 1);
|
|
78
78
|
const body = await response.json();
|
|
79
79
|
return body.traits;
|
|
80
80
|
}
|
|
81
81
|
catch (error) {
|
|
82
|
-
this.
|
|
82
|
+
this.stats('incr', 'profile_error', 1);
|
|
83
83
|
this.logError(`profile traits request failure - ${this.settings.spaceId} - [${error}]`);
|
|
84
84
|
throw new actions_core_1.IntegrationError('Unable to get profile traits for SMS message', 'SMS trait fetch failure', 500);
|
|
85
85
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sms-sender.js","sourceRoot":"","sources":["../../../../src/destinations/engage-messaging-twilio/sendSms/sms-sender.ts"],"names":[],"mappings":";;;AAEA,wDAAgF;AAChF,0DAAqD;AAErD,MAAa,gBAAiB,SAAQ,4BAAqB;IAA3D;;QACY,2BAAsB,GAAa,CAAC,aAAa,EAAE,cAAc,CAAC,CAAA;IA+F9E,CAAC;IA7FC,KAAK,CAAC,OAAO,CAAC,KAAa;QACzB,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE;YAClD,IAAI,CAAC,QAAQ,CAAC,qEAAqE,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAA;YAC3G,MAAM,IAAI,qCAAsB,CAAC,qEAAqE,CAAC,CAAA;SACxG;QAID,IAAI,MAAM,CAAA;QACV,IAAI,IAAI,CAAC,OAAO,CAAC,eAAe,EAAE;YAChC,MAAM,GAAG,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAA;SAC1D;aAAM;YACL,MAAM,GAAG,MAAM,IAAI,CAAC,gBAAgB,EAAE,CAAA;SACvC;QAED,MAAM,OAAO,GAAG;YACd,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,SAAS;YACzC,KAAK;YACL,MAAM;SACP,CA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,YAAY,GAAG,qBAAqB,KAAK,YAAY,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAA;YAC7E,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CACjC,WAAW,UAAU,IAAI,YAAY,cAAc,OAAO,uCAAuC,kBAAkB,CACjH,IAAI,CAAC,OAAO,CAAC,MAAM,CACpB,mBAAmB,EACpB;gBACE,OAAO,EAAE;oBACP,aAAa,EAAE,SAAS,MAAM,CAAC,IAAI,CAAC,qBAAqB,GAAG,GAAG,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE;oBACrF,cAAc,EAAE,kBAAkB;iBACnC;aACF,CACF,CAAA;YACD,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,uBAAuB,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAA;YACxD,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,iBAAiB,EAAE,CAAC,CAAC,CAAA;YACxC,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;YAClC,OAAO,IAAI,CAAC,MAAM,CAAA;SACnB;QAAC,OAAO,KAAc,EAAE;YACvB,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,eAAe,EAAE,CAAC,CAAC,CAAA;YACtC,IAAI,CAAC,QAAQ,CAAC,oCAAoC,IAAI,CAAC,QAAQ,CAAC,OAAO,OAAO,KAAK,GAAG,CAAC,CAAA;YACvF,MAAM,IAAI,+BAAgB,CAAC,8CAA8C,EAAE,yBAAyB,EAAE,GAAG,CAAC,CAAA;SAC3G;IACH,CAAC;CACF;AAhGD,4CAgGC"}
|
|
@@ -120,14 +120,7 @@ const action = {
|
|
|
120
120
|
}
|
|
121
121
|
},
|
|
122
122
|
perform: async (request, data) => {
|
|
123
|
-
|
|
124
|
-
const statsClient = statsContext?.statsClient;
|
|
125
|
-
const tags = statsContext?.tags || [];
|
|
126
|
-
if (!settings.region) {
|
|
127
|
-
settings.region = 'us-west-1';
|
|
128
|
-
}
|
|
129
|
-
tags.push(`space_id:${settings.spaceId}`, `projectid:${settings.sourceId}`, `region:${settings.region}`, `channel:whatsapp`);
|
|
130
|
-
return new whatsapp_sender_1.WhatsAppMessageSender(request, payload, settings, statsClient, tags, logger, data).send();
|
|
123
|
+
return new whatsapp_sender_1.WhatsAppMessageSender(request, data).send();
|
|
131
124
|
}
|
|
132
125
|
};
|
|
133
126
|
exports.default = action;
|
|
@@ -1 +1 @@
|
|
|
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,2CAA2C;YACxD,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;SACf;QACD,gBAAgB,EAAE;YAChB,KAAK,EAAE,6BAA6B;YACpC,WAAW,EAAE,wEAAwE;YACrF,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;SAChB;QACD,QAAQ,EAAE;YACR,KAAK,EAAE,aAAa;YACpB,WAAW,EAAE,yCAAyC;YACtD,IAAI,EAAE,QAAQ;SACf;QACD,IAAI,EAAE;YACJ,KAAK,EAAE,MAAM;YACb,WAAW,EAAE,kFAAkF;YAC/F,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;SACf;QACD,UAAU,EAAE;YACV,KAAK,EAAE,kBAAkB;YACzB,WAAW,EAAE,+EAA+E;YAC5F,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;SAChB;QACD,mBAAmB,EAAE;YACnB,KAAK,EAAE,sBAAsB;YAC7B,WAAW,EACT,8HAA8H;YAChI,IAAI,EAAE,QAAQ;YACd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AAQ;YACd,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE,EAAE,OAAO,EAAE,cAAc,EAAE;SACrC;QACD,eAAe,EAAE;YACf,KAAK,EAAE,iBAAiB;YACxB,WAAW,EAAE,yCAAyC;YACtD,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE;gBACP,OAAO,EAAE,aAAa;aACvB;SACF;KACF;IACD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;QAC/B,
|
|
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,2CAA2C;YACxD,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;SACf;QACD,gBAAgB,EAAE;YAChB,KAAK,EAAE,6BAA6B;YACpC,WAAW,EAAE,wEAAwE;YACrF,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;SAChB;QACD,QAAQ,EAAE;YACR,KAAK,EAAE,aAAa;YACpB,WAAW,EAAE,yCAAyC;YACtD,IAAI,EAAE,QAAQ;SACf;QACD,IAAI,EAAE;YACJ,KAAK,EAAE,MAAM;YACb,WAAW,EAAE,kFAAkF;YAC/F,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;SACf;QACD,UAAU,EAAE;YACV,KAAK,EAAE,kBAAkB;YACzB,WAAW,EAAE,+EAA+E;YAC5F,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;SAChB;QACD,mBAAmB,EAAE;YACnB,KAAK,EAAE,sBAAsB;YAC7B,WAAW,EACT,8HAA8H;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,yBAAyB;YACtC,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE,EAAE,OAAO,EAAE,cAAc,EAAE;SACrC;QACD,eAAe,EAAE;YACf,KAAK,EAAE,iBAAiB;YACxB,WAAW,EAAE,yCAAyC;YACtD,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE;gBACP,OAAO,EAAE,aAAa;aACvB;SACF;KACF;IACD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;QAC/B,OAAO,IAAI,uCAAqB,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,IAAI,EAAE,CAAA;IACxD,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -49,7 +49,7 @@ class WhatsAppMessageSender extends phone_message_1.PhoneMessage {
|
|
|
49
49
|
catch (error) {
|
|
50
50
|
this.tags.push('type:invalid_phone_e164');
|
|
51
51
|
this.logError(`invalid phone number - ${this.settings.spaceId} - [${error}]`);
|
|
52
|
-
this.
|
|
52
|
+
this.stats('incr', 'error', 1);
|
|
53
53
|
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);
|
|
54
54
|
}
|
|
55
55
|
if (!this.payload.contentSid) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"whatsapp-sender.js","sourceRoot":"","sources":["../../../../src/destinations/engage-messaging-twilio/sendWhatsApp/whatsapp-sender.ts"],"names":[],"mappings":";;;AACA,uCAA6C;AAE7C,wDAAwD;AACxD,iEAA0E;AAC1E,0DAAqD;AAErD,MAAM,SAAS,GAAG,uCAAe,CAAC,WAAW,EAAE,CAAA;AAC/C,MAAM,MAAM,GAAG,IAAI,iBAAQ,EAAE,CAAA;AAE7B,MAAa,qBAAsB,SAAQ,4BAAqB;IAAhE;;QA2CU,iBAAY,GAAG,KAAK,IAA4B,EAAE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ACxH,eAAe,EACf,GAAG,CACJ,CAAA;SACF;QAED,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE;YAC5B,IAAI,CAAC,QAAQ,CAAC,mDAAmD,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAA;YACzF,MAAM,IAAI,+BAAgB,CAAC,gDAAgD,EAAE,qBAAqB,EAAE,GAAG,CAAC,CAAA;SACzG;QAED,MAAM,MAAM,GAA2B;YACrC,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,UAAU;YACnC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI;YACvB,EAAE,EAAE,WAAW;SAChB,CAAA;QACD,MAAM,gBAAgB,GAAG,MAAM,IAAI,CAAC,YAAY,EAAE,CAAA;QAElD,IAAI,gBAAgB;YAAE,MAAM,CAAC,kBAAkB,CAAC,GAAG,gBAAgB,CAAA;QAEnE,OAAO,IAAI,eAAe,CAAC,MAAM,CAAC,CAAA;IACpC,CAAC;CAmCF;AA5ED,sDA4EC"}
|
|
@@ -6,32 +6,71 @@ import { Logger, StatsClient, StatsContext } from '@segment/actions-core/src/des
|
|
|
6
6
|
import { ExecuteInput } from '@segment/actions-core';
|
|
7
7
|
import { ContentTemplateTypes, Profile } from './types';
|
|
8
8
|
export declare type RequestFn = (url: string, options?: RequestOptions) => Promise<Response>;
|
|
9
|
+
declare type StatsMethod = keyof Pick<StatsClient, 'incr' | 'histogram' | 'set'>;
|
|
10
|
+
export declare const FLAGON_NAME_LOG_INFO = "engage-messaging-log-info";
|
|
11
|
+
export declare const FLAGON_NAME_LOG_ERROR = "engage-messaging-log-error";
|
|
9
12
|
export declare abstract class MessageSender<MessagePayload extends SmsPayload | WhatsappPayload> {
|
|
10
13
|
readonly request: RequestFn;
|
|
11
|
-
readonly payload: MessagePayload;
|
|
12
|
-
readonly settings: Settings;
|
|
13
|
-
readonly statsClient: StatsClient | undefined;
|
|
14
|
-
readonly tags: StatsContext['tags'];
|
|
15
|
-
readonly logger: Logger | undefined;
|
|
16
14
|
readonly executeInput: ExecuteInput<Settings, MessagePayload>;
|
|
17
15
|
readonly logDetails: Record<string, unknown>;
|
|
18
16
|
static readonly nonSendableStatuses: string[];
|
|
19
17
|
static readonly sendableStatuses: string[];
|
|
20
18
|
protected readonly supportedTemplateTypes: string[];
|
|
21
|
-
|
|
19
|
+
readonly payload: MessagePayload;
|
|
20
|
+
readonly settings: Settings;
|
|
21
|
+
readonly statsClient: StatsClient | undefined;
|
|
22
|
+
readonly tags: StatsContext['tags'];
|
|
23
|
+
readonly logger: Logger | undefined;
|
|
24
|
+
constructor(request: RequestFn, executeInput: ExecuteInput<Settings, MessagePayload>, logDetails?: Record<string, unknown>);
|
|
22
25
|
abstract getChannelType(): string;
|
|
23
26
|
abstract doSend(): Promise<Response | Response[] | object[] | undefined>;
|
|
24
27
|
send(): Promise<Response | object[] | Response[] | undefined>;
|
|
25
28
|
parseContent<R extends Record<string, string | string[] | undefined>>(content: R, profile: Profile): Promise<R>;
|
|
26
29
|
redactPii(pii: string | undefined): string | undefined;
|
|
30
|
+
isFeatureActive(featureName: string, getDefault?: () => boolean): boolean | undefined;
|
|
27
31
|
logInfo(...msgs: string[]): void;
|
|
28
32
|
logError(error?: any, ...msgs: string[]): void;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
33
|
+
stats<TStatsMethod extends StatsMethod>(args: StatsArgs<TStatsMethod>): void;
|
|
34
|
+
stats<TStatsMethod extends StatsMethod>(statsMethod: TStatsMethod, metric: string, value: number, extraTags?: string[]): void;
|
|
35
|
+
statsIncrement(metric: string, value?: number, extraTags?: string[]): void;
|
|
36
|
+
statsHistogram(metric: string, value: number, extraTags?: string[]): void;
|
|
37
|
+
statsSet(metric: string, value: number, extraTags?: string[]): void;
|
|
38
|
+
logWrap<R = void>(fn: () => R, args: {
|
|
39
|
+
operationName: string;
|
|
40
|
+
stats?: {
|
|
41
|
+
onStart?: () => StatsArgs[] | undefined;
|
|
42
|
+
onEnd?: (args: {
|
|
43
|
+
result?: Awaited<R>;
|
|
44
|
+
error?: unknown;
|
|
45
|
+
duration: number;
|
|
46
|
+
}) => StatsArgs[] | undefined;
|
|
47
|
+
};
|
|
48
|
+
}): R;
|
|
49
|
+
beforeSend(): void;
|
|
32
50
|
getContentTemplateTypes(): Promise<ContentTemplateTypes>;
|
|
33
51
|
private extractTemplateTypes;
|
|
34
52
|
getWebhookUrlWithParams(externalIdType?: string, externalIdValue?: string, defaultConnectionOverrides?: string): string | null;
|
|
35
|
-
|
|
36
|
-
|
|
53
|
+
getRethrowableError(error: unknown, apiName?: string): unknown;
|
|
54
|
+
rethrowError(error: unknown, apiName?: string): void;
|
|
37
55
|
}
|
|
56
|
+
export declare function wrapPromisable<T>(fn: () => T, args: {
|
|
57
|
+
onStart?(): void;
|
|
58
|
+
onSuccess?(res: Awaited<T>): void;
|
|
59
|
+
onCatch?(error: unknown): Awaited<T>;
|
|
60
|
+
onFinally?(res: {
|
|
61
|
+
result: Awaited<T>;
|
|
62
|
+
} | {
|
|
63
|
+
error: unknown;
|
|
64
|
+
}): void;
|
|
65
|
+
}): T;
|
|
66
|
+
declare type Awaited<T> = T extends null | undefined ? T : T extends object & {
|
|
67
|
+
then(onfulfilled: infer F, ...args: infer _): any;
|
|
68
|
+
} ? F extends (value: infer V, ...args: infer _) => any ? Awaited<V> : never : T;
|
|
69
|
+
declare type StatsArgs<TStatsMethod extends StatsMethod = StatsMethod> = {
|
|
70
|
+
method?: TStatsMethod;
|
|
71
|
+
metric: string;
|
|
72
|
+
value?: number;
|
|
73
|
+
extraTags?: string[];
|
|
74
|
+
};
|
|
75
|
+
export declare function isDestinationActionService(): boolean;
|
|
76
|
+
export {};
|
|
@@ -1,25 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MessageSender = void 0;
|
|
3
|
+
exports.isDestinationActionService = exports.wrapPromisable = exports.MessageSender = exports.FLAGON_NAME_LOG_ERROR = exports.FLAGON_NAME_LOG_INFO = void 0;
|
|
4
4
|
const liquidjs_1 = require("liquidjs");
|
|
5
5
|
const actions_core_1 = require("@segment/actions-core");
|
|
6
6
|
const Liquid = new liquidjs_1.Liquid();
|
|
7
|
+
exports.FLAGON_NAME_LOG_INFO = 'engage-messaging-log-info';
|
|
8
|
+
exports.FLAGON_NAME_LOG_ERROR = 'engage-messaging-log-error';
|
|
7
9
|
class MessageSender {
|
|
8
|
-
constructor(request,
|
|
10
|
+
constructor(request, executeInput, logDetails = {}) {
|
|
9
11
|
this.request = request;
|
|
10
|
-
this.payload = payload;
|
|
11
|
-
this.settings = settings;
|
|
12
|
-
this.statsClient = statsClient;
|
|
13
|
-
this.tags = tags;
|
|
14
|
-
this.logger = logger;
|
|
15
12
|
this.executeInput = executeInput;
|
|
16
13
|
this.logDetails = logDetails;
|
|
14
|
+
this.payload = executeInput.payload;
|
|
15
|
+
this.settings = executeInput.settings;
|
|
16
|
+
this.statsClient = executeInput.statsContext?.statsClient;
|
|
17
|
+
this.tags = executeInput.statsContext?.tags ?? [];
|
|
18
|
+
if (!this.settings.region) {
|
|
19
|
+
this.settings.region = 'us-west-1';
|
|
20
|
+
}
|
|
21
|
+
this.tags.push(`space_id:${this.settings.spaceId}`, `projectid:${this.settings.sourceId}`, `region:${this.settings.region}`, `channel:${this.getChannelType()}`);
|
|
22
|
+
this.logger = executeInput.logger;
|
|
17
23
|
}
|
|
18
24
|
async send() {
|
|
19
|
-
this.
|
|
20
|
-
this.
|
|
21
|
-
|
|
22
|
-
|
|
25
|
+
this.beforeSend();
|
|
26
|
+
return this.logWrap(this.doSend.bind(this), {
|
|
27
|
+
operationName: 'Destination Action',
|
|
28
|
+
stats: {
|
|
29
|
+
onStart: () => [{ metric: 'destination_action_start' }],
|
|
30
|
+
onEnd: (r) => [
|
|
31
|
+
{ metric: 'destination_action_end', extraTags: r.error ? ['error:true', 'reason:' + r.error] : undefined }
|
|
32
|
+
]
|
|
33
|
+
}
|
|
34
|
+
});
|
|
23
35
|
}
|
|
24
36
|
async parseContent(content, profile) {
|
|
25
37
|
try {
|
|
@@ -41,7 +53,7 @@ class MessageSender {
|
|
|
41
53
|
this.logDetails['error'] = error instanceof Error ? error.message : error?.toString();
|
|
42
54
|
this.logError(`unable to parse templating - ${this.settings.spaceId}`);
|
|
43
55
|
this.tags.push('reason:invalid_liquid');
|
|
44
|
-
this.
|
|
56
|
+
this.stats('incr', 'error', 1);
|
|
45
57
|
throw new actions_core_1.PayloadValidationError(`Unable to parse templating in ${this.getChannelType()}`);
|
|
46
58
|
}
|
|
47
59
|
}
|
|
@@ -54,11 +66,22 @@ class MessageSender {
|
|
|
54
66
|
}
|
|
55
67
|
return pii.substring(0, 3) + '***' + pii.substring(pii.length - 3);
|
|
56
68
|
}
|
|
69
|
+
isFeatureActive(featureName, getDefault) {
|
|
70
|
+
if (isDestinationActionService())
|
|
71
|
+
return true;
|
|
72
|
+
if (!this.executeInput.features || !(featureName in this.executeInput.features))
|
|
73
|
+
return getDefault?.();
|
|
74
|
+
return this.executeInput.features[featureName];
|
|
75
|
+
}
|
|
57
76
|
logInfo(...msgs) {
|
|
77
|
+
if (!this.isFeatureActive(exports.FLAGON_NAME_LOG_INFO, () => false))
|
|
78
|
+
return;
|
|
58
79
|
const [firstMsg, ...rest] = msgs;
|
|
59
80
|
this.logger?.info(`TE Messaging: ${this.getChannelType().toUpperCase()} ${firstMsg}`, ...rest, JSON.stringify(this.logDetails));
|
|
60
81
|
}
|
|
61
82
|
logError(error, ...msgs) {
|
|
83
|
+
if (!this.isFeatureActive(exports.FLAGON_NAME_LOG_ERROR, () => false))
|
|
84
|
+
return;
|
|
62
85
|
const [firstMsg, ...rest] = msgs;
|
|
63
86
|
if (typeof error === 'string') {
|
|
64
87
|
this.logger?.error(`TE Messaging: ${this.getChannelType().toUpperCase()} ${error}`, ...msgs, JSON.stringify(this.logDetails));
|
|
@@ -67,35 +90,74 @@ class MessageSender {
|
|
|
67
90
|
this.logger?.error(`TE Messaging: ${this.getChannelType().toUpperCase()} ${firstMsg}`, ...rest, error instanceof Error ? error.message : error?.toString(), JSON.stringify(this.logDetails));
|
|
68
91
|
}
|
|
69
92
|
}
|
|
70
|
-
|
|
71
|
-
|
|
93
|
+
stats(...args) {
|
|
94
|
+
if (!this.statsClient)
|
|
95
|
+
return;
|
|
96
|
+
const statsArgs = args[0];
|
|
97
|
+
const [statsMethod, metric, value, extraTags] = statsArgs instanceof Object
|
|
98
|
+
? [statsArgs.method, statsArgs.metric, statsArgs.value, statsArgs.extraTags]
|
|
99
|
+
: args;
|
|
100
|
+
let statsFunc = this.statsClient?.[statsMethod || 'incr'].bind(this.statsClient);
|
|
101
|
+
if (!statsFunc)
|
|
102
|
+
switch (statsMethod ||
|
|
103
|
+
'incr') {
|
|
104
|
+
case 'incr':
|
|
105
|
+
statsFunc = this.statsClient?.incr.bind(this.statsClient);
|
|
106
|
+
break;
|
|
107
|
+
break;
|
|
108
|
+
case 'histogram':
|
|
109
|
+
statsFunc = this.statsClient?.histogram.bind(this.statsClient);
|
|
110
|
+
break;
|
|
111
|
+
break;
|
|
112
|
+
case 'set':
|
|
113
|
+
statsFunc = this.statsClient?.set.bind(this.statsClient);
|
|
114
|
+
break;
|
|
115
|
+
break;
|
|
116
|
+
default:
|
|
117
|
+
break;
|
|
118
|
+
}
|
|
119
|
+
statsFunc?.(`actions_personas_messaging_twilio.${metric}`, typeof value === 'undefined' ? 1 : value, [
|
|
120
|
+
...this.tags,
|
|
121
|
+
...(extraTags ?? [])
|
|
122
|
+
]);
|
|
72
123
|
}
|
|
73
|
-
|
|
74
|
-
this.
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
124
|
+
statsIncrement(metric, value, extraTags) {
|
|
125
|
+
this.stats({ method: 'incr', metric, value, extraTags });
|
|
126
|
+
}
|
|
127
|
+
statsHistogram(metric, value, extraTags) {
|
|
128
|
+
this.stats({ method: 'histogram', metric, value, extraTags });
|
|
129
|
+
}
|
|
130
|
+
statsSet(metric, value, extraTags) {
|
|
131
|
+
this.stats({ method: 'set', metric, value, extraTags });
|
|
132
|
+
}
|
|
133
|
+
logWrap(fn, args) {
|
|
134
|
+
const start = Date.now();
|
|
135
|
+
return wrapPromisable(fn, {
|
|
136
|
+
onStart: () => {
|
|
137
|
+
this.logInfo('Starting: ', args.operationName);
|
|
138
|
+
const statsStart = args.stats?.onStart?.();
|
|
139
|
+
if (statsStart)
|
|
140
|
+
for (const statsArgs of statsStart) {
|
|
141
|
+
this.stats(statsArgs);
|
|
83
142
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
143
|
+
},
|
|
144
|
+
onFinally: (fin) => {
|
|
145
|
+
const duration = Date.now() - start;
|
|
146
|
+
if ('result' in fin) {
|
|
147
|
+
this.logInfo('Success: ', args.operationName, `Duration: ${duration} ms`);
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
this.logError(fin.error, 'Failed: ', args.operationName, `Duration: ${duration} ms`);
|
|
151
|
+
}
|
|
152
|
+
const statsEnd = args.stats?.onEnd?.({ ...fin, duration });
|
|
153
|
+
if (statsEnd)
|
|
154
|
+
for (const statsArgs of statsEnd) {
|
|
155
|
+
this.stats(statsArgs);
|
|
87
156
|
}
|
|
88
|
-
})();
|
|
89
157
|
}
|
|
90
|
-
|
|
91
|
-
return res;
|
|
92
|
-
}
|
|
93
|
-
catch (error) {
|
|
94
|
-
this.logError(error, 'Failed: ', ...messages);
|
|
95
|
-
throw error;
|
|
96
|
-
}
|
|
158
|
+
});
|
|
97
159
|
}
|
|
98
|
-
|
|
160
|
+
beforeSend() {
|
|
99
161
|
Object.assign(this.logDetails, {
|
|
100
162
|
externalIds: this.payload.externalIds?.map((eid) => ({ ...eid, id: this.redactPii(eid.id) })),
|
|
101
163
|
shouldSend: this.payload.send,
|
|
@@ -127,7 +189,7 @@ class MessageSender {
|
|
|
127
189
|
}
|
|
128
190
|
catch (error) {
|
|
129
191
|
this.tags.push('reason:get_content_template');
|
|
130
|
-
this.
|
|
192
|
+
this.stats('incr', 'error', 1);
|
|
131
193
|
this.logError(`failed request to fetch content template from Twilio Content API - ${this.settings.spaceId} - ${error}, ${JSON.stringify(error)})}`);
|
|
132
194
|
throw new actions_core_1.IntegrationError('Unable to fetch content template', 'Twilio Content API request failure', 500);
|
|
133
195
|
}
|
|
@@ -137,7 +199,7 @@ class MessageSender {
|
|
|
137
199
|
if (!template.types) {
|
|
138
200
|
this.logError(`template from Twilio Content API does not contain a template type - ${this.settings.spaceId} - [${JSON.stringify(template)}]`);
|
|
139
201
|
this.tags.push('reason:invalid_template_type');
|
|
140
|
-
this.
|
|
202
|
+
this.stats('incr', 'error', 1);
|
|
141
203
|
throw new actions_core_1.IntegrationError('Template from Twilio Content API does not contain any template types', `NO_CONTENT_TYPES`, 400);
|
|
142
204
|
}
|
|
143
205
|
const type = Object.keys(template.types)[0];
|
|
@@ -147,7 +209,7 @@ class MessageSender {
|
|
|
147
209
|
else {
|
|
148
210
|
this.logError(`unsupported content template type '${type}' - ${this.settings.spaceId}`);
|
|
149
211
|
this.tags.push('reason:invalid_template_type');
|
|
150
|
-
this.
|
|
212
|
+
this.stats('incr', 'error', 1);
|
|
151
213
|
throw new actions_core_1.IntegrationError(`Sending templates with '${type}' content type is not supported by ${this.getChannelType()}`, 'UNSUPPORTED_CONTENT_TYPE', 400);
|
|
152
214
|
}
|
|
153
215
|
}
|
|
@@ -180,7 +242,7 @@ class MessageSender {
|
|
|
180
242
|
}
|
|
181
243
|
return null;
|
|
182
244
|
}
|
|
183
|
-
|
|
245
|
+
getRethrowableError(error, apiName = 'Twilio Programmable API') {
|
|
184
246
|
let errorToRethrow = error;
|
|
185
247
|
if (error instanceof Object) {
|
|
186
248
|
const twilioApiError = error;
|
|
@@ -190,22 +252,68 @@ class MessageSender {
|
|
|
190
252
|
this.logError(`${apiName} error - ${this.settings.spaceId}`);
|
|
191
253
|
const statusCode = twilioApiError.status || twilioApiError.response?.data?.status;
|
|
192
254
|
this.tags.push(`twilio_status_code:${statusCode}`);
|
|
193
|
-
this.
|
|
255
|
+
this.stats('incr', 'response', 1);
|
|
194
256
|
if (!twilioApiError.status) {
|
|
195
257
|
errorToRethrow = new actions_core_1.IntegrationError(twilioApiError.response?.data?.message || twilioApiError.message, (twilioApiError.response?.data?.code || statusCode)?.toString() || 'Twilio Api Request Error', statusCode);
|
|
196
258
|
}
|
|
197
259
|
const errorCode = twilioApiError.response?.data?.code;
|
|
198
260
|
if (errorCode === 63018 || statusCode === 429) {
|
|
199
|
-
this.
|
|
261
|
+
this.stats('incr', 'rate_limited', 1);
|
|
200
262
|
}
|
|
201
263
|
}
|
|
202
264
|
return errorToRethrow;
|
|
203
265
|
}
|
|
204
|
-
|
|
205
|
-
throw this.
|
|
266
|
+
rethrowError(error, apiName = 'Twilio Programmable API') {
|
|
267
|
+
throw this.getRethrowableError(error, apiName);
|
|
206
268
|
}
|
|
207
269
|
}
|
|
208
270
|
exports.MessageSender = MessageSender;
|
|
209
271
|
MessageSender.nonSendableStatuses = ['unsubscribed', 'did not subscribed', 'false'];
|
|
210
272
|
MessageSender.sendableStatuses = ['subscribed', 'true'];
|
|
273
|
+
function wrapPromisable(fn, args) {
|
|
274
|
+
args.onStart?.();
|
|
275
|
+
let finallyRes = undefined;
|
|
276
|
+
try {
|
|
277
|
+
const res = fn();
|
|
278
|
+
if (isPromise(res))
|
|
279
|
+
return (async () => {
|
|
280
|
+
try {
|
|
281
|
+
const unpromiseRes = await res;
|
|
282
|
+
finallyRes = { result: unpromiseRes };
|
|
283
|
+
args.onSuccess?.(unpromiseRes);
|
|
284
|
+
return unpromiseRes;
|
|
285
|
+
}
|
|
286
|
+
catch (error) {
|
|
287
|
+
finallyRes = { error };
|
|
288
|
+
if (!args.onCatch)
|
|
289
|
+
throw error;
|
|
290
|
+
return args.onCatch(error);
|
|
291
|
+
}
|
|
292
|
+
finally {
|
|
293
|
+
args.onFinally?.(finallyRes);
|
|
294
|
+
}
|
|
295
|
+
})();
|
|
296
|
+
finallyRes = { result: res };
|
|
297
|
+
args.onSuccess?.(res);
|
|
298
|
+
return res;
|
|
299
|
+
}
|
|
300
|
+
catch (error) {
|
|
301
|
+
finallyRes = { error };
|
|
302
|
+
if (!args.onCatch)
|
|
303
|
+
throw error;
|
|
304
|
+
return args.onCatch(error);
|
|
305
|
+
}
|
|
306
|
+
finally {
|
|
307
|
+
if (finallyRes)
|
|
308
|
+
args.onFinally?.(finallyRes);
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
exports.wrapPromisable = wrapPromisable;
|
|
312
|
+
function isPromise(obj) {
|
|
313
|
+
return obj instanceof Object && 'then' in obj && typeof obj.then === 'function';
|
|
314
|
+
}
|
|
315
|
+
function isDestinationActionService() {
|
|
316
|
+
return (process.env.DESTINATIONS_ACTION_SERVICE === 'true' || process.env.SERVICE_NAME === 'destination-actions-service');
|
|
317
|
+
}
|
|
318
|
+
exports.isDestinationActionService = isDestinationActionService;
|
|
211
319
|
//# sourceMappingURL=message-sender.js.map
|