@awell-health/awell-extensions 2.1.62 → 2.1.63
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/extensions/markdown.json +1 -1
- package/dist/extensions/zoom/actions/index.d.ts +1 -1
- package/dist/extensions/zoom/actions/sendSms/config/dataPoints.d.ts +4 -0
- package/dist/extensions/zoom/actions/sendSms/config/dataPoints.js +4 -0
- package/dist/extensions/zoom/actions/sendSms/config/dataPoints.js.map +1 -1
- package/dist/extensions/zoom/actions/sendSms/sendSms.js +58 -8
- package/dist/extensions/zoom/actions/sendSms/sendSms.js.map +1 -1
- package/package.json +1 -1
|
@@ -232,7 +232,7 @@
|
|
|
232
232
|
"changelog": "# Zendesk changelog\n"
|
|
233
233
|
},
|
|
234
234
|
"zoom": {
|
|
235
|
-
"readme": "---\ntitle: Zoom\ndescription: Zoom is a communications platform that allows users to connect with video, audio, phone, and chat.\n---\n\n# Zoom\n\nZoom is a communications platform that allows users to connect with video, audio, phone, and chat.\n\n## Extension settings\n\nTo set up this extension, you will need to provide the following:\n\n1. **Account ID:** your Zoom account ID, found on the Server to Server app build page.\n2. **Client ID:** the client ID of the OAuth app you created in Zoom\n3. **Client secret:** the client secret of the OAuth app you created in Zoom\n\nYou'll have to set up a [Server-to-Server OAuth app](https://developers.zoom.us/docs/internal-apps/create/) in Zoom to provision a client ID and secret.\n\n## Actions\n\n### Send SMS\n\nSend an SMS to a recipient.\n\nEnsure your Server-to-Server OAuth app has the following scopes set:\n\n- Scopes: `contact_center_sms:write:admin`\n- Granular Scopes: `contact_center:write:sms:admin`\n",
|
|
235
|
+
"readme": "---\ntitle: Zoom\ndescription: Zoom is a communications platform that allows users to connect with video, audio, phone, and chat.\n---\n\n# Zoom\n\nZoom is a communications platform that allows users to connect with video, audio, phone, and chat.\n\n## Extension settings\n\nTo set up this extension, you will need to provide the following:\n\n1. **Account ID:** your Zoom account ID, found on the Server to Server app build page.\n2. **Client ID:** the client ID of the OAuth app you created in Zoom\n3. **Client secret:** the client secret of the OAuth app you created in Zoom\n\nYou'll have to set up a [Server-to-Server OAuth app](https://developers.zoom.us/docs/internal-apps/create/) in Zoom to provision a client ID and secret.\n\n## Actions\n\n### Send SMS\n\nSend an SMS to a recipient.\n\nEnsure your Server-to-Server OAuth app has the following scopes set:\n\n- Scopes: `contact_center_sms:write:admin`\n- Granular Scopes: `contact_center:write:sms:admin`\n\n#### Result codes\n\nOn completion, the action returns a `code` data point indicating the outcome:\n\n- **SUCCESS**: SMS was sent successfully.\n- **INVALID_CONSUMER_NUMBER_FORMAT**: Invalid consumer number; E.164 format is required.\n- **CONTACT_CENTER_NUMBER_USED**: Zoom Contact Center numbers cannot be used as consumer numbers.\n- **CONSUMER_NOT_OPTED_IN**: The consumer number you have messaged has not opted in.\n- **CONSUMER_OPTED_OUT**: The consumer number has opted out of receiving SMS from this Zoom Contact Center number.\n- **CONSUMER_BLOCK_LISTED**: The consumer number is block-listed by your Zoom Contact Center administrator.\n- **INTERNATIONAL_SMS_NOT_SUPPORTED**: International messaging is not supported on this account.\n- **BODY_TOO_LONG**: Validation error — body exceeds 500 characters.\n",
|
|
236
236
|
"changelog": "# CHANGELOG"
|
|
237
237
|
},
|
|
238
238
|
"zusHealth": {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataPoints.js","sourceRoot":"","sources":["../../../../../../extensions/zoom/actions/sendSms/config/dataPoints.ts"],"names":[],"mappings":";;;AAEa,QAAA,UAAU,GAAG;IACxB,SAAS,EAAE;QACT,GAAG,EAAE,WAAW;QAChB,SAAS,EAAE,QAAQ;KACpB;IACD,OAAO,EAAE;QACP,GAAG,EAAE,SAAS;QACd,SAAS,EAAE,SAAS;KACrB;CAC4C,CAAA"}
|
|
1
|
+
{"version":3,"file":"dataPoints.js","sourceRoot":"","sources":["../../../../../../extensions/zoom/actions/sendSms/config/dataPoints.ts"],"names":[],"mappings":";;;AAEa,QAAA,UAAU,GAAG;IACxB,SAAS,EAAE;QACT,GAAG,EAAE,WAAW;QAChB,SAAS,EAAE,QAAQ;KACpB;IACD,OAAO,EAAE;QACP,GAAG,EAAE,SAAS;QACd,SAAS,EAAE,SAAS;KACrB;IACD,IAAI,EAAE;QACJ,GAAG,EAAE,MAAM;QACX,SAAS,EAAE,QAAQ;KACpB;CAC4C,CAAA"}
|
|
@@ -5,6 +5,37 @@ const extensions_core_1 = require("@awell-health/extensions-core");
|
|
|
5
5
|
const validatePayloadAndCreateSdk_1 = require("../../lib/validatePayloadAndCreateSdk");
|
|
6
6
|
const config_1 = require("./config");
|
|
7
7
|
const addEventLog_1 = require("../../../../src/lib/awell/addEventLog");
|
|
8
|
+
const codes = [
|
|
9
|
+
{
|
|
10
|
+
code: 'INVALID_CONSUMER_NUMBER_FORMAT',
|
|
11
|
+
errorMessage: 'Invalid consumer number. The format of the consumer number used is incorrect. E.164 format is required',
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
code: 'CONTACT_CENTER_NUMBER_USED',
|
|
15
|
+
errorMessage: 'Zoom Contact Center numbers cannot be used as consumer numbers',
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
code: 'CONSUMER_NOT_OPTED_IN',
|
|
19
|
+
errorMessage: 'The consumer number you have messaged has not opted in',
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
code: 'CONSUMER_OPTED_OUT',
|
|
23
|
+
errorMessage: 'This consumer number has opted out of receiving SMS from this Zoom contact center number',
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
code: 'CONSUMER_BLOCK_LISTED',
|
|
27
|
+
errorMessage: 'This consumer number is a part of the block list defined by your Zoom Contact Center account administrator and cannot be messaged',
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
code: 'INTERNATIONAL_SMS_NOT_SUPPORTED',
|
|
31
|
+
errorMessage: 'International messaging is not supported on this account',
|
|
32
|
+
},
|
|
33
|
+
// Keep non-enum validations we have seen from API responses
|
|
34
|
+
{
|
|
35
|
+
code: 'BODY_TOO_LONG',
|
|
36
|
+
errorMessage: 'Validation error: String must contain at most 500 character(s)',
|
|
37
|
+
},
|
|
38
|
+
];
|
|
8
39
|
exports.sendSms = {
|
|
9
40
|
key: 'sendSms',
|
|
10
41
|
category: extensions_core_1.Category.COMMUNICATION,
|
|
@@ -14,7 +45,7 @@ exports.sendSms = {
|
|
|
14
45
|
previewable: false,
|
|
15
46
|
dataPoints: config_1.dataPoints,
|
|
16
47
|
onEvent: async ({ payload, onComplete, onError }) => {
|
|
17
|
-
var _a;
|
|
48
|
+
var _a, _b, _c;
|
|
18
49
|
const { fields, zoomSdk } = await (0, validatePayloadAndCreateSdk_1.validatePayloadAndCreateSdk)({
|
|
19
50
|
fieldsSchema: config_1.FieldsValidationSchema,
|
|
20
51
|
payload,
|
|
@@ -31,19 +62,38 @@ exports.sendSms = {
|
|
|
31
62
|
* All other errors are handled with AxiosError and caught in Extensions Core
|
|
32
63
|
*/
|
|
33
64
|
if (!data[0].success) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
65
|
+
const failureDescription = (_a = data[0].description) !== null && _a !== void 0 ? _a : 'Unknown error';
|
|
66
|
+
const code = (_b = codes.find((code) => failureDescription.includes(code.errorMessage))) === null || _b === void 0 ? void 0 : _b.code;
|
|
67
|
+
if (code !== undefined) {
|
|
68
|
+
await onComplete({
|
|
69
|
+
data_points: {
|
|
70
|
+
code,
|
|
71
|
+
success: String(false),
|
|
72
|
+
messageId: null,
|
|
73
|
+
},
|
|
74
|
+
events: [
|
|
75
|
+
(0, addEventLog_1.addActivityEventLog)({
|
|
76
|
+
message: failureDescription,
|
|
77
|
+
}),
|
|
78
|
+
],
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
await onError({
|
|
83
|
+
events: [
|
|
84
|
+
(0, addEventLog_1.addActivityEventLog)({
|
|
85
|
+
message: (_c = data[0].description) !== null && _c !== void 0 ? _c : 'Unknown error',
|
|
86
|
+
}),
|
|
87
|
+
],
|
|
88
|
+
});
|
|
89
|
+
}
|
|
41
90
|
return;
|
|
42
91
|
}
|
|
43
92
|
await onComplete({
|
|
44
93
|
data_points: {
|
|
45
94
|
messageId: data[0].message_id,
|
|
46
95
|
success: String(data[0].success),
|
|
96
|
+
code: 'SUCCESS',
|
|
47
97
|
},
|
|
48
98
|
events: [
|
|
49
99
|
(0, addEventLog_1.addActivityEventLog)({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sendSms.js","sourceRoot":"","sources":["../../../../../extensions/zoom/actions/sendSms/sendSms.ts"],"names":[],"mappings":";;;AACA,mEAAwD;AACxD,uFAAmF;AAEnF,qCAAqE;AACrE,uEAA2E;
|
|
1
|
+
{"version":3,"file":"sendSms.js","sourceRoot":"","sources":["../../../../../extensions/zoom/actions/sendSms/sendSms.ts"],"names":[],"mappings":";;;AACA,mEAAwD;AACxD,uFAAmF;AAEnF,qCAAqE;AACrE,uEAA2E;AAE3E,MAAM,KAAK,GAAG;IACZ;QACE,IAAI,EAAE,gCAAgC;QACtC,YAAY,EACV,wGAAwG;KAC3G;IACD;QACE,IAAI,EAAE,4BAA4B;QAClC,YAAY,EACV,gEAAgE;KACnE;IACD;QACE,IAAI,EAAE,uBAAuB;QAC7B,YAAY,EAAE,wDAAwD;KACvE;IACD;QACE,IAAI,EAAE,oBAAoB;QAC1B,YAAY,EACV,0FAA0F;KAC7F;IACD;QACE,IAAI,EAAE,uBAAuB;QAC7B,YAAY,EACV,mIAAmI;KACtI;IACD;QACE,IAAI,EAAE,iCAAiC;QACvC,YAAY,EAAE,0DAA0D;KACzE;IACD,4DAA4D;IAC5D;QACE,IAAI,EAAE,eAAe;QACrB,YAAY,EACV,gEAAgE;KACnE;CACF,CAAA;AAEY,QAAA,OAAO,GAIhB;IACF,GAAG,EAAE,SAAS;IACd,QAAQ,EAAE,0BAAQ,CAAC,aAAa;IAChC,KA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