@awell-health/awell-extensions 1.1.63 → 1.1.64
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/extensions/markdown.json +1 -1
- package/dist/extensions/sfdc/actions/createLead/createLead.js +6 -8
- package/dist/extensions/sfdc/actions/createLead/createLead.js.map +1 -1
- package/dist/extensions/sfdc/actions/updateLead/updateLead.js +6 -8
- package/dist/extensions/sfdc/actions/updateLead/updateLead.js.map +1 -1
- package/dist/extensions/sfdc/api/client.js +3 -6
- package/dist/extensions/sfdc/api/client.js.map +1 -1
- package/dist/extensions/sfdc/lib/errors.d.ts +9 -4
- package/dist/extensions/sfdc/lib/errors.js +18 -24
- package/dist/extensions/sfdc/lib/errors.js.map +1 -1
- package/dist/extensions/twilio/lib/appendOptOutLanguage.d.ts +3 -0
- package/dist/extensions/twilio/lib/appendOptOutLanguage.js +18 -0
- package/dist/extensions/twilio/lib/appendOptOutLanguage.js.map +1 -0
- package/dist/extensions/twilio/lib/errors.d.ts +9 -0
- package/dist/extensions/twilio/lib/errors.js +23 -0
- package/dist/extensions/twilio/lib/errors.js.map +1 -0
- package/dist/extensions/twilio/lib/index.d.ts +1 -0
- package/dist/extensions/twilio/lib/index.js +6 -0
- package/dist/extensions/twilio/lib/index.js.map +1 -0
- package/dist/extensions/twilio/settings.d.ts +30 -0
- package/dist/extensions/twilio/settings.js +39 -0
- package/dist/extensions/twilio/settings.js.map +1 -1
- package/dist/extensions/twilio/tests/settings.test.d.ts +1 -0
- package/dist/extensions/twilio/tests/settings.test.js +24 -0
- package/dist/extensions/twilio/tests/settings.test.js.map +1 -0
- package/dist/extensions/twilio/v2/actions/createFlowExecution/config/actionSchema.d.ts +33 -0
- package/dist/extensions/twilio/v2/actions/getMessages/getMessages.test.js +12 -0
- package/dist/extensions/twilio/v2/actions/getMessages/getMessages.test.js.map +1 -1
- package/dist/extensions/twilio/v2/actions/sendSms/sendSms.js +11 -29
- package/dist/extensions/twilio/v2/actions/sendSms/sendSms.js.map +1 -1
- package/dist/extensions/twilio/v2/actions/sendSms/sendSms.test.js +19 -15
- package/dist/extensions/twilio/v2/actions/sendSms/sendSms.test.js.map +1 -1
- package/dist/extensions/twilio/v2/actions/sendSmsDuringBusinessHours/sendSmsDuringBusinessHours.js +11 -30
- package/dist/extensions/twilio/v2/actions/sendSmsDuringBusinessHours/sendSmsDuringBusinessHours.js.map +1 -1
- package/dist/extensions/twilio/v2/actions/sendSmsDuringBusinessHours/sendSmsDuringBusinessHours.test.js +25 -15
- package/dist/extensions/twilio/v2/actions/sendSmsDuringBusinessHours/sendSmsDuringBusinessHours.test.js.map +1 -1
- package/dist/extensions/twilio/v2/actions/sendSmsWithMessagingSid/sendSmsWithMessagingService.js +10 -29
- package/dist/extensions/twilio/v2/actions/sendSmsWithMessagingSid/sendSmsWithMessagingService.js.map +1 -1
- package/dist/extensions/twilio/v2/actions/sendSmsWithMessagingSid/sendSmsWithMessagingService.test.js +19 -15
- package/dist/extensions/twilio/v2/actions/sendSmsWithMessagingSid/sendSmsWithMessagingService.test.js.map +1 -1
- package/package.json +1 -1
@@ -140,7 +140,7 @@
|
|
140
140
|
"changelog": "# Transform changelog\n\n## June 2024\n\n- Added \"Feet and inches to inches\" action\n## March 2024\n\n- Added \"Generate dynamic URL\" action\n\n## January 2024\n\n- Added \"Parse number to text with dictionary\" action"
|
141
141
|
},
|
142
142
|
"twilio": {
|
143
|
-
"readme": "---\ntitle: Twilio\ndescription: Twilio is a customer engagement platform used by hundreds of thousands of businesses and more than ten million developers worldwide to build unique, personalized experiences for their customers.\n---\n# Twilio\n\nTwilio is a customer engagement platform used by hundreds of thousands of businesses and more than ten million developers worldwide to build unique, personalized experiences for their customers.\n\nThey are known for democratizing channels like voice, text, chat, video, and email through APIs, making it easy for every organization to build meaningful interactions with customers on the channels they prefer.\n\n## Extension settings\n\nIn order to set up this extension, you will need:\n\n1. A Twilio API key or auth token which can be found in the Twilio console.\n2. Your account SID which can be found in the Twilio console.\n3. A phone number to send the message from. This must be a Twilio phone number that you own.\n\n## Custom Actions\n\n### Send SMS\n\nSend an SMS with Twilio to a recipient of your liking.\n\n### Get messages\n\nGet a list of text messages matching the given criteria. Only the last 50 messages are returned.\n\n## Send SMS during working hours\n\nThis action allows for the scheduling of SMS messages to be sent within the \"daily operational hours\" of 9 AM to 5 PM. It ensures that text messages are dispatched at appropriate times during the day, avoiding early morning or late-night disturbances to recipients.\n\n**Here's how it works:**\n\n- If the action is activate during business hours (9 AM to 5 PM), the SMS is sent immediately.\n- If activated before 9 AM, the SMS is scheduled to be sent at 9 AM on the same day.\n- If activated after 5 PM, the SMS is scheduled to be sent at 9 AM the following day.\n\nThis setup ensures that all messages reach your respondents during reasonable daytime hours, enhancing the likelihood of a timely and considerate communication. It's important to mention that messages will still be dispatched over the weekend, but they will adhere to the \"business hours\" schedule of 9 AM to 5 PM.\n\nNote that scheduling messages with Twilio is only possible if you send text messages using a MessagingServiceSid.\n\n\n\n\n\n\n",
|
143
|
+
"readme": "---\ntitle: Twilio\ndescription: Twilio is a customer engagement platform used by hundreds of thousands of businesses and more than ten million developers worldwide to build unique, personalized experiences for their customers.\n---\n# Twilio\n\nTwilio is a customer engagement platform used by hundreds of thousands of businesses and more than ten million developers worldwide to build unique, personalized experiences for their customers.\n\nThey are known for democratizing channels like voice, text, chat, video, and email through APIs, making it easy for every organization to build meaningful interactions with customers on the channels they prefer.\n\n## Extension settings\n\nIn order to set up this extension, you will need:\n\n1. A Twilio API key or auth token which can be found in the Twilio console.\n2. Your account SID which can be found in the Twilio console.\n3. A phone number to send the message from. This must be a Twilio phone number that you own.\n\n## User consent\n\nThe extension has some built-in mechanisms to enforce compliance with [Twilio's messaging policy](https://www.twilio.com/en-us/legal/messaging-policy).\n\n### Opt-out\n\nBy default, every text message will be appended with standard opt-out language (\"Reply STOP to unsubscribe.\"). You can specify custom opt-out language within the settings of the extension but make sure the opt-out keywords used are supported. STOP, UNSTOP, UNSUBSCRIBE or CANCEL are the default opt-out keywords supported but Twilio also supports defining custom stop keywords.\n\nIf you don't want to append opt-out language to your text messages, set the \"Add opt-out language\" setting to \"Off\".\n\nFor more information, please visit the Twilio docs.\n\n### Sending text messages to recipients that opted out\n\nIf you attempt to send a text message to a recipient who has opted out, the message will fail to be delivered and the action will be marked as failed. This is the default behavior of Twilio's API, which prevents sending texts to anyone who has chosen to opt out.\n\n## Custom Actions\n\n### Send SMS\n\nSend an SMS with Twilio to a recipient of your liking.\n\n### Get messages\n\nGet a list of text messages matching the given criteria. Only the last 50 messages are returned.\n\n## Send SMS during working hours\n\nThis action allows for the scheduling of SMS messages to be sent within the \"daily operational hours\" of 9 AM to 5 PM. It ensures that text messages are dispatched at appropriate times during the day, avoiding early morning or late-night disturbances to recipients.\n\n**Here's how it works:**\n\n- If the action is activate during business hours (9 AM to 5 PM), the SMS is sent immediately.\n- If activated before 9 AM, the SMS is scheduled to be sent at 9 AM on the same day.\n- If activated after 5 PM, the SMS is scheduled to be sent at 9 AM the following day.\n\nThis setup ensures that all messages reach your respondents during reasonable daytime hours, enhancing the likelihood of a timely and considerate communication. It's important to mention that messages will still be dispatched over the weekend, but they will adhere to the \"business hours\" schedule of 9 AM to 5 PM.\n\nNote that scheduling messages with Twilio is only possible if you send text messages using a MessagingServiceSid.\n\n\n\n\n\n\n",
|
144
144
|
"changelog": "# Twilio changelog\n\n## v2 2024-02-22\n\n1. Add capability to search for messages using all the allowed filters provided by Twilio API. Check here: https://www.twilio.com/docs/messaging/api/message-resource#read-multiple-message-resources\n\n## v2 2023-06-23\n\nFull description: https://github.com/awell-health/awell-extensions/issues/157\n\n1. \"Send SMS\" action\n 1. Change label from \"Send SMS\" to \"Send SMS (with from number)\"\n 2. Throw error when \"From\" number in both settings and in fields is not provided\n2. Add new action \"Send SMS (with Messaging Service)\"\n\n## v2\n\nCompared to v1 (pre-beta release), the extension only has one custom action \"Send SMS\" instead of two. The Custom Action allows for:\n\n1. Sending a text message to a recipient (phone number) stored in a data point, including patient profile data points.\n2. Sending a text message to a fixed recipient (phone number).\n"
|
145
145
|
},
|
146
146
|
"westFax": {
|
@@ -4,7 +4,6 @@ exports.createLead = void 0;
|
|
4
4
|
const extensions_core_1 = require("@awell-health/extensions-core");
|
5
5
|
const config_1 = require("./config");
|
6
6
|
const lib_1 = require("../../lib");
|
7
|
-
const axios_1 = require("axios");
|
8
7
|
const errors_1 = require("../../lib/errors");
|
9
8
|
exports.createLead = {
|
10
9
|
key: 'createLead',
|
@@ -31,16 +30,15 @@ exports.createLead = {
|
|
31
30
|
});
|
32
31
|
}
|
33
32
|
catch (error) {
|
34
|
-
|
35
|
-
|
36
|
-
|
33
|
+
if ((0, errors_1.isSalesforceError)(error)) {
|
34
|
+
await onError({
|
35
|
+
events: [(0, errors_1.parseSalesforceError)(error)],
|
36
|
+
});
|
37
37
|
}
|
38
38
|
else {
|
39
|
-
|
39
|
+
// we handle ZodError and unknown errors in extension-server directly
|
40
|
+
throw error;
|
40
41
|
}
|
41
|
-
await onError({
|
42
|
-
events: [parsedError],
|
43
|
-
});
|
44
42
|
}
|
45
43
|
},
|
46
44
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"createLead.js","sourceRoot":"","sources":["../../../../../extensions/sfdc/actions/createLead/createLead.ts"],"names":[],"mappings":";;;AAAA,mEAAqE;AAErE,qCAAqE;AACrE,mCAA0D;AAC1D,
|
1
|
+
{"version":3,"file":"createLead.js","sourceRoot":"","sources":["../../../../../extensions/sfdc/actions/createLead/createLead.ts"],"names":[],"mappings":";;;AAAA,mEAAqE;AAErE,qCAAqE;AACrE,mCAA0D;AAC1D,6CAA0E;AAE7D,QAAA,UAAU,GAInB;IACF,GAAG,EAAE,YAAY;IACjB,QAAQ,EAAE,0BAAQ,CAAC,gBAAgB;IACnC,KAAK,EAAE,aAAa;IACpB,WAAW,EAAE,yCAAyC;IACtD,MAAM,EAAN,eAAM;IACN,WAAW,EAAE,KAAK;IAClB,UAAU,EAAV,mBAAU;IACV,iBAAiB,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAiB,EAAE;QACvE,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,GAAG,MAAM,IAAA,oCAA8B,EAAC;YACxE,YAAY,EAAE,+BAAsB;YACpC,OAAO;SACR,CAAC,CAAA;QAEF,IAAI;YACF,MAAM,GAAG,GAAG,MAAM,gBAAgB,CAAC,YAAY,CAAC;gBAC9C,OAAO,EAAE,MAAM;gBACf,IAAI,EAAE,MAAM,CAAC,IAAI;aAClB,CAAC,CAAA;YAEF,MAAM,UAAU,CAAC;gBACf,WAAW,EAAE;oBACX,aAAa,EAAE,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC;iBAC9B;aACF,CAAC,CAAA;SACH;QAAC,OAAO,KAAK,EAAE;YACd,IAAI,IAAA,0BAAiB,EAAC,KAAK,CAAC,EAAE;gBAC5B,MAAM,OAAO,CAAC;oBACZ,MAAM,EAAE,CAAC,IAAA,6BAAoB,EAAC,KAAK,CAAC,CAAC;iBACtC,CAAC,CAAA;aACH;iBAAM;gBACL,qEAAqE;gBACrE,MAAM,KAAK,CAAA;aACZ;SACF;IACH,CAAC;CACF,CAAA"}
|
@@ -4,7 +4,6 @@ exports.updateLead = void 0;
|
|
4
4
|
const extensions_core_1 = require("@awell-health/extensions-core");
|
5
5
|
const config_1 = require("./config");
|
6
6
|
const lib_1 = require("../../lib");
|
7
|
-
const axios_1 = require("axios");
|
8
7
|
const errors_1 = require("../../lib/errors");
|
9
8
|
exports.updateLead = {
|
10
9
|
key: 'updateLead',
|
@@ -28,16 +27,15 @@ exports.updateLead = {
|
|
28
27
|
await onComplete();
|
29
28
|
}
|
30
29
|
catch (error) {
|
31
|
-
|
32
|
-
|
33
|
-
|
30
|
+
if ((0, errors_1.isSalesforceError)(error)) {
|
31
|
+
await onError({
|
32
|
+
events: [(0, errors_1.parseSalesforceError)(error)],
|
33
|
+
});
|
34
34
|
}
|
35
35
|
else {
|
36
|
-
|
36
|
+
// we handle ZodError and unknown errors in extension-server directly
|
37
|
+
throw error;
|
37
38
|
}
|
38
|
-
await onError({
|
39
|
-
events: [parsedError],
|
40
|
-
});
|
41
39
|
}
|
42
40
|
},
|
43
41
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"updateLead.js","sourceRoot":"","sources":["../../../../../extensions/sfdc/actions/updateLead/updateLead.ts"],"names":[],"mappings":";;;AAAA,mEAAqE;AAErE,qCAAqE;AACrE,mCAA0D;AAC1D,
|
1
|
+
{"version":3,"file":"updateLead.js","sourceRoot":"","sources":["../../../../../extensions/sfdc/actions/updateLead/updateLead.ts"],"names":[],"mappings":";;;AAAA,mEAAqE;AAErE,qCAAqE;AACrE,mCAA0D;AAC1D,6CAA0E;AAE7D,QAAA,UAAU,GAInB;IACF,GAAG,EAAE,YAAY;IACjB,QAAQ,EAAE,0BAAQ,CAAC,gBAAgB;IACnC,KAAK,EAAE,aAAa;IACpB,WAAW,EAAE,+CAA+C;IAC5D,MAAM,EAAN,eAAM;IACN,WAAW,EAAE,KAAK;IAClB,UAAU,EAAV,mBAAU;IACV,iBAAiB,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAiB,EAAE;QACvE,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,GAAG,MAAM,IAAA,oCAA8B,EAAC;YACxE,YAAY,EAAE,+BAAsB;YACpC,OAAO;SACR,CAAC,CAAA;QACF,IAAI;YACF,MAAM,gBAAgB,CAAC,YAAY,CAAC;gBAClC,OAAO,EAAE,MAAM;gBACf,SAAS,EAAE,MAAM,CAAC,SAAS;gBAC3B,IAAI,EAAE,MAAM,CAAC,IAAI;aAClB,CAAC,CAAA;YAEF,MAAM,UAAU,EAAE,CAAA;SACnB;QAAC,OAAO,KAAK,EAAE;YACd,IAAI,IAAA,0BAAiB,EAAC,KAAK,CAAC,EAAE;gBAC5B,MAAM,OAAO,CAAC;oBACZ,MAAM,EAAE,CAAC,IAAA,6BAAoB,EAAC,KAAK,CAAC,CAAC;iBACtC,CAAC,CAAA;aACH;iBAAM;gBACL,qEAAqE;gBACrE,MAAM,KAAK,CAAA;aACZ;SACF;IACH,CAAC;CACF,CAAA"}
|
@@ -9,7 +9,7 @@ class SalesforceDataWrapper extends extensions_core_1.DataWrapper {
|
|
9
9
|
this.apiVersion = opts.apiVersion;
|
10
10
|
}
|
11
11
|
async createRecord(input) {
|
12
|
-
|
12
|
+
return await this.Request({
|
13
13
|
method: 'POST',
|
14
14
|
url: `/services/data/${this.apiVersion}/sobjects/${input.sObject}/`,
|
15
15
|
headers: {
|
@@ -17,10 +17,9 @@ class SalesforceDataWrapper extends extensions_core_1.DataWrapper {
|
|
17
17
|
},
|
18
18
|
data: JSON.stringify(input.data),
|
19
19
|
});
|
20
|
-
return res;
|
21
20
|
}
|
22
21
|
async updateRecord(input) {
|
23
|
-
|
22
|
+
return await this.Request({
|
24
23
|
method: 'PATCH',
|
25
24
|
url: `/services/data/${this.apiVersion}/sobjects/${input.sObject}/${input.sObjectId}`,
|
26
25
|
headers: {
|
@@ -28,17 +27,15 @@ class SalesforceDataWrapper extends extensions_core_1.DataWrapper {
|
|
28
27
|
},
|
29
28
|
data: JSON.stringify(input.data),
|
30
29
|
});
|
31
|
-
return res;
|
32
30
|
}
|
33
31
|
async getRecordShape(sObject) {
|
34
|
-
|
32
|
+
return await this.Request({
|
35
33
|
method: 'GET',
|
36
34
|
url: `/services/data/${this.apiVersion}/sobjects/${sObject}/describe`,
|
37
35
|
headers: {
|
38
36
|
'Content-Type': 'application/json',
|
39
37
|
},
|
40
38
|
});
|
41
|
-
return res;
|
42
39
|
}
|
43
40
|
}
|
44
41
|
exports.SalesforceDataWrapper = SalesforceDataWrapper;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../extensions/sfdc/api/client.ts"],"names":[],"mappings":";;;AAAA,mEASsC;AACtC,iDAAuD;AAQvD,MAAa,qBAAsB,SAAQ,6BAAW;IAGpD,YACE,KAAa,EACb,OAAe,EACf,IAEC;QAED,KAAK,CAA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AC,MAAM,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAA;IACzE,CAAC;IAEM,KAAK,CAAC,cAAc,CAAC,OAAe;QACzC,OAAO,MAAM,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,EAAE,EAAE,EAAE,CAAC,MAAM,EAAE,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAA;IAC7E,CAAC;CACF;AA9DD,0DA8DC"}
|
@@ -1,4 +1,9 @@
|
|
1
|
-
import { ActivityEvent } from '@awell-health/extensions-core';
|
2
|
-
import { AxiosError } from 'axios';
|
3
|
-
|
4
|
-
|
1
|
+
import { type ActivityEvent } from '@awell-health/extensions-core';
|
2
|
+
import { type AxiosError } from 'axios';
|
3
|
+
type SalesforceError = Array<{
|
4
|
+
message: string;
|
5
|
+
errorCode: string;
|
6
|
+
}>;
|
7
|
+
export declare const isSalesforceError: (error: any) => error is AxiosError<SalesforceError, any>;
|
8
|
+
export declare const parseSalesforceError: (error: AxiosError<SalesforceError>) => ActivityEvent;
|
9
|
+
export {};
|
@@ -1,17 +1,23 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
4
|
-
const
|
5
|
-
|
3
|
+
exports.parseSalesforceError = exports.isSalesforceError = void 0;
|
4
|
+
const isSalesforceError = (error) => {
|
5
|
+
return (typeof error === 'object' &&
|
6
|
+
error !== null &&
|
7
|
+
'response' in error &&
|
8
|
+
typeof error.response === 'object' &&
|
9
|
+
error.response !== null &&
|
10
|
+
Array.isArray(error.response.data) &&
|
11
|
+
error.response.data.length > 0 &&
|
12
|
+
'errorCode' in error.response.data[0] &&
|
13
|
+
'message' in error.response.data[0]);
|
14
|
+
};
|
15
|
+
exports.isSalesforceError = isSalesforceError;
|
16
|
+
const parseSalesforceError = (error) => {
|
17
|
+
var _a;
|
6
18
|
const category = 'BAD_REQUEST';
|
7
|
-
|
8
|
-
|
9
|
-
if (Array.isArray((_d = error === null || error === void 0 ? void 0 : error.response) === null || _d === void 0 ? void 0 : _d.data) &&
|
10
|
-
((_f = (_e = error === null || error === void 0 ? void 0 : error.response) === null || _e === void 0 ? void 0 : _e.data[0]) === null || _f === void 0 ? void 0 : _f.errorCode) &&
|
11
|
-
((_h = (_g = error === null || error === void 0 ? void 0 : error.response) === null || _g === void 0 ? void 0 : _g.data[0]) === null || _h === void 0 ? void 0 : _h.message)) {
|
12
|
-
const salesforceError = (_j = error === null || error === void 0 ? void 0 : error.response) === null || _j === void 0 ? void 0 : _j.data[0];
|
13
|
-
message = `${salesforceError.errorCode}: ${salesforceError.message}`;
|
14
|
-
}
|
19
|
+
const salesforceError = (_a = error === null || error === void 0 ? void 0 : error.response) === null || _a === void 0 ? void 0 : _a.data[0];
|
20
|
+
const message = `${String(salesforceError === null || salesforceError === void 0 ? void 0 : salesforceError.errorCode)}: ${String(salesforceError === null || salesforceError === void 0 ? void 0 : salesforceError.message)}`;
|
15
21
|
return {
|
16
22
|
date: new Date().toISOString(),
|
17
23
|
text: {
|
@@ -23,17 +29,5 @@ const parseAxiosError = (error) => {
|
|
23
29
|
},
|
24
30
|
};
|
25
31
|
};
|
26
|
-
exports.
|
27
|
-
const parseUnknowError = (error) => {
|
28
|
-
const message = error.message;
|
29
|
-
return {
|
30
|
-
date: new Date().toISOString(),
|
31
|
-
text: { en: message },
|
32
|
-
error: {
|
33
|
-
category: 'SERVER_ERROR',
|
34
|
-
message,
|
35
|
-
},
|
36
|
-
};
|
37
|
-
};
|
38
|
-
exports.parseUnknowError = parseUnknowError;
|
32
|
+
exports.parseSalesforceError = parseSalesforceError;
|
39
33
|
//# sourceMappingURL=errors.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../../extensions/sfdc/lib/errors.ts"],"names":[],"mappings":";;;
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../../extensions/sfdc/lib/errors.ts"],"names":[],"mappings":";;;AAQO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OptOutLanguage = void 0;
|
4
|
+
const lodash_1 = require("lodash");
|
5
|
+
const DEFAULT_OPT_OUT_LANGUAGE = {
|
6
|
+
en: 'Reply STOP to unsubscribe.',
|
7
|
+
fr: 'Répondez STOP pour vous désabonner.',
|
8
|
+
nl: 'Antwoord STOP om geen communicate meer te ontvangen.',
|
9
|
+
};
|
10
|
+
const appendOptOutLanguage = (message, optOutLanguage, language) => {
|
11
|
+
const lang = language !== null && language !== void 0 ? language : 'en';
|
12
|
+
if ((0, lodash_1.isEmpty)(optOutLanguage) || optOutLanguage === undefined) {
|
13
|
+
return `${message}\n\n${DEFAULT_OPT_OUT_LANGUAGE[lang]}`;
|
14
|
+
}
|
15
|
+
return `${message}\n\n${optOutLanguage}`;
|
16
|
+
};
|
17
|
+
exports.appendOptOutLanguage = appendOptOutLanguage;
|
18
|
+
//# sourceMappingURL=appendOptOutLanguage.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"appendOptOutLanguage.js","sourceRoot":"","sources":["../../../../extensions/twilio/lib/appendOptOutLanguage.ts"],"names":[],"mappings":";;;AAAA,mCAAgC;AAIhC,MAAM,wBAAwB,GAA6B;IACzD,EAAE,EAAE,4BAA4B;IAChC,EAAE,EAAE,qCAAqC;IACzC,EAAE,EAAE,sDAAsD;CAC3D,CAAA;AAEM,MAAM,oBAAoB,GAAG,CAClC,OAAe,EACf,cAAuB,EACvB,QAAmB,EACX,EAAE;IACV,MAAM,IAAI,GAAG,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,IAAI,CAAA;IAE7B,IAAI,IAAA,gBAAO,EAAC,cAAc,CAAC,IAAI,cAAc,KAAK,SAAS,EAAE;QAC3D,OAAO,GAAG,OAAO,OAAO,wBAAwB,CAAC,IAAI,CAAC,EAAE,CAAA;KACzD;IAED,OAAO,GAAG,OAAO,OAAO,cAAc,EAAE,CAAA;AAC1C,CAAC,CAAA;AAZY,QAAA,oBAAoB,wBAYhC"}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import { type ActivityEvent } from '@awell-health/extensions-core';
|
2
|
+
export interface TwilioErrorResponse {
|
3
|
+
code: number;
|
4
|
+
message: string;
|
5
|
+
moreInfo: string;
|
6
|
+
status: number;
|
7
|
+
}
|
8
|
+
export declare const isTwilioErrorResponse: (data: any) => data is TwilioErrorResponse;
|
9
|
+
export declare const parseTwilioError: (error: TwilioErrorResponse) => ActivityEvent;
|
@@ -0,0 +1,23 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.parseTwilioError = exports.isTwilioErrorResponse = void 0;
|
4
|
+
const isTwilioErrorResponse = (data) => {
|
5
|
+
return typeof (data === null || data === void 0 ? void 0 : data.moreInfo) === 'string';
|
6
|
+
};
|
7
|
+
exports.isTwilioErrorResponse = isTwilioErrorResponse;
|
8
|
+
const parseTwilioError = (error) => {
|
9
|
+
const category = 'BAD_REQUEST';
|
10
|
+
const message = `${error.code}: ${error.message} (${error.moreInfo})`;
|
11
|
+
return {
|
12
|
+
date: new Date().toISOString(),
|
13
|
+
text: {
|
14
|
+
en: message,
|
15
|
+
},
|
16
|
+
error: {
|
17
|
+
category,
|
18
|
+
message,
|
19
|
+
},
|
20
|
+
};
|
21
|
+
};
|
22
|
+
exports.parseTwilioError = parseTwilioError;
|
23
|
+
//# sourceMappingURL=errors.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../../extensions/twilio/lib/errors.ts"],"names":[],"mappings":";;;AASO,MAAM,qBAAqB,GAAG,CACnC,IAAS,EACoB,EAAE;IAC/B,OAAO,OAAO,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,QAAQ,CAAA,KAAK,QAAQ,CAAA;AAC3C,CAAC,CAAA;AAJY,QAAA,qBAAqB,yBAIjC;AAEM,MAAM,gBAAgB,GAAG,CAAC,KAA0B,EAAiB,EAAE;IAC5E,MAAM,QAAQ,GAAG,aAAa,CAAA;IAC9B,MAAM,OAAO,GAAG,GAAG,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC,OAAO,KAAK,KAAK,CAAC,QAAQ,GAAG,CAAA;IAErE,OAAO;QACL,IAAI,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QAC9B,IAAI,EAAE;YACJ,EAAE,EAAE,OAAO;SACZ;QACD,KAAK,EAAE;YACL,QAAQ;YACR,OAAO;SACR;KACF,CAAA;AACH,CAAC,CAAA;AAdY,QAAA,gBAAgB,oBAc5B"}
|
@@ -0,0 +1 @@
|
|
1
|
+
export { appendOptOutLanguage } from './appendOptOutLanguage';
|
@@ -0,0 +1,6 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.appendOptOutLanguage = void 0;
|
4
|
+
var appendOptOutLanguage_1 = require("./appendOptOutLanguage");
|
5
|
+
Object.defineProperty(exports, "appendOptOutLanguage", { enumerable: true, get: function () { return appendOptOutLanguage_1.appendOptOutLanguage; } });
|
6
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../extensions/twilio/lib/index.ts"],"names":[],"mappings":";;;AAAA,+DAA6D;AAApD,4HAAA,oBAAoB,OAAA"}
|
@@ -28,20 +28,50 @@ export declare const settings: {
|
|
28
28
|
required: false;
|
29
29
|
description: string;
|
30
30
|
};
|
31
|
+
addOptOutLanguage: {
|
32
|
+
label: string;
|
33
|
+
key: string;
|
34
|
+
obfuscated: false;
|
35
|
+
required: false;
|
36
|
+
description: string;
|
37
|
+
};
|
38
|
+
optOutLanguage: {
|
39
|
+
label: string;
|
40
|
+
key: string;
|
41
|
+
obfuscated: false;
|
42
|
+
required: false;
|
43
|
+
description: string;
|
44
|
+
};
|
45
|
+
language: {
|
46
|
+
label: string;
|
47
|
+
key: string;
|
48
|
+
obfuscated: false;
|
49
|
+
required: false;
|
50
|
+
description: string;
|
51
|
+
};
|
31
52
|
};
|
32
53
|
export declare const SettingsValidationSchema: z.ZodObject<{
|
33
54
|
accountSid: z.ZodString;
|
34
55
|
authToken: z.ZodString;
|
35
56
|
fromNumber: z.ZodUnion<[z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, import("libphonenumber-js").PhoneNumber | import("libphonenumber-js").ParseError, string>, import("libphonenumber-js").PhoneNumber | import("libphonenumber-js").ParseError, string>, import("libphonenumber-js").E164Number, string>>, z.ZodEffects<z.ZodLiteral<"">, undefined, "">]>;
|
36
57
|
messagingServiceSid: z.ZodOptional<z.ZodString>;
|
58
|
+
addOptOutLanguage: z.ZodEffects<z.ZodOptional<z.ZodString>, boolean, string | undefined>;
|
59
|
+
optOutLanguage: z.ZodOptional<z.ZodString>;
|
60
|
+
language: z.ZodEffects<z.ZodDefault<z.ZodUnion<[z.ZodEnum<["en", "fr", "nl"]>, z.ZodLiteral<"">]>>, "en" | "fr" | "nl", "" | "en" | "fr" | "nl" | undefined>;
|
37
61
|
}, "strip", z.ZodTypeAny, {
|
62
|
+
language: "en" | "fr" | "nl";
|
38
63
|
accountSid: string;
|
39
64
|
authToken: string;
|
65
|
+
addOptOutLanguage: boolean;
|
40
66
|
fromNumber?: import("libphonenumber-js").E164Number | undefined;
|
41
67
|
messagingServiceSid?: string | undefined;
|
68
|
+
optOutLanguage?: string | undefined;
|
42
69
|
}, {
|
43
70
|
accountSid: string;
|
44
71
|
authToken: string;
|
72
|
+
language?: "" | "en" | "fr" | "nl" | undefined;
|
45
73
|
fromNumber?: string | undefined;
|
46
74
|
messagingServiceSid?: string | undefined;
|
75
|
+
addOptOutLanguage?: string | undefined;
|
76
|
+
optOutLanguage?: string | undefined;
|
47
77
|
}>;
|
@@ -32,11 +32,50 @@ exports.settings = {
|
|
32
32
|
required: false,
|
33
33
|
description: 'The SID of the Messaging Service you want to associate with the Message. If you are not using a Messaging Service but a "from" number, then you can leave this field empty.',
|
34
34
|
},
|
35
|
+
addOptOutLanguage: {
|
36
|
+
label: 'Add opt-out language',
|
37
|
+
key: 'addOptOutLanguage',
|
38
|
+
obfuscated: false,
|
39
|
+
required: false,
|
40
|
+
description: `On by default, set to "Off" if you don't want to add opt-out language to your text messages.`,
|
41
|
+
},
|
42
|
+
optOutLanguage: {
|
43
|
+
label: 'Opt-out language',
|
44
|
+
key: 'optOutLanguage',
|
45
|
+
obfuscated: false,
|
46
|
+
required: false,
|
47
|
+
description: 'The sentence that is appended at the end of your text messages that informs recipients of how they can opt out. If not specified, standard opt-out language is appended to your messages.',
|
48
|
+
},
|
49
|
+
language: {
|
50
|
+
label: 'Language',
|
51
|
+
key: 'language',
|
52
|
+
obfuscated: false,
|
53
|
+
required: false,
|
54
|
+
description: 'The language you are sending text messages in. Possible options: fr, en (default), nl.',
|
55
|
+
},
|
35
56
|
};
|
36
57
|
exports.SettingsValidationSchema = zod_1.z.object({
|
37
58
|
accountSid: zod_1.z.string().min(1, { message: 'Missing Twilio account SID' }),
|
38
59
|
authToken: zod_1.z.string().min(1, { message: 'Missing Twilio auth token' }),
|
39
60
|
fromNumber: extensions_core_1.E164PhoneValidationOptionalSchema,
|
40
61
|
messagingServiceSid: zod_1.z.string().optional(),
|
62
|
+
addOptOutLanguage: zod_1.z
|
63
|
+
.string()
|
64
|
+
.toLowerCase()
|
65
|
+
.optional()
|
66
|
+
.transform((arg) => {
|
67
|
+
if (arg === 'off')
|
68
|
+
return false;
|
69
|
+
return true;
|
70
|
+
}),
|
71
|
+
optOutLanguage: zod_1.z.string().optional(),
|
72
|
+
language: zod_1.z
|
73
|
+
.union([zod_1.z.enum(['en', 'fr', 'nl']), zod_1.z.literal('')])
|
74
|
+
.default('en')
|
75
|
+
.transform((arg) => {
|
76
|
+
if (arg === '')
|
77
|
+
return 'en';
|
78
|
+
return arg;
|
79
|
+
}),
|
41
80
|
});
|
42
81
|
//# sourceMappingURL=settings.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"settings.js","sourceRoot":"","sources":["../../../extensions/twilio/settings.ts"],"names":[],"mappings":";;;AAAA,mEAGsC;AACtC,6BAAwC;AAE3B,QAAA,QAAQ,GAAG;IACtB,UAAU,EAAE;QACV,KAAK,EAAE,aAAa;QACpB,GAAG,EAAE,YAAY;QACjB,UAAU,EAAE,IAAI;QAChB,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,8CAA8C;KAC5D;IACD,SAAS,EAAE;QACT,KAAK,EAAE,YAAY;QACnB,GAAG,EAAE,WAAW;QAChB,UAAU,EAAE,IAAI;QAChB,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,6CAA6C;KAC3D;IACD,UAAU,EAAE;QACV,KAAK,EAAE,eAAe;QACtB,GAAG,EAAE,YAAY;QACjB,UAAU,EAAE,KAAK;QACjB,QAAQ,EAAE,KAAK;QACf,WAAW,EACT,mKAAmK;KACtK;IACD,mBAAmB,EAAE;QACnB,KAAK,EAAE,uBAAuB;QAC9B,GAAG,EAAE,qBAAqB;QAC1B,UAAU,EAAE,KAAK;QACjB,QAAQ,EAAE,KAAK;QACf,WAAW,EACT,6KAA6K;KAChL;CACgC,CAAA;AAEtB,QAAA,wBAAwB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC/C,UAAU,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,OAAO,EAAE,4BAA4B,EAAE,CAAC;IACxE,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,OAAO,EAAE,2BAA2B,EAAE,CAAC;IACtE,UAAU,EAAE,mDAAiC;IAC7C,mBAAmB,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;
|
1
|
+
{"version":3,"file":"settings.js","sourceRoot":"","sources":["../../../extensions/twilio/settings.ts"],"names":[],"mappings":";;;AAAA,mEAGsC;AACtC,6BAAwC;AAE3B,QAAA,QAAQ,GAAG;IACtB,UAAU,EA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AM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,OAAO,EAAE,2BAA2B,EAAE,CAAC;IACtE,UAAU,EAAE,mDAAiC;IAC7C,mBAAmB,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC1C,iBAAiB,EAAE,OAAC;SACjB,MAAM,EAAE;SACR,WAAW,EAAE;SACb,QAAQ,EAAE;SACV,SAAS,CAAC,CAAC,GAAG,EAAE,EAAE;QACjB,IAAI,GAAG,KAAK,KAAK;YAAE,OAAO,KAAK,CAAA;QAE/B,OAAO,IAAI,CAAA;IACb,CAAC,CAAC;IACJ,cAAc,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACrC,QAAQ,EAAE,OAAC;SACR,KAAK,CAAC,CAAC,OAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,EAAE,OAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC;SAClD,OAAO,CAAC,IAAI,CAAC;SACb,SAAS,CAAC,CAAC,GAAG,EAAE,EAAE;QACjB,IAAI,GAAG,KAAK,EAAE;YAAE,OAAO,IAAI,CAAA;QAE3B,OAAO,GAAG,CAAA;IACZ,CAAC,CAAC;CAC+C,CAAC,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1,24 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
const settings_1 = require("../settings");
|
4
|
+
describe('Settings', () => {
|
5
|
+
test('Opt out language settings', async () => {
|
6
|
+
const settings = {
|
7
|
+
accountSid: 'AC-accountSid',
|
8
|
+
authToken: 'authToken',
|
9
|
+
addOptOutLanguage: undefined,
|
10
|
+
optOutLanguage: undefined,
|
11
|
+
language: '',
|
12
|
+
};
|
13
|
+
const result = settings_1.SettingsValidationSchema.safeParse(settings);
|
14
|
+
if (!result.success) {
|
15
|
+
console.log(result.error.errors);
|
16
|
+
}
|
17
|
+
expect(result.success).toBe(true);
|
18
|
+
if (result.success) {
|
19
|
+
expect(result.data.addOptOutLanguage).toEqual(true); // Default is true
|
20
|
+
expect(result.data.language).toEqual('en'); // Default is English
|
21
|
+
}
|
22
|
+
});
|
23
|
+
});
|
24
|
+
//# sourceMappingURL=settings.test.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"settings.test.js","sourceRoot":"","sources":["../../../../extensions/twilio/tests/settings.test.ts"],"names":[],"mappings":";;AAAA,0CAAsD;AAEtD,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE;IACxB,IAAI,CAAC,2BAA2B,EAAE,KAAK,IAAI,EAAE;QAC3C,MAAM,QAAQ,GAAG;YACf,UAAU,EAAE,eAAe;YAC3B,SAAS,EAAE,WAAW;YACtB,iBAAiB,EAAE,SAAS;YAC5B,cAAc,EAAE,SAAS;YACzB,QAAQ,EAAE,EAAE;SACb,CAAA;QACD,MAAM,MAAM,GAAG,mCAAwB,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAA;QAE3D,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE;YACnB,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;SACjC;QAED,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAEjC,IAAI,MAAM,CAAC,OAAO,EAAE;YAClB,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA,CAAC,kBAAkB;YACtE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA,CAAC,qBAAqB;SACjE;IACH,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
@@ -5,16 +5,25 @@ export declare const CreateFlowExecutionSchema: z.ZodEffects<z.ZodEffects<z.ZodE
|
|
5
5
|
authToken: z.ZodString;
|
6
6
|
fromNumber: z.ZodUnion<[z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, import("libphonenumber-js").PhoneNumber | import("libphonenumber-js").ParseError, string>, import("libphonenumber-js").PhoneNumber | import("libphonenumber-js").ParseError, string>, import("libphonenumber-js").E164Number, string>>, z.ZodEffects<z.ZodLiteral<"">, undefined, "">]>;
|
7
7
|
messagingServiceSid: z.ZodOptional<z.ZodString>;
|
8
|
+
addOptOutLanguage: z.ZodEffects<z.ZodOptional<z.ZodString>, boolean, string | undefined>;
|
9
|
+
optOutLanguage: z.ZodOptional<z.ZodString>;
|
10
|
+
language: z.ZodEffects<z.ZodDefault<z.ZodUnion<[z.ZodEnum<["en", "fr", "nl"]>, z.ZodLiteral<"">]>>, "en" | "fr" | "nl", "" | "en" | "fr" | "nl" | undefined>;
|
8
11
|
}, "strip", z.ZodTypeAny, {
|
12
|
+
language: "en" | "fr" | "nl";
|
9
13
|
accountSid: string;
|
10
14
|
authToken: string;
|
15
|
+
addOptOutLanguage: boolean;
|
11
16
|
fromNumber?: import("libphonenumber-js").E164Number | undefined;
|
12
17
|
messagingServiceSid?: string | undefined;
|
18
|
+
optOutLanguage?: string | undefined;
|
13
19
|
}, {
|
14
20
|
accountSid: string;
|
15
21
|
authToken: string;
|
22
|
+
language?: "" | "en" | "fr" | "nl" | undefined;
|
16
23
|
fromNumber?: string | undefined;
|
17
24
|
messagingServiceSid?: string | undefined;
|
25
|
+
addOptOutLanguage?: string | undefined;
|
26
|
+
optOutLanguage?: string | undefined;
|
18
27
|
}>;
|
19
28
|
fields: z.ZodObject<{
|
20
29
|
recipient: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, import("libphonenumber-js").PhoneNumber | import("libphonenumber-js").ParseError, string>, import("libphonenumber-js").PhoneNumber | import("libphonenumber-js").ParseError, string>, import("libphonenumber-js").E164Number, string>;
|
@@ -36,10 +45,13 @@ export declare const CreateFlowExecutionSchema: z.ZodEffects<z.ZodEffects<z.ZodE
|
|
36
45
|
}>;
|
37
46
|
}, "strip", z.ZodTypeAny, {
|
38
47
|
settings: {
|
48
|
+
language: "en" | "fr" | "nl";
|
39
49
|
accountSid: string;
|
40
50
|
authToken: string;
|
51
|
+
addOptOutLanguage: boolean;
|
41
52
|
fromNumber?: import("libphonenumber-js").E164Number | undefined;
|
42
53
|
messagingServiceSid?: string | undefined;
|
54
|
+
optOutLanguage?: string | undefined;
|
43
55
|
};
|
44
56
|
fields: {
|
45
57
|
recipient: string & {
|
@@ -53,8 +65,11 @@ export declare const CreateFlowExecutionSchema: z.ZodEffects<z.ZodEffects<z.ZodE
|
|
53
65
|
settings: {
|
54
66
|
accountSid: string;
|
55
67
|
authToken: string;
|
68
|
+
language?: "" | "en" | "fr" | "nl" | undefined;
|
56
69
|
fromNumber?: string | undefined;
|
57
70
|
messagingServiceSid?: string | undefined;
|
71
|
+
addOptOutLanguage?: string | undefined;
|
72
|
+
optOutLanguage?: string | undefined;
|
58
73
|
};
|
59
74
|
fields: {
|
60
75
|
recipient: string;
|
@@ -64,10 +79,13 @@ export declare const CreateFlowExecutionSchema: z.ZodEffects<z.ZodEffects<z.ZodE
|
|
64
79
|
};
|
65
80
|
}>, {
|
66
81
|
settings: {
|
82
|
+
language: "en" | "fr" | "nl";
|
67
83
|
accountSid: string;
|
68
84
|
authToken: string;
|
85
|
+
addOptOutLanguage: boolean;
|
69
86
|
fromNumber?: import("libphonenumber-js").E164Number | undefined;
|
70
87
|
messagingServiceSid?: string | undefined;
|
88
|
+
optOutLanguage?: string | undefined;
|
71
89
|
};
|
72
90
|
fields: {
|
73
91
|
recipient: string & {
|
@@ -81,8 +99,11 @@ export declare const CreateFlowExecutionSchema: z.ZodEffects<z.ZodEffects<z.ZodE
|
|
81
99
|
settings: {
|
82
100
|
accountSid: string;
|
83
101
|
authToken: string;
|
102
|
+
language?: "" | "en" | "fr" | "nl" | undefined;
|
84
103
|
fromNumber?: string | undefined;
|
85
104
|
messagingServiceSid?: string | undefined;
|
105
|
+
addOptOutLanguage?: string | undefined;
|
106
|
+
optOutLanguage?: string | undefined;
|
86
107
|
};
|
87
108
|
fields: {
|
88
109
|
recipient: string;
|
@@ -92,10 +113,13 @@ export declare const CreateFlowExecutionSchema: z.ZodEffects<z.ZodEffects<z.ZodE
|
|
92
113
|
};
|
93
114
|
}>, {
|
94
115
|
settings: {
|
116
|
+
language: "en" | "fr" | "nl";
|
95
117
|
accountSid: string;
|
96
118
|
authToken: string;
|
119
|
+
addOptOutLanguage: boolean;
|
97
120
|
fromNumber?: import("libphonenumber-js").E164Number | undefined;
|
98
121
|
messagingServiceSid?: string | undefined;
|
122
|
+
optOutLanguage?: string | undefined;
|
99
123
|
};
|
100
124
|
fields: {
|
101
125
|
parameters: any;
|
@@ -109,8 +133,11 @@ export declare const CreateFlowExecutionSchema: z.ZodEffects<z.ZodEffects<z.ZodE
|
|
109
133
|
settings: {
|
110
134
|
accountSid: string;
|
111
135
|
authToken: string;
|
136
|
+
language?: "" | "en" | "fr" | "nl" | undefined;
|
112
137
|
fromNumber?: string | undefined;
|
113
138
|
messagingServiceSid?: string | undefined;
|
139
|
+
addOptOutLanguage?: string | undefined;
|
140
|
+
optOutLanguage?: string | undefined;
|
114
141
|
};
|
115
142
|
fields: {
|
116
143
|
recipient: string;
|
@@ -120,10 +147,13 @@ export declare const CreateFlowExecutionSchema: z.ZodEffects<z.ZodEffects<z.ZodE
|
|
120
147
|
};
|
121
148
|
}>, {
|
122
149
|
settings: {
|
150
|
+
language: "en" | "fr" | "nl";
|
123
151
|
accountSid: string;
|
124
152
|
authToken: string;
|
153
|
+
addOptOutLanguage: boolean;
|
125
154
|
fromNumber?: import("libphonenumber-js").E164Number | undefined;
|
126
155
|
messagingServiceSid?: string | undefined;
|
156
|
+
optOutLanguage?: string | undefined;
|
127
157
|
};
|
128
158
|
fields: {
|
129
159
|
parameters: any;
|
@@ -137,8 +167,11 @@ export declare const CreateFlowExecutionSchema: z.ZodEffects<z.ZodEffects<z.ZodE
|
|
137
167
|
settings: {
|
138
168
|
accountSid: string;
|
139
169
|
authToken: string;
|
170
|
+
language?: "" | "en" | "fr" | "nl" | undefined;
|
140
171
|
fromNumber?: string | undefined;
|
141
172
|
messagingServiceSid?: string | undefined;
|
173
|
+
addOptOutLanguage?: string | undefined;
|
174
|
+
optOutLanguage?: string | undefined;
|
142
175
|
};
|
143
176
|
fields: {
|
144
177
|
recipient: string;
|