@tiledesk/tiledesk-tybot-connector 2.0.8-rc2 → 2.0.8
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/CHANGELOG.md +5 -31
- package/ExtApi.js +8 -1
- package/ExtUtil.js +6 -5
- package/Logger.js +13 -30
- package/TdCache copy.js +242 -0
- package/engine/IntentForm.js +1 -0
- package/engine/IntentsMachineFactory.js +4 -4
- package/engine/MongodbBotsDataSource.js +1 -0
- package/engine/MongodbIntentsMachine.js +1 -0
- package/engine/TiledeskChatbot.js +16 -11
- package/engine/TiledeskIntentsMachine.js +2 -1
- package/engine/mock/MockBotsDataSource.js +2 -1
- package/index.js +25 -22
- package/logs/app1.log +1310 -0
- package/package.json +2 -3
- package/services/AIService.js +1 -1
- package/services/IntegrationService.js +1 -1
- package/services/TilebotService.js +1 -1
- package/tiledeskChatbotPlugs/DirectivesChatbotPlug.js +18 -24
- package/tiledeskChatbotPlugs/FillParamsChatbotPlug.js +2 -1
- package/tiledeskChatbotPlugs/MarkbotChatbotPlug.js +3 -1
- package/tiledeskChatbotPlugs/SplitsChatbotPlug.js +3 -1
- package/tiledeskChatbotPlugs/WebhookChatbotPlug.js +9 -7
- package/tiledeskChatbotPlugs/directives/DEPRECATED_DirIfNotOpenHours.js +10 -3
- package/tiledeskChatbotPlugs/directives/DEPRECATED_DirIfOpenHours.js +9 -2
- package/tiledeskChatbotPlugs/directives/DirAddTags.js +3 -1
- package/tiledeskChatbotPlugs/directives/DirAiPrompt.js +1 -0
- package/tiledeskChatbotPlugs/directives/DirAskGPT.js +1 -0
- package/tiledeskChatbotPlugs/directives/DirAskGPTV2.js +1 -0
- package/tiledeskChatbotPlugs/directives/DirAssign.js +8 -5
- package/tiledeskChatbotPlugs/directives/DirAssignFromFunction.js +3 -1
- package/tiledeskChatbotPlugs/directives/DirAssistant.js +1 -0
- package/tiledeskChatbotPlugs/directives/DirBrevo.js +6 -4
- package/tiledeskChatbotPlugs/directives/DirCaptureUserReply.js +1 -0
- package/tiledeskChatbotPlugs/directives/DirClose.js +2 -0
- package/tiledeskChatbotPlugs/directives/DirCode.js +1 -0
- package/tiledeskChatbotPlugs/directives/DirCondition.js +1 -0
- package/tiledeskChatbotPlugs/directives/DirConnectBlock.js +1 -0
- package/tiledeskChatbotPlugs/directives/DirContactUpdate.js +3 -1
- package/tiledeskChatbotPlugs/directives/DirCustomerio.js +1 -0
- package/tiledeskChatbotPlugs/directives/DirDeflectToHelpCenter.js +5 -2
- package/tiledeskChatbotPlugs/directives/DirDeleteVariable.js +1 -0
- package/tiledeskChatbotPlugs/directives/DirDepartment.js +3 -1
- package/tiledeskChatbotPlugs/directives/DirFireTiledeskEvent.js +3 -1
- package/tiledeskChatbotPlugs/directives/DirForm.js +3 -1
- package/tiledeskChatbotPlugs/directives/DirGptTask.js +1 -0
- package/tiledeskChatbotPlugs/directives/DirGptTask_OLD.js +55 -36
- package/tiledeskChatbotPlugs/directives/DirHubspot.js +1 -0
- package/tiledeskChatbotPlugs/directives/DirIfOnlineAgents.js +4 -1
- package/tiledeskChatbotPlugs/directives/DirIfOnlineAgentsV2.js +4 -1
- package/tiledeskChatbotPlugs/directives/DirIfOpenHours.js +2 -0
- package/tiledeskChatbotPlugs/directives/DirIfOpenHours_OLD.js +12 -8
- package/tiledeskChatbotPlugs/directives/DirIntent.js +5 -6
- package/tiledeskChatbotPlugs/directives/DirJSONCondition.js +1 -0
- package/tiledeskChatbotPlugs/directives/DirLockIntent.js +1 -0
- package/tiledeskChatbotPlugs/directives/DirMake.js +16 -1
- package/tiledeskChatbotPlugs/directives/DirMessage.js +3 -1
- package/tiledeskChatbotPlugs/directives/DirMessageToBot.js +1 -0
- package/tiledeskChatbotPlugs/directives/DirMoveToAgent.js +4 -1
- package/tiledeskChatbotPlugs/directives/DirMoveToUnassigned.js +3 -0
- package/tiledeskChatbotPlugs/directives/DirQapla.js +1 -0
- package/tiledeskChatbotPlugs/directives/DirRandomReply.js +3 -1
- package/tiledeskChatbotPlugs/directives/DirRemoveCurrentBot.js +2 -1
- package/tiledeskChatbotPlugs/directives/DirReplaceBot.js +3 -1
- package/tiledeskChatbotPlugs/directives/DirReplaceBotV2.js +3 -1
- package/tiledeskChatbotPlugs/directives/DirReplaceBotV3.js +3 -1
- package/tiledeskChatbotPlugs/directives/DirReply.js +18 -7
- package/tiledeskChatbotPlugs/directives/DirReplyV2.js +13 -8
- package/tiledeskChatbotPlugs/directives/DirSendEmail.js +3 -1
- package/tiledeskChatbotPlugs/directives/DirSendWhatsapp.js +1 -0
- package/tiledeskChatbotPlugs/directives/DirSetAttribute.js +1 -0
- package/tiledeskChatbotPlugs/directives/DirSetAttributeV2.js +4 -1
- package/tiledeskChatbotPlugs/directives/DirSetConversationTags.js +3 -1
- package/tiledeskChatbotPlugs/directives/DirUnlockIntent.js +1 -0
- package/tiledeskChatbotPlugs/directives/DirWait.js +1 -0
- package/tiledeskChatbotPlugs/directives/DirWebRequest.js +1 -0
- package/tiledeskChatbotPlugs/directives/DirWebRequestV2.js +16 -1
- package/tiledeskChatbotPlugs/directives/DirWebRequestV2_old.js +417 -0
- package/tiledeskChatbotPlugs/directives/DirWebResponse.js +39 -0
- package/tiledeskChatbotPlugs/directives/DirWhatsappByAttribute.js +1 -0
- package/tiledeskChatbotPlugs/directives/Directives.js +0 -1
- package/utils/TiledeskChatbotUtil.js +57 -19
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tiledesk/tiledesk-tybot-connector",
|
|
3
|
-
"version": "2.0.8
|
|
3
|
+
"version": "2.0.8",
|
|
4
4
|
"description": "Tiledesk Tybot connector",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"@tiledesk/tiledesk-chatbot-client": "^0.5.30",
|
|
16
16
|
"@tiledesk/tiledesk-chatbot-util": "^0.8.39",
|
|
17
17
|
"@tiledesk/tiledesk-client": "^0.10.13",
|
|
18
|
-
"@tiledesk/tiledesk-multi-worker": "^0.
|
|
18
|
+
"@tiledesk/tiledesk-multi-worker": "^0.2.1-rc2",
|
|
19
19
|
"accept-language-parser": "^1.5.0",
|
|
20
20
|
"app-root-path": "^3.1.0",
|
|
21
21
|
"axios": "^1.7.7",
|
|
@@ -29,7 +29,6 @@
|
|
|
29
29
|
"liquidjs": "^10.8.4",
|
|
30
30
|
"minimist-string": "^1.0.2",
|
|
31
31
|
"mongoose": "^6.3.5",
|
|
32
|
-
"mqtt": "^5.10.4",
|
|
33
32
|
"multer": "^1.4.5-lts.1",
|
|
34
33
|
"nanoid": "^3.1.25",
|
|
35
34
|
"redis": "^4.7.0",
|
package/services/AIService.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const httpUtils = require("../utils/HttpUtils");
|
|
2
2
|
const winston = require('../utils/winston');
|
|
3
|
-
const TILEBOT_ENDPOINT = process.env.TILEBOT_ENDPOINT
|
|
3
|
+
const TILEBOT_ENDPOINT = process.env.TILEBOT_ENDPOINT || `${process.env.API_ENDPOINT}/modules/tilebot`
|
|
4
4
|
|
|
5
5
|
class TilebotService {
|
|
6
6
|
|
|
@@ -73,6 +73,7 @@ class DirectivesChatbotPlug {
|
|
|
73
73
|
this.API_ENDPOINT = config.API_ENDPOINT;
|
|
74
74
|
this.TILEBOT_ENDPOINT = config.TILEBOT_ENDPOINT;
|
|
75
75
|
this.token = config.token;
|
|
76
|
+
this.log = config.log;
|
|
76
77
|
this.HELP_CENTER_API_ENDPOINT = config.HELP_CENTER_API_ENDPOINT;
|
|
77
78
|
this.tdcache = config.cache;
|
|
78
79
|
this.directives = config.directives;
|
|
@@ -141,7 +142,8 @@ class DirectivesChatbotPlug {
|
|
|
141
142
|
projectId: projectId,
|
|
142
143
|
token: token,
|
|
143
144
|
APIURL: API_ENDPOINT,
|
|
144
|
-
APIKEY: "___"
|
|
145
|
+
APIKEY: "___",
|
|
146
|
+
log: this.log
|
|
145
147
|
});
|
|
146
148
|
}
|
|
147
149
|
catch(err) {
|
|
@@ -160,7 +162,8 @@ class DirectivesChatbotPlug {
|
|
|
160
162
|
TILEBOT_ENDPOINT: TILEBOT_ENDPOINT,
|
|
161
163
|
departmentId: depId,
|
|
162
164
|
tdcache: tdcache,
|
|
163
|
-
HELP_CENTER_API_ENDPOINT: this.HELP_CENTER_API_ENDPOINT
|
|
165
|
+
HELP_CENTER_API_ENDPOINT: this.HELP_CENTER_API_ENDPOINT,
|
|
166
|
+
log: this.log
|
|
164
167
|
}
|
|
165
168
|
winston.debug("(DirectivesChatbotPlug) this.context.departmentId: " + this.context.departmentId);
|
|
166
169
|
|
|
@@ -174,7 +177,9 @@ class DirectivesChatbotPlug {
|
|
|
174
177
|
|
|
175
178
|
async nextDirective(directives) {
|
|
176
179
|
winston.debug("(DirectivesChatbotPlug) ....nextDirective() checkStep()");
|
|
177
|
-
const go_on = await TiledeskChatbot.checkStep(
|
|
180
|
+
const go_on = await TiledeskChatbot.checkStep(
|
|
181
|
+
this.context.tdcache, this.context.requestId, this.chatbot?.MAX_STEPS, this.chatbot?.MAX_EXECUTION_TIME, this.log
|
|
182
|
+
);
|
|
178
183
|
|
|
179
184
|
if (go_on.error) {
|
|
180
185
|
winston.debug("(DirectivesChatbotPlug) go_on == false! nextDirective() Stopped!");
|
|
@@ -217,13 +222,14 @@ class DirectivesChatbotPlug {
|
|
|
217
222
|
directive_name = directive.name.toLowerCase();
|
|
218
223
|
}
|
|
219
224
|
if (directive && directive.action) {
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
225
|
+
const action_id = directive.action["_tdActionId"];
|
|
226
|
+
const locked_action_id = await this.chatbot.currentLockedAction(this.supportRequest.request_id);
|
|
227
|
+
if ( locked_action_id && (locked_action_id !== action_id) ) {
|
|
228
|
+
let next_dir = await this.nextDirective(this.directives);
|
|
229
|
+
this.process(next_dir);
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
|
|
227
233
|
}
|
|
228
234
|
if (directive == null || (directive !== null && directive["name"] === undefined)) {
|
|
229
235
|
winston.debug("(DirectivesChatbotPlug) stop process(). directive is (null?): ", directive);
|
|
@@ -695,19 +701,6 @@ class DirectivesChatbotPlug {
|
|
|
695
701
|
}
|
|
696
702
|
});
|
|
697
703
|
}
|
|
698
|
-
else if (directive_name === Directives.WEBHOOK) {
|
|
699
|
-
// console.log(".....DirIntent")
|
|
700
|
-
new DirIntent(context).execute(directive, async (stop) => {
|
|
701
|
-
if (stop) {
|
|
702
|
-
if (context.log) { console.log("Stopping Actions on:", JSON.stringify(directive));}
|
|
703
|
-
this.theend();
|
|
704
|
-
}
|
|
705
|
-
else {
|
|
706
|
-
let next_dir = await this.nextDirective(this.directives);
|
|
707
|
-
this.process(next_dir);
|
|
708
|
-
}
|
|
709
|
-
});
|
|
710
|
-
}
|
|
711
704
|
else if (directive_name === Directives.WEB_RESPONSE) {
|
|
712
705
|
new DirWebResponse(context).execute(directive, async () => {
|
|
713
706
|
let next_dir = await this.nextDirective(this.directives);
|
|
@@ -740,7 +733,8 @@ class DirectivesChatbotPlug {
|
|
|
740
733
|
projectId: projectId,
|
|
741
734
|
token: token,
|
|
742
735
|
APIURL: API_ENDPOINT,
|
|
743
|
-
APIKEY: "___"
|
|
736
|
+
APIKEY: "___",
|
|
737
|
+
log: false
|
|
744
738
|
});
|
|
745
739
|
let i = -1;
|
|
746
740
|
winston.debug("(DirectivesChatbotPlug) processing Inline directives: ", directives);
|
|
@@ -3,10 +3,11 @@ const winston = require('../utils/winston');
|
|
|
3
3
|
|
|
4
4
|
class WebhookChatbotPlug {
|
|
5
5
|
|
|
6
|
-
constructor(supportRequest, webhookurl, token) {
|
|
6
|
+
constructor(supportRequest, webhookurl, token, log) {
|
|
7
7
|
this.supportRequest = supportRequest;
|
|
8
8
|
this.webhookurl = webhookurl;
|
|
9
9
|
this.token = token;
|
|
10
|
+
this.log = log;
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
exec(pipeline) {
|
|
@@ -100,18 +101,19 @@ class WebhookChatbotPlug {
|
|
|
100
101
|
callback(null, res.data);
|
|
101
102
|
}
|
|
102
103
|
}
|
|
103
|
-
}
|
|
104
|
+
}, this.log
|
|
105
|
+
);
|
|
104
106
|
}
|
|
105
107
|
|
|
106
108
|
// ************************************************
|
|
107
109
|
// ****************** HTTP REQUEST ****************
|
|
108
110
|
// ************************************************
|
|
109
111
|
|
|
110
|
-
static myrequest(options, callback) {
|
|
111
|
-
|
|
112
|
+
static myrequest(options, callback, log) {
|
|
113
|
+
if (log) {
|
|
112
114
|
winston.debug("(WebhookChatbotPlug) myrequest API URL:" + options.url);
|
|
113
115
|
winston.debug("(WebhookChatbotPlug) myrequest Options:", options);
|
|
114
|
-
|
|
116
|
+
}
|
|
115
117
|
axios(
|
|
116
118
|
{
|
|
117
119
|
url: options.url,
|
|
@@ -120,11 +122,11 @@ class WebhookChatbotPlug {
|
|
|
120
122
|
headers: options.headers
|
|
121
123
|
})
|
|
122
124
|
.then(function (res) {
|
|
123
|
-
|
|
125
|
+
if (log) {
|
|
124
126
|
winston.debug("(WebhookChatbotPlug) myrequest Response for url:", options.url);
|
|
125
127
|
winston.debug("(WebhookChatbotPlug) myrequest Response headers:\n", res.headers);
|
|
126
128
|
winston.debug("(WebhookChatbotPlug) myrequest Response body:\n", res.data);
|
|
127
|
-
|
|
129
|
+
}
|
|
128
130
|
if (callback) {
|
|
129
131
|
callback(null, res);
|
|
130
132
|
}
|
|
@@ -12,7 +12,8 @@ class DirIfNotOpenHours {
|
|
|
12
12
|
projectId: context.projectId,
|
|
13
13
|
token: context.token,
|
|
14
14
|
APIURL: context.TILEDESK_APIURL,
|
|
15
|
-
APIKEY: "___"
|
|
15
|
+
APIKEY: "___",
|
|
16
|
+
log: context.log
|
|
16
17
|
});
|
|
17
18
|
// this.intentDir = config.intentDir;
|
|
18
19
|
// let context = {
|
|
@@ -21,16 +22,19 @@ class DirIfNotOpenHours {
|
|
|
21
22
|
// requestId: supportRequest,
|
|
22
23
|
// APIURL: API_URL,
|
|
23
24
|
// TILEBOT_ENDPOINT:TILEBOT_ENDPOINT,
|
|
24
|
-
// departmentId: depId
|
|
25
|
+
// departmentId: depId,
|
|
26
|
+
// log: false
|
|
25
27
|
// }
|
|
26
28
|
this.intentDir = new DirIntent(
|
|
27
29
|
{
|
|
28
30
|
API_ENDPOINT: context.TILEDESK_APIURL,
|
|
29
31
|
TILEBOT_ENDPOINT: context.TILEBOT_ENDPOINT,
|
|
30
32
|
supportRequest: context.supportRequest,
|
|
31
|
-
token: context.token
|
|
33
|
+
token: context.token,
|
|
34
|
+
log: context.log
|
|
32
35
|
}
|
|
33
36
|
);
|
|
37
|
+
this.log = context.log;
|
|
34
38
|
}
|
|
35
39
|
|
|
36
40
|
execute(directive, callback) {
|
|
@@ -54,6 +58,7 @@ class DirIfNotOpenHours {
|
|
|
54
58
|
go(action, callback) {
|
|
55
59
|
const intentName = action.body.intentName;
|
|
56
60
|
if (!intentName) {
|
|
61
|
+
if (this.log) {console.log("Invalid intent name for If-open-hours");}
|
|
57
62
|
callback();
|
|
58
63
|
}
|
|
59
64
|
let intentDirective = {
|
|
@@ -64,11 +69,13 @@ class DirIfNotOpenHours {
|
|
|
64
69
|
}
|
|
65
70
|
}
|
|
66
71
|
this.tdclient.openNow((err, result) => {
|
|
72
|
+
if (this.log) {console.log("openNow():", result);}
|
|
67
73
|
if (err) {
|
|
68
74
|
console.error("DirIfNotOpenHours Error:", err);
|
|
69
75
|
callback();
|
|
70
76
|
}
|
|
71
77
|
else if (result && !result.isopen) {
|
|
78
|
+
if (this.log) {console.log("executing the action on 'closed'");}
|
|
72
79
|
this.intentDir.execute(intentDirective, () => {
|
|
73
80
|
callback();
|
|
74
81
|
});
|
|
@@ -12,7 +12,8 @@ class DirIfOpenHours {
|
|
|
12
12
|
projectId: context.projectId,
|
|
13
13
|
token: context.token,
|
|
14
14
|
APIURL: context.TILEDESK_APIURL,
|
|
15
|
-
APIKEY: "___"
|
|
15
|
+
APIKEY: "___",
|
|
16
|
+
log: context.log
|
|
16
17
|
});
|
|
17
18
|
// let context = {
|
|
18
19
|
// projectId: projectId,
|
|
@@ -21,6 +22,7 @@ class DirIfOpenHours {
|
|
|
21
22
|
// APIURL: API_URL,
|
|
22
23
|
// TILEBOT_ENDPOINT:TILEBOT_ENDPOINT,
|
|
23
24
|
// departmentId: depId,
|
|
25
|
+
// log: false
|
|
24
26
|
// }
|
|
25
27
|
this.intentDir = new DirIntent(
|
|
26
28
|
{
|
|
@@ -28,8 +30,10 @@ class DirIfOpenHours {
|
|
|
28
30
|
TILEBOT_ENDPOINT: context.TILEBOT_ENDPOINT,
|
|
29
31
|
supportRequest: context.supportRequest,
|
|
30
32
|
token: context.token,
|
|
33
|
+
log: context.log
|
|
31
34
|
}
|
|
32
|
-
)
|
|
35
|
+
);
|
|
36
|
+
this.log = context.log;
|
|
33
37
|
}
|
|
34
38
|
|
|
35
39
|
execute(directive, callback) {
|
|
@@ -52,6 +56,7 @@ class DirIfOpenHours {
|
|
|
52
56
|
go(action, callback) {
|
|
53
57
|
const intentName = action.body.intentName;
|
|
54
58
|
if (!intentName) {
|
|
59
|
+
if (this.log) {console.log("Invalid intent name for If-open-hours");}
|
|
55
60
|
callback();
|
|
56
61
|
}
|
|
57
62
|
let intentDirective = {
|
|
@@ -62,11 +67,13 @@ class DirIfOpenHours {
|
|
|
62
67
|
}
|
|
63
68
|
}
|
|
64
69
|
this.tdclient.openNow((err, result) => {
|
|
70
|
+
if (this.log) {console.log("openNow():", result);}
|
|
65
71
|
if (err) {
|
|
66
72
|
console.error("DirIfOpenHours Error:", err);
|
|
67
73
|
callback();
|
|
68
74
|
}
|
|
69
75
|
else if (result && result.isopen) {
|
|
76
|
+
if (this.log) {console.log("executing the action on 'open'");}
|
|
70
77
|
this.intentDir.execute(intentDirective, () => {
|
|
71
78
|
callback();
|
|
72
79
|
});
|
|
@@ -23,12 +23,14 @@ class DirAddTags {
|
|
|
23
23
|
this.tdcache = this.context.tdcache;
|
|
24
24
|
this.requestId = this.context.requestId;
|
|
25
25
|
this.API_ENDPOINT = this.context.API_ENDPOINT;
|
|
26
|
+
this.log = context.log;
|
|
26
27
|
|
|
27
28
|
this.tdClient = new TiledeskClient({
|
|
28
29
|
projectId: this.context.projectId,
|
|
29
30
|
token: this.context.token,
|
|
30
31
|
APIURL: this.API_ENDPOINT,
|
|
31
|
-
APIKEY: "___"
|
|
32
|
+
APIKEY: "___",
|
|
33
|
+
log: this.log
|
|
32
34
|
});
|
|
33
35
|
}
|
|
34
36
|
|
|
@@ -11,6 +11,7 @@ class DirAssign {
|
|
|
11
11
|
throw new Error('context object is mandatory.');
|
|
12
12
|
}
|
|
13
13
|
this.context = context;
|
|
14
|
+
this.log = context.log;
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
execute(directive, callback) {
|
|
@@ -62,11 +63,13 @@ class DirAssign {
|
|
|
62
63
|
const value = new TiledeskExpression().evaluateExpression(expression, variables);
|
|
63
64
|
winston.debug("(DirAssign) executed expression: " + expression + " value: " + value);
|
|
64
65
|
await TiledeskChatbot.addParameterStatic(this.context.tdcache, this.context.requestId, variableName, value);
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
const
|
|
69
|
-
|
|
66
|
+
if (this.log) {
|
|
67
|
+
winston.debug("(DirAssign) Assigned: " + variableName + " = " + value);
|
|
68
|
+
const all_parameters = await TiledeskChatbot.allParametersStatic(this.context.tdcache, this.context.requestId);
|
|
69
|
+
for (const [key, value] of Object.entries(all_parameters)) {
|
|
70
|
+
const value_type = typeof value;
|
|
71
|
+
winston.debug("(DirAssign) request parameter: " + key + " value: " + value + " type: " + value_type)
|
|
72
|
+
}
|
|
70
73
|
}
|
|
71
74
|
|
|
72
75
|
callback();
|
|
@@ -10,6 +10,7 @@ class DirAssignFromFunction {
|
|
|
10
10
|
throw new Error('context object is mandatory.');
|
|
11
11
|
}
|
|
12
12
|
this.context = context;
|
|
13
|
+
this.log = context.log;
|
|
13
14
|
this.tdcache = context.tdcache;
|
|
14
15
|
this.API_ENDPOINT = context.API_ENDPOINT;
|
|
15
16
|
|
|
@@ -17,7 +18,8 @@ class DirAssignFromFunction {
|
|
|
17
18
|
projectId: this.context.projectId,
|
|
18
19
|
token: this.context.token,
|
|
19
20
|
APIURL: this.API_ENDPOINT,
|
|
20
|
-
APIKEY: "___"
|
|
21
|
+
APIKEY: "___",
|
|
22
|
+
log: this.log
|
|
21
23
|
});
|
|
22
24
|
}
|
|
23
25
|
|
|
@@ -20,6 +20,7 @@ class DirBrevo {
|
|
|
20
20
|
this.token = this.context.token;
|
|
21
21
|
this.intentDir = new DirIntent(context);
|
|
22
22
|
this.API_ENDPOINT = this.context.API_ENDPOINT;
|
|
23
|
+
this.log = context.log;
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
execute(directive, callback) {
|
|
@@ -157,10 +158,11 @@ class DirBrevo {
|
|
|
157
158
|
error = err.response.data.message;
|
|
158
159
|
}
|
|
159
160
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
161
|
+
if (this.log) {
|
|
162
|
+
winston.error("(DirBrevo) DirBrevo err data result:", result); // CONTROLLA IL VALORE
|
|
163
|
+
winston.error("(DirBrevo) DirBrevo err data status:", status);
|
|
164
|
+
winston.error("(DirBrevo) DirBrevo err data error:", error);
|
|
165
|
+
}
|
|
164
166
|
|
|
165
167
|
await this.#assignAttributes(action, status, result, error);
|
|
166
168
|
if (falseIntent) {
|
|
@@ -13,12 +13,14 @@ class DirClose {
|
|
|
13
13
|
this.requestId = context.requestId;
|
|
14
14
|
this.chatbot = context.chatbot;
|
|
15
15
|
this.API_ENDPOINT = context.API_ENDPOINT;
|
|
16
|
+
this.log = context.log;
|
|
16
17
|
|
|
17
18
|
this.tdClient = new TiledeskClient({
|
|
18
19
|
projectId: this.context.projectId,
|
|
19
20
|
token: this.context.token,
|
|
20
21
|
APIURL: this.API_ENDPOINT,
|
|
21
22
|
APIKEY: "___",
|
|
23
|
+
log: this.log
|
|
22
24
|
});
|
|
23
25
|
}
|
|
24
26
|
|
|
@@ -19,12 +19,14 @@ class DirContactUpdate {
|
|
|
19
19
|
this.token = context.token;
|
|
20
20
|
this.tdcache = context.tdcache;
|
|
21
21
|
this.API_ENDPOINT = context.API_ENDPOINT;
|
|
22
|
+
this.log = context.log;
|
|
22
23
|
|
|
23
24
|
this.tdClient = new TiledeskClient({
|
|
24
25
|
projectId: this.context.projectId,
|
|
25
26
|
token: this.context.token,
|
|
26
27
|
APIURL: this.API_ENDPOINT,
|
|
27
|
-
APIKEY: "___"
|
|
28
|
+
APIKEY: "___",
|
|
29
|
+
log: this.log
|
|
28
30
|
});
|
|
29
31
|
}
|
|
30
32
|
|
|
@@ -13,12 +13,14 @@ class DirDeflectToHelpCenter {
|
|
|
13
13
|
}
|
|
14
14
|
this.context = context;
|
|
15
15
|
this.API_ENDPOINT = context.API_ENDPOINT;
|
|
16
|
+
this.log = context.log;
|
|
16
17
|
|
|
17
18
|
this.tdClient = new TiledeskClient({
|
|
18
19
|
projectId: this.context.projectId,
|
|
19
20
|
token: this.context.token,
|
|
20
21
|
APIURL: this.API_ENDPOINT,
|
|
21
|
-
APIKEY: "___"
|
|
22
|
+
APIKEY: "___",
|
|
23
|
+
log: this.log
|
|
22
24
|
});
|
|
23
25
|
}
|
|
24
26
|
|
|
@@ -68,7 +70,8 @@ class DirDeflectToHelpCenter {
|
|
|
68
70
|
if (last_user_text && last_user_text.trim() !== '') {
|
|
69
71
|
const helpcenter = new HelpCenterQuery({
|
|
70
72
|
APIKEY: "__",
|
|
71
|
-
projectId: project_id
|
|
73
|
+
projectId: project_id,
|
|
74
|
+
log: false
|
|
72
75
|
});
|
|
73
76
|
if (this.helpcenter_api_endpoint) {
|
|
74
77
|
helpcenter.APIURL = this.helpcenter_api_endpoint
|
|
@@ -10,12 +10,14 @@ class DirDepartment {
|
|
|
10
10
|
this.context = context;
|
|
11
11
|
this.requestId = context.requestId;
|
|
12
12
|
this.API_ENDPOINT = context.API_ENDPOINT;
|
|
13
|
+
this.log = context.log;
|
|
13
14
|
|
|
14
15
|
this.tdClient = new TiledeskClient({
|
|
15
16
|
projectId: this.context.projectId,
|
|
16
17
|
token: this.context.token,
|
|
17
18
|
APIURL: this.API_ENDPOINT,
|
|
18
|
-
APIKEY: "___"
|
|
19
|
+
APIKEY: "___",
|
|
20
|
+
log: this.log
|
|
19
21
|
});
|
|
20
22
|
}
|
|
21
23
|
|
|
@@ -10,13 +10,15 @@ class DirFireTiledeskEvent {
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
this.context = context;
|
|
13
|
+
this.log = context.log;
|
|
13
14
|
|
|
14
15
|
this.API_ENDPOINT = context.API_ENDPOINT;
|
|
15
16
|
this.tdClient = new TiledeskClient({
|
|
16
17
|
projectId: this.context.projectId,
|
|
17
18
|
token: this.context.token,
|
|
18
19
|
APIURL: this.API_ENDPOINT,
|
|
19
|
-
APIKEY: "___"
|
|
20
|
+
APIKEY: "___",
|
|
21
|
+
log: this.log
|
|
20
22
|
});
|
|
21
23
|
}
|
|
22
24
|
|
|
@@ -15,13 +15,15 @@ class DirForm {
|
|
|
15
15
|
this.tdcache = context.tdcache;
|
|
16
16
|
this.requestId = context.requestId;
|
|
17
17
|
this.intentDir = new DirIntent(context);
|
|
18
|
+
this.log = context.log;
|
|
18
19
|
|
|
19
20
|
this.API_ENDPOINT = context.API_ENDPOINT;
|
|
20
21
|
this.tdClient = new TiledeskClient({
|
|
21
22
|
projectId: this.context.projectId,
|
|
22
23
|
token: this.context.token,
|
|
23
24
|
APIURL: this.API_ENDPOINT,
|
|
24
|
-
APIKEY: "___"
|
|
25
|
+
APIKEY: "___",
|
|
26
|
+
log: this.log
|
|
25
27
|
});
|
|
26
28
|
|
|
27
29
|
}
|