@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.
Files changed (82) hide show
  1. package/CHANGELOG.md +5 -31
  2. package/ExtApi.js +8 -1
  3. package/ExtUtil.js +6 -5
  4. package/Logger.js +13 -30
  5. package/TdCache copy.js +242 -0
  6. package/engine/IntentForm.js +1 -0
  7. package/engine/IntentsMachineFactory.js +4 -4
  8. package/engine/MongodbBotsDataSource.js +1 -0
  9. package/engine/MongodbIntentsMachine.js +1 -0
  10. package/engine/TiledeskChatbot.js +16 -11
  11. package/engine/TiledeskIntentsMachine.js +2 -1
  12. package/engine/mock/MockBotsDataSource.js +2 -1
  13. package/index.js +25 -22
  14. package/logs/app1.log +1310 -0
  15. package/package.json +2 -3
  16. package/services/AIService.js +1 -1
  17. package/services/IntegrationService.js +1 -1
  18. package/services/TilebotService.js +1 -1
  19. package/tiledeskChatbotPlugs/DirectivesChatbotPlug.js +18 -24
  20. package/tiledeskChatbotPlugs/FillParamsChatbotPlug.js +2 -1
  21. package/tiledeskChatbotPlugs/MarkbotChatbotPlug.js +3 -1
  22. package/tiledeskChatbotPlugs/SplitsChatbotPlug.js +3 -1
  23. package/tiledeskChatbotPlugs/WebhookChatbotPlug.js +9 -7
  24. package/tiledeskChatbotPlugs/directives/DEPRECATED_DirIfNotOpenHours.js +10 -3
  25. package/tiledeskChatbotPlugs/directives/DEPRECATED_DirIfOpenHours.js +9 -2
  26. package/tiledeskChatbotPlugs/directives/DirAddTags.js +3 -1
  27. package/tiledeskChatbotPlugs/directives/DirAiPrompt.js +1 -0
  28. package/tiledeskChatbotPlugs/directives/DirAskGPT.js +1 -0
  29. package/tiledeskChatbotPlugs/directives/DirAskGPTV2.js +1 -0
  30. package/tiledeskChatbotPlugs/directives/DirAssign.js +8 -5
  31. package/tiledeskChatbotPlugs/directives/DirAssignFromFunction.js +3 -1
  32. package/tiledeskChatbotPlugs/directives/DirAssistant.js +1 -0
  33. package/tiledeskChatbotPlugs/directives/DirBrevo.js +6 -4
  34. package/tiledeskChatbotPlugs/directives/DirCaptureUserReply.js +1 -0
  35. package/tiledeskChatbotPlugs/directives/DirClose.js +2 -0
  36. package/tiledeskChatbotPlugs/directives/DirCode.js +1 -0
  37. package/tiledeskChatbotPlugs/directives/DirCondition.js +1 -0
  38. package/tiledeskChatbotPlugs/directives/DirConnectBlock.js +1 -0
  39. package/tiledeskChatbotPlugs/directives/DirContactUpdate.js +3 -1
  40. package/tiledeskChatbotPlugs/directives/DirCustomerio.js +1 -0
  41. package/tiledeskChatbotPlugs/directives/DirDeflectToHelpCenter.js +5 -2
  42. package/tiledeskChatbotPlugs/directives/DirDeleteVariable.js +1 -0
  43. package/tiledeskChatbotPlugs/directives/DirDepartment.js +3 -1
  44. package/tiledeskChatbotPlugs/directives/DirFireTiledeskEvent.js +3 -1
  45. package/tiledeskChatbotPlugs/directives/DirForm.js +3 -1
  46. package/tiledeskChatbotPlugs/directives/DirGptTask.js +1 -0
  47. package/tiledeskChatbotPlugs/directives/DirGptTask_OLD.js +55 -36
  48. package/tiledeskChatbotPlugs/directives/DirHubspot.js +1 -0
  49. package/tiledeskChatbotPlugs/directives/DirIfOnlineAgents.js +4 -1
  50. package/tiledeskChatbotPlugs/directives/DirIfOnlineAgentsV2.js +4 -1
  51. package/tiledeskChatbotPlugs/directives/DirIfOpenHours.js +2 -0
  52. package/tiledeskChatbotPlugs/directives/DirIfOpenHours_OLD.js +12 -8
  53. package/tiledeskChatbotPlugs/directives/DirIntent.js +5 -6
  54. package/tiledeskChatbotPlugs/directives/DirJSONCondition.js +1 -0
  55. package/tiledeskChatbotPlugs/directives/DirLockIntent.js +1 -0
  56. package/tiledeskChatbotPlugs/directives/DirMake.js +16 -1
  57. package/tiledeskChatbotPlugs/directives/DirMessage.js +3 -1
  58. package/tiledeskChatbotPlugs/directives/DirMessageToBot.js +1 -0
  59. package/tiledeskChatbotPlugs/directives/DirMoveToAgent.js +4 -1
  60. package/tiledeskChatbotPlugs/directives/DirMoveToUnassigned.js +3 -0
  61. package/tiledeskChatbotPlugs/directives/DirQapla.js +1 -0
  62. package/tiledeskChatbotPlugs/directives/DirRandomReply.js +3 -1
  63. package/tiledeskChatbotPlugs/directives/DirRemoveCurrentBot.js +2 -1
  64. package/tiledeskChatbotPlugs/directives/DirReplaceBot.js +3 -1
  65. package/tiledeskChatbotPlugs/directives/DirReplaceBotV2.js +3 -1
  66. package/tiledeskChatbotPlugs/directives/DirReplaceBotV3.js +3 -1
  67. package/tiledeskChatbotPlugs/directives/DirReply.js +18 -7
  68. package/tiledeskChatbotPlugs/directives/DirReplyV2.js +13 -8
  69. package/tiledeskChatbotPlugs/directives/DirSendEmail.js +3 -1
  70. package/tiledeskChatbotPlugs/directives/DirSendWhatsapp.js +1 -0
  71. package/tiledeskChatbotPlugs/directives/DirSetAttribute.js +1 -0
  72. package/tiledeskChatbotPlugs/directives/DirSetAttributeV2.js +4 -1
  73. package/tiledeskChatbotPlugs/directives/DirSetConversationTags.js +3 -1
  74. package/tiledeskChatbotPlugs/directives/DirUnlockIntent.js +1 -0
  75. package/tiledeskChatbotPlugs/directives/DirWait.js +1 -0
  76. package/tiledeskChatbotPlugs/directives/DirWebRequest.js +1 -0
  77. package/tiledeskChatbotPlugs/directives/DirWebRequestV2.js +16 -1
  78. package/tiledeskChatbotPlugs/directives/DirWebRequestV2_old.js +417 -0
  79. package/tiledeskChatbotPlugs/directives/DirWebResponse.js +39 -0
  80. package/tiledeskChatbotPlugs/directives/DirWhatsappByAttribute.js +1 -0
  81. package/tiledeskChatbotPlugs/directives/Directives.js +0 -1
  82. 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-rc2",
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.3.1-rc10",
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",
@@ -31,7 +31,7 @@ class AiService {
31
31
  else {
32
32
  resolve(resbody)
33
33
  }
34
- }
34
+ }, this.LOG
35
35
  );
36
36
  });
37
37
  }
@@ -1,6 +1,6 @@
1
1
  const httpUtils = require('../utils/HttpUtils');
2
2
  const winston = require('../utils/winston');
3
- let API_ENDPOINT = process.env.API_ENDPOINT;
3
+ const API_ENDPOINT = process.env.API_ENDPOINT;
4
4
 
5
5
  class IntegrationService {
6
6
 
@@ -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(this.context.tdcache, this.context.requestId, this.chatbot?.MAX_STEPS, this.chatbot?.MAX_EXECUTION_TIME);
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
- const action_id = directive.action["_tdActionId"];
221
- const locked_action_id = await this.chatbot.currentLockedAction(this.supportRequest.request_id);
222
- if ( locked_action_id && (locked_action_id !== action_id) ) {
223
- let next_dir = await this.nextDirective(this.directives);
224
- this.process(next_dir);
225
- return;
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);
@@ -11,7 +11,8 @@ class FillParamsChatbotPlug {
11
11
  *
12
12
  */
13
13
 
14
- constructor(request, tdcache) {
14
+ constructor(request, tdcache, log) {
15
+ this.log = log;
15
16
  this.tdcache = tdcache;
16
17
  this.request = request;
17
18
  }
@@ -10,7 +10,9 @@ class MarkbotChatbotPlug {
10
10
  *
11
11
  */
12
12
 
13
- constructor() {}
13
+ constructor(log) {
14
+ this.log = log;
15
+ }
14
16
 
15
17
  exec(pipeline) {
16
18
  let message = pipeline.message;
@@ -10,7 +10,9 @@ class SplitsChatbotPlug {
10
10
  *
11
11
  */
12
12
 
13
- constructor() {}
13
+ constructor(log) {
14
+ this.log = log;
15
+ }
14
16
 
15
17
  exec(pipeline) {
16
18
  let message = pipeline.message;
@@ -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
 
@@ -27,6 +27,7 @@ class DirAiPrompt {
27
27
  this.token = this.context.token;
28
28
  this.intentDir = new DirIntent(context);
29
29
  this.API_ENDPOINT = this.context.API_ENDPOINT;
30
+ this.log = context.log;
30
31
  }
31
32
 
32
33
  execute(directive, callback) {
@@ -21,6 +21,7 @@ class DirAskGPT {
21
21
  this.token = this.context.token;
22
22
  this.intentDir = new DirIntent(context);
23
23
  this.API_ENDPOINT = this.context.API_ENDPOINT;
24
+ this.log = context.log;
24
25
  }
25
26
 
26
27
  execute(directive, callback) {
@@ -25,6 +25,7 @@ class DirAskGPTV2 {
25
25
  this.token = this.context.token;
26
26
  this.intentDir = new DirIntent(context);
27
27
  this.API_ENDPOINT = this.context.API_ENDPOINT;
28
+ this.log = context.log;
28
29
  }
29
30
 
30
31
  execute(directive, callback) {
@@ -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
- winston.debug("(DirAssign) Assigned: " + variableName + " = " + value);
66
- const all_parameters = await TiledeskChatbot.allParametersStatic(this.context.tdcache, this.context.requestId);
67
- for (const [key, value] of Object.entries(all_parameters)) {
68
- const value_type = typeof value;
69
- winston.debug("(DirAssign) request parameter: " + key + " value: " + value + " type: " + value_type)
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
 
@@ -19,6 +19,7 @@ class DirAssistant {
19
19
  this.token = this.context.token;
20
20
  this.intentDir = new DirIntent(context);
21
21
  this.API_ENDPOINT = context.API_ENDPOINT;
22
+ this.log = context.log;
22
23
  }
23
24
 
24
25
  execute(directive, callback) {
@@ -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
- winston.error("(DirBrevo) DirBrevo err data result:", result); // CONTROLLA IL VALORE
161
- winston.error("(DirBrevo) DirBrevo err data status:", status);
162
- winston.error("(DirBrevo) DirBrevo err data error:", error);
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) {
@@ -16,6 +16,7 @@ class DirCaptureUserReply {
16
16
  this.tdcache = context.tdcache;
17
17
  this.requestId = context.requestId;
18
18
  this.intentDir = new DirIntent(context);
19
+ this.log = context.log;
19
20
  }
20
21
 
21
22
  execute(directive, callback) {
@@ -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
 
@@ -10,6 +10,7 @@ class DirCode {
10
10
  throw new Error('context object is mandatory.');
11
11
  }
12
12
  this.context = context;
13
+ this.log = context.log;
13
14
  }
14
15
 
15
16
  execute(directive, callback) {
@@ -12,6 +12,7 @@ class DirCondition {
12
12
  }
13
13
  this.context = context;
14
14
  this.intentDir = new DirIntent(context);
15
+ this.log = context.log;
15
16
  }
16
17
 
17
18
  execute(directive, callback) {
@@ -15,6 +15,7 @@ class DirConnectBlock {
15
15
  this.TILEBOT_ENDPOINT = context.TILEBOT_ENDPOINT;
16
16
  this.supportRequest = context.supportRequest;
17
17
  this.token = context.token;
18
+ this.log = context.log;
18
19
  }
19
20
 
20
21
  execute(directive, callback) {
@@ -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
 
@@ -20,6 +20,7 @@ class DirCustomerio {
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) {
@@ -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
@@ -11,6 +11,7 @@ class DirDeleteVariable {
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
  async execute(directive, callback) {
@@ -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
  }
@@ -24,6 +24,7 @@ class DirGptTask {
24
24
  this.token = this.context.token;
25
25
  this.intentDir = new DirIntent(context);
26
26
  this.API_ENDPOINT = this.context.API_ENDPOINT;
27
+ this.log = context.log;
27
28
  }
28
29
 
29
30
  execute(directive, callback) {