@tiledesk/tiledesk-tybot-connector 2.0.9 → 2.0.10-rc2

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 (87) hide show
  1. package/CHANGELOG.md +27 -2
  2. package/ExtApi.js +1 -8
  3. package/ExtUtil.js +5 -6
  4. package/Logger.js +27 -17
  5. package/engine/IntentForm.js +0 -1
  6. package/engine/IntentsMachineFactory.js +4 -4
  7. package/engine/MongodbBotsDataSource.js +0 -1
  8. package/engine/MongodbIntentsMachine.js +0 -1
  9. package/engine/TiledeskChatbot.js +11 -16
  10. package/engine/TiledeskIntentsMachine.js +1 -2
  11. package/engine/mock/MockBotsDataSource.js +1 -2
  12. package/index.js +22 -25
  13. package/logs/app.log +11066 -20247
  14. package/logs/app2.log +46280 -0
  15. package/logs/app3.log +31686 -0
  16. package/logs/app4.log +46163 -0
  17. package/logs/app5.log +39983 -0
  18. package/logs/app6.log +5964 -0
  19. package/package.json +3 -2
  20. package/services/AIService.js +1 -1
  21. package/tiledeskChatbotPlugs/DirectivesChatbotPlug.js +31 -18
  22. package/tiledeskChatbotPlugs/FillParamsChatbotPlug.js +1 -2
  23. package/tiledeskChatbotPlugs/MarkbotChatbotPlug.js +1 -3
  24. package/tiledeskChatbotPlugs/SplitsChatbotPlug.js +1 -3
  25. package/tiledeskChatbotPlugs/WebhookChatbotPlug.js +7 -9
  26. package/tiledeskChatbotPlugs/directives/DEPRECATED_DirIfNotOpenHours.js +3 -10
  27. package/tiledeskChatbotPlugs/directives/DEPRECATED_DirIfOpenHours.js +2 -9
  28. package/tiledeskChatbotPlugs/directives/DirAddTags.js +16 -4
  29. package/tiledeskChatbotPlugs/directives/DirAiPrompt.js +16 -0
  30. package/tiledeskChatbotPlugs/directives/DirAskGPT.js +0 -1
  31. package/tiledeskChatbotPlugs/directives/DirAskGPTV2.js +16 -0
  32. package/tiledeskChatbotPlugs/directives/DirAssign.js +5 -8
  33. package/tiledeskChatbotPlugs/directives/DirAssignFromFunction.js +1 -3
  34. package/tiledeskChatbotPlugs/directives/DirAssistant.js +0 -1
  35. package/tiledeskChatbotPlugs/directives/DirBrevo.js +4 -6
  36. package/tiledeskChatbotPlugs/directives/DirCaptureUserReply.js +0 -1
  37. package/tiledeskChatbotPlugs/directives/DirClose.js +0 -2
  38. package/tiledeskChatbotPlugs/directives/DirCode.js +0 -1
  39. package/tiledeskChatbotPlugs/directives/DirCondition.js +0 -1
  40. package/tiledeskChatbotPlugs/directives/DirConnectBlock.js +0 -1
  41. package/tiledeskChatbotPlugs/directives/DirContactUpdate.js +1 -3
  42. package/tiledeskChatbotPlugs/directives/DirCustomerio.js +0 -1
  43. package/tiledeskChatbotPlugs/directives/DirDeflectToHelpCenter.js +2 -5
  44. package/tiledeskChatbotPlugs/directives/DirDeleteVariable.js +0 -1
  45. package/tiledeskChatbotPlugs/directives/DirDepartment.js +1 -3
  46. package/tiledeskChatbotPlugs/directives/DirFireTiledeskEvent.js +1 -3
  47. package/tiledeskChatbotPlugs/directives/DirFlowLog.js +76 -0
  48. package/tiledeskChatbotPlugs/directives/DirForm.js +1 -3
  49. package/tiledeskChatbotPlugs/directives/DirGptTask.js +0 -1
  50. package/tiledeskChatbotPlugs/directives/DirGptTask_OLD.js +36 -55
  51. package/tiledeskChatbotPlugs/directives/DirHubspot.js +0 -1
  52. package/tiledeskChatbotPlugs/directives/DirIfOnlineAgents.js +1 -4
  53. package/tiledeskChatbotPlugs/directives/DirIfOnlineAgentsV2.js +1 -4
  54. package/tiledeskChatbotPlugs/directives/DirIfOpenHours.js +0 -2
  55. package/tiledeskChatbotPlugs/directives/DirIfOpenHours_OLD.js +8 -12
  56. package/tiledeskChatbotPlugs/directives/DirIntent.js +6 -5
  57. package/tiledeskChatbotPlugs/directives/DirJSONCondition.js +0 -1
  58. package/tiledeskChatbotPlugs/directives/DirLockIntent.js +0 -1
  59. package/tiledeskChatbotPlugs/directives/DirMake.js +1 -16
  60. package/tiledeskChatbotPlugs/directives/DirMessage.js +1 -3
  61. package/tiledeskChatbotPlugs/directives/DirMessageToBot.js +0 -1
  62. package/tiledeskChatbotPlugs/directives/DirMoveToAgent.js +1 -4
  63. package/tiledeskChatbotPlugs/directives/DirMoveToUnassigned.js +0 -3
  64. package/tiledeskChatbotPlugs/directives/DirQapla.js +0 -1
  65. package/tiledeskChatbotPlugs/directives/DirRandomReply.js +1 -3
  66. package/tiledeskChatbotPlugs/directives/DirRemoveCurrentBot.js +1 -2
  67. package/tiledeskChatbotPlugs/directives/DirReplaceBot.js +1 -3
  68. package/tiledeskChatbotPlugs/directives/DirReplaceBotV2.js +1 -3
  69. package/tiledeskChatbotPlugs/directives/DirReplaceBotV3.js +1 -3
  70. package/tiledeskChatbotPlugs/directives/DirReply.js +7 -18
  71. package/tiledeskChatbotPlugs/directives/DirReplyV2.js +8 -13
  72. package/tiledeskChatbotPlugs/directives/DirSendEmail.js +1 -3
  73. package/tiledeskChatbotPlugs/directives/DirSendWhatsapp.js +0 -1
  74. package/tiledeskChatbotPlugs/directives/DirSetAttribute.js +0 -1
  75. package/tiledeskChatbotPlugs/directives/DirSetAttributeV2.js +1 -4
  76. package/tiledeskChatbotPlugs/directives/DirSetConversationTags.js +1 -3
  77. package/tiledeskChatbotPlugs/directives/DirUnlockIntent.js +0 -1
  78. package/tiledeskChatbotPlugs/directives/DirWait.js +0 -1
  79. package/tiledeskChatbotPlugs/directives/DirWebRequest.js +0 -1
  80. package/tiledeskChatbotPlugs/directives/DirWebRequestV2.js +14 -15
  81. package/tiledeskChatbotPlugs/directives/DirWebResponse.js +6 -40
  82. package/tiledeskChatbotPlugs/directives/DirWhatsappByAttribute.js +0 -1
  83. package/tiledeskChatbotPlugs/directives/Directives.js +2 -0
  84. package/utils/TiledeskChatbotUtil.js +19 -57
  85. package/TdCache copy.js +0 -242
  86. package/logs/app1.log +0 -16071
  87. package/tiledeskChatbotPlugs/directives/DirWebRequestV2_old.js +0 -417
@@ -1,4 +1,3 @@
1
- // const { TiledeskClient } = require('@tiledesk/tiledesk-client');
2
1
  let axios = require('axios');
3
2
  const { DirIntent } = require('./DirIntent');
4
3
  let https = require("https");
@@ -16,7 +15,6 @@ class DirIfOpenHours {
16
15
  this.context = context;
17
16
  this.API_ENDPOINT = context.API_ENDPOINT;
18
17
  this.intentDir = new DirIntent(context);
19
- this.log = context.log;
20
18
  }
21
19
 
22
20
  execute(directive, callback) {
@@ -1,6 +1,7 @@
1
1
  const { TiledeskClient } = require('@tiledesk/tiledesk-client');
2
2
  const { DirIntent } = require('./DirIntent');
3
3
  const ms = require('minimist-string');
4
+ const winston = require('../../utils/winston');
4
5
 
5
6
  class DirIfOpenHours {
6
7
 
@@ -11,15 +12,13 @@ class DirIfOpenHours {
11
12
 
12
13
  this.context = context;
13
14
  this.intentDir = new DirIntent(context);
14
- this.log = context.log;
15
15
 
16
16
  this.API_ENDPOINT = context.API_ENDPOINT;
17
17
  this.tdClient = new TiledeskClient({
18
18
  projectId: this.context.projectId,
19
19
  token: this.context.token,
20
20
  APIURL: this.API_ENDPOINT,
21
- APIKEY: "___",
22
- log: this.log
21
+ APIKEY: "___"
23
22
  });
24
23
  }
25
24
 
@@ -32,9 +31,6 @@ class DirIfOpenHours {
32
31
  let params;
33
32
  params = this.parseParams(directive.parameter);
34
33
  if (!params.trueIntent && !params.falseIntent) {
35
- if (this.log) {
36
- console.log("missing both params.trueIntent & params.falseIntent");
37
- }
38
34
  callback();
39
35
  return;
40
36
  }
@@ -66,14 +62,14 @@ class DirIfOpenHours {
66
62
  if (falseIntent && falseIntent.trim() === "") {
67
63
  falseIntent = null;
68
64
  }
69
- if (this.log) {console.log("condition action:", action);}
65
+ winston.verbose("(DirIfOpenHours) Action:", action);
70
66
  if (!trueIntent && !falseIntent) {
71
- if (this.log) {console.log("Invalid condition, no intents specified");}
72
- callback();
67
+ winston.error("(DirIfOpenHours) Error: missing both action.trueIntent & action.falseIntent");
68
+ callback();
73
69
  return;
74
70
  }
75
71
  this.tdClient.openNow((err, result) => {
76
- if (this.log) {console.log("openNow():", result);}
72
+ winston.error("(DirIfOpenHours) openNow():", result)
77
73
  if (err) {
78
74
  console.error("*** DirIfOpenHours Error:", err);
79
75
  callback();
@@ -81,7 +77,7 @@ class DirIfOpenHours {
81
77
  else if (result && result.isopen) {
82
78
  if (trueIntent) {
83
79
  let intentDirective = DirIntent.intentDirectiveFor(trueIntent);
84
- if (this.log) {console.log("DirIfOpenHours (openHours) => trueIntent");}
80
+ winston.debug("(DirIfOpenHours) (openHours) => trueIntent ");
85
81
  this.intentDir.execute(intentDirective, () => {
86
82
  callback(stopOnConditionMet);
87
83
  });
@@ -93,7 +89,7 @@ class DirIfOpenHours {
93
89
  }
94
90
  else if (falseIntent) {
95
91
  let intentDirective = DirIntent.intentDirectiveFor(falseIntent);
96
- if (this.log) {console.log("DirIfOpenHours (openHours) => falseIntent", falseIntent);}
92
+ winston.debug("(DirIfOpenHours) (openHours) => falseIntent ");
97
93
  this.intentDir.execute(intentDirective, () => {
98
94
  callback(stopOnConditionMet);
99
95
  });
@@ -16,7 +16,6 @@ class DirIntent {
16
16
  this.TILEBOT_ENDPOINT = context.TILEBOT_ENDPOINT;
17
17
  this.supportRequest = context.supportRequest;
18
18
  this.token = context.token;
19
- this.log = context.log;
20
19
  }
21
20
 
22
21
  execute(directive, callback) {
@@ -62,10 +61,12 @@ class DirIntent {
62
61
  "recipient": requestId,
63
62
  "text": intent_command,
64
63
  "id_project": projectId,
65
- "request": {
66
- "request_id": requestId,
67
- "id_project": projectId
68
- }
64
+ "request": this.supportRequest,
65
+ // "request": {
66
+ // "request_id": requestId,
67
+ // "id_project": projectId
68
+ // // "bot_id": botId
69
+ // }
69
70
  },
70
71
  "token": this.token
71
72
  }
@@ -13,7 +13,6 @@ class DirJSONCondition {
13
13
  this.chatbot = context.chatbot;
14
14
  this.chatbot = context.chatbot;
15
15
  this.intentDir = new DirIntent(context);
16
- this.log = context.log;
17
16
  }
18
17
 
19
18
  execute(directive, callback) {
@@ -12,7 +12,6 @@ class DirLockIntent {
12
12
  throw new Error('tdcache (TdCache) object is mandatory.');
13
13
  }
14
14
  this.tdcache = this.context.tdcache;
15
- this.log = context.log;
16
15
  }
17
16
 
18
17
  async execute(directive, callback) {
@@ -16,7 +16,6 @@ class DirMake {
16
16
  this.tdcache = this.context.tdcache;
17
17
  this.requestId = this.context.requestId;
18
18
  this.intentDir = new DirIntent(context);
19
- this.log = context.log;
20
19
  }
21
20
 
22
21
  execute(directive, callback) {
@@ -199,21 +198,7 @@ class DirMake {
199
198
 
200
199
  })
201
200
  .catch((err) => {
202
- if (this.log) {
203
- // FIX THE STRINGIFY OF CIRCULAR STRUCTURE BUG - START
204
- let cache = [];
205
- let error_log = JSON.stringify(err, function (key, value) { // try to use a separate function
206
- if (typeof value === 'object' && value != null) {
207
- if (cache.indexOf(value) !== -1) {
208
- return;
209
- }
210
- cache.push(value);
211
- }
212
- return value;
213
- });
214
- winston.error("(DirMake) An error occurred: ", error_log);
215
- // FIX THE STRINGIFY OF CIRCULAR STRUCTURE BUG - END;
216
- }
201
+ // FIX THE STRINGIFY OF CIRCULAR STRUCTURE BUG - END;
217
202
  if (callback) {
218
203
  let status = 1000;
219
204
  let cache = [];
@@ -16,15 +16,13 @@ class DirMessage {
16
16
  this.requestId = context.requestId;
17
17
  this.tdcache = this.context.tdcache;
18
18
  this.token = context.token;
19
- this.log = this.context.log;
20
19
  this.supportRequest = this.context.supportRequest
21
20
 
22
21
  this.tdClient = new TiledeskClient({
23
22
  projectId: this.context.projectId,
24
23
  token: this.context.token,
25
24
  APIURL: this.API_ENDPOINT,
26
- APIKEY: "___",
27
- log: this.log
25
+ APIKEY: "___"
28
26
  });
29
27
  }
30
28
 
@@ -15,7 +15,6 @@ class DirMessageToBot {
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;
19
18
  }
20
19
 
21
20
  execute(directive, callback) {
@@ -1,4 +1,3 @@
1
- // const { TiledeskClient } = require('@tiledesk/tiledesk-client');
2
1
  const { Directives } = require('./Directives');
3
2
  const { TiledeskChatbot } = require('../../engine/TiledeskChatbot');
4
3
  const { TiledeskChatbotConst } = require('../../engine/TiledeskChatbotConst');
@@ -14,15 +13,13 @@ class DirMoveToAgent {
14
13
  this.context = context;
15
14
  this.tdcache = context.tdcache;
16
15
  this.requestId = context.requestId;
17
- this.log = context.log;
18
16
 
19
17
  this.API_ENDPOINT = context.API_ENDPOINT;
20
18
  this.tdClient = new TiledeskClient({
21
19
  projectId: this.context.projectId,
22
20
  token: this.context.token,
23
21
  APIURL: this.API_ENDPOINT,
24
- APIKEY: "___",
25
- log: this.log
22
+ APIKEY: "___"
26
23
  });
27
24
 
28
25
  }
@@ -1,4 +1,3 @@
1
- // const { TiledeskClient } = require('@tiledesk/tiledesk-client');
2
1
  const { Directives } = require('./Directives');
3
2
  const { TiledeskChatbot } = require('../../engine/TiledeskChatbot');
4
3
  const { TiledeskChatbotConst } = require('../../engine/TiledeskChatbotConst');
@@ -13,7 +12,6 @@ class DirMoveToUnassigned {
13
12
  }
14
13
  this.context = context;
15
14
  this.requestId = context.requestId;
16
- this.log = context.log;
17
15
 
18
16
  this.API_ENDPOINT = context.API_ENDPOINT;
19
17
  this.tdClient = new TiledeskClient({
@@ -21,7 +19,6 @@ class DirMoveToUnassigned {
21
19
  token: this.context.token,
22
20
  APIURL: this.API_ENDPOINT,
23
21
  APIKEY: "___",
24
- log: this.log
25
22
  });
26
23
  }
27
24
 
@@ -21,7 +21,6 @@ class DirQapla {
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;
25
24
  }
26
25
 
27
26
  execute(directive, callback) {
@@ -15,15 +15,13 @@ class DirRandomReply {
15
15
  this.requestId = context.requestId;
16
16
  this.token = context.token;
17
17
  this.tdcache = context.tdcache;
18
- this.log = context.log;
19
18
 
20
19
  this.API_ENDPOINT = context.API_ENDPOINT;
21
20
  this.tdClient = new TiledeskClient({
22
21
  projectId: this.context.projectId,
23
22
  token: this.context.token,
24
23
  APIURL: this.API_ENDPOINT,
25
- APIKEY: "___",
26
- log: this.log
24
+ APIKEY: "___"
27
25
  });
28
26
  }
29
27
 
@@ -16,8 +16,7 @@ class DirRemoveCurrentBot {
16
16
  projectId: this.context.projectId,
17
17
  token: this.context.token,
18
18
  APIURL: this.API_ENDPOINT,
19
- APIKEY: "___",
20
- log: this.log
19
+ APIKEY: "___"
21
20
  });
22
21
  }
23
22
 
@@ -11,15 +11,13 @@ class DirReplaceBot {
11
11
  }
12
12
  this.context = context;
13
13
  this.requestId = context.requestId;
14
- this.log = context.log;
15
14
 
16
15
  this.API_ENDPOINT = context.API_ENDPOINT;
17
16
  this.tdClient = new TiledeskClient({
18
17
  projectId: this.context.projectId,
19
18
  token: this.context.token,
20
19
  APIURL: this.API_ENDPOINT,
21
- APIKEY: "___",
22
- log: this.log
20
+ APIKEY: "___"
23
21
  });
24
22
  }
25
23
 
@@ -15,15 +15,13 @@ class DirReplaceBotV2 {
15
15
  }
16
16
  this.context = context;
17
17
  this.requestId = context.requestId;
18
- this.log = context.log;
19
18
 
20
19
  this.API_ENDPOINT = context.API_ENDPOINT;
21
20
  this.tdClient = new TiledeskClient({
22
21
  projectId: this.context.projectId,
23
22
  token: this.context.token,
24
23
  APIURL: this.API_ENDPOINT,
25
- APIKEY: "___",
26
- log: this.log
24
+ APIKEY: "___"
27
25
  });
28
26
  }
29
27
 
@@ -15,15 +15,13 @@ class DirReplaceBotV3 {
15
15
  }
16
16
  this.context = context;
17
17
  this.requestId = context.requestId;
18
- this.log = context.log;
19
18
 
20
19
  this.API_ENDPOINT = context.API_ENDPOINT;
21
20
  this.tdClient = new TiledeskClient({
22
21
  projectId: this.context.projectId,
23
22
  token: this.context.token,
24
23
  APIURL: this.API_ENDPOINT,
25
- APIKEY: "___",
26
- log: this.log
24
+ APIKEY: "___"
27
25
  });
28
26
  }
29
27
 
@@ -17,7 +17,7 @@ class DirReply {
17
17
  this.requestId = context.requestId;
18
18
  this.token = context.token;
19
19
  this.tdcache = context.tdcache;
20
- this.log = context.log;
20
+ this.supportRequest = this.context.supportRequest;
21
21
  this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest.draft });
22
22
 
23
23
  this.API_ENDPOINT = context.API_ENDPOINT;
@@ -25,8 +25,7 @@ class DirReply {
25
25
  projectId: this.context.projectId,
26
26
  token: this.context.token,
27
27
  APIURL: this.API_ENDPOINT,
28
- APIKEY: "___",
29
- log: this.log
28
+ APIKEY: "___"
30
29
  });
31
30
  }
32
31
 
@@ -44,10 +43,10 @@ class DirReply {
44
43
  callback();
45
44
  return;
46
45
  }
47
- this.logger.info("1 Execute action reply for " + directive.action.text)
46
+ this.logger.info("Executing Action Reply ", directive.action)
48
47
 
49
48
  this.go(action, () => {
50
- this.logger.info("6 End of action reply " + directive.action.text + " -> callback")
49
+ this.logger.info("Action Reply terminated")
51
50
  callback();
52
51
  });
53
52
  }
@@ -68,15 +67,16 @@ class DirReply {
68
67
  const filler = new Filler();
69
68
  // fill text attribute
70
69
  message.text = filler.fill(message.text, requestAttributes);
71
- this.logger.info("2 Sending reply " + message.text);
72
70
 
73
71
  if (message.metadata) {
74
72
  winston.debug("DirReply filling message 'metadata':", message.metadata);
75
73
  if (message.metadata.src) {
76
74
  message.metadata.src = filler.fill(message.metadata.src, requestAttributes);
75
+ this.logger.debug("Filled metadata.src with ", message.metadata.src);
77
76
  }
78
77
  if (message.metadata.name) {
79
78
  message.metadata.name = filler.fill(message.metadata.name, requestAttributes);
79
+ this.logger.debug("Filled metadata.name with ", message.metadata.name);
80
80
  }
81
81
  }
82
82
  winston.debug("DirReply filling commands'. Message:", message);
@@ -89,7 +89,7 @@ class DirReply {
89
89
  let command = commands[i];
90
90
  if (command.type === 'message' && command.message && command.message.text) {
91
91
  command.message.text = filler.fill(command.message.text, requestAttributes);
92
- TiledeskChatbotUtil.fillCommandAttachments(command, requestAttributes, this.log);
92
+ TiledeskChatbotUtil.fillCommandAttachments(command, requestAttributes);
93
93
  winston.debug("DirReply command filled: " + command.message.text);
94
94
  }
95
95
  if (command.type === 'settings' && command.settings) {
@@ -143,15 +143,6 @@ class DirReply {
143
143
  }
144
144
 
145
145
  let cleanMessage = message;
146
- this.logger.info("3 Sending reply (text) " + cleanMessage.text);
147
- this.logger.info("4 Sending reply with clean message " + JSON.stringify(cleanMessage));
148
- // cleanMessage = TiledeskChatbotUtil.removeEmptyReplyCommands(message);
149
- // if (!TiledeskChatbotUtil.isValidReply(cleanMessage)) {
150
- // console.log("invalid message", cleanMessage);
151
- // callback(); // cancel reply operation
152
- // return;
153
- // }
154
-
155
146
  cleanMessage.senderFullname = this.context.chatbot.bot.name;
156
147
  winston.debug("DirReply reply with clean message: ", cleanMessage);
157
148
 
@@ -162,10 +153,8 @@ class DirReply {
162
153
  (err) => {
163
154
  if (err) {
164
155
  winston.error("DirReply Error sending reply: ", err);
165
- this.logger.error("Error sending reply: " + err);
166
156
  }
167
157
  winston.verbose("DirReply reply message sent")
168
- this.logger.info("5 Reply message sent");
169
158
  const delay = TiledeskChatbotUtil.totalMessageWait(cleanMessage);
170
159
  if (delay > 0 && delay <= 30000) { // prevent long delays
171
160
  setTimeout(() => {
@@ -20,7 +20,6 @@ class DirReplyV2 {
20
20
  this.requestId = context.requestId;
21
21
  this.token = context.token;
22
22
  this.tdcache = context.tdcache;
23
- this.log = context.log;
24
23
  this.intentDir = new DirIntent(context);
25
24
  this.chatbot = context.chatbot;
26
25
  this.reply = context.reply;
@@ -31,8 +30,7 @@ class DirReplyV2 {
31
30
  projectId: this.context.projectId,
32
31
  token: this.context.token,
33
32
  APIURL: this.API_ENDPOINT,
34
- APIKEY: "___",
35
- log: this.log
33
+ APIKEY: "___"
36
34
  });
37
35
  }
38
36
 
@@ -61,11 +59,10 @@ class DirReplyV2 {
61
59
  const message = action;
62
60
 
63
61
  let current; // debug only
64
- if (this.log) {
65
- if (message.attributes.commands[1].message.text) {
66
- current = message.attributes.commands[1].message.text
67
- }
62
+ if (message.attributes.commands[1].message.text) {
63
+ current = message.attributes.commands[1].message.text
68
64
  }
65
+
69
66
  let must_stop = false;
70
67
  // fill
71
68
  let requestAttributes = null;
@@ -74,11 +71,9 @@ class DirReplyV2 {
74
71
  await TiledeskChatbot.allParametersStatic(
75
72
  this.tdcache, this.requestId
76
73
  );
77
- if (this.log) {
78
- for (const [key, value] of Object.entries(requestAttributes)) {
79
- const value_type = typeof value;
80
- }
81
- }
74
+ // for (const [key, value] of Object.entries(requestAttributes)) {
75
+ // const value_type = typeof value;
76
+ // }
82
77
 
83
78
  TiledeskChatbotUtil.replaceJSONButtons(message, requestAttributes);
84
79
 
@@ -197,7 +192,7 @@ class DirReplyV2 {
197
192
  let command = commands[i];
198
193
  if (command.type === 'message' && command.message && command.message.text) {
199
194
  command.message.text = filler.fill(command.message.text, requestAttributes);
200
- TiledeskChatbotUtil.fillCommandAttachments(command, requestAttributes, this.log);
195
+ TiledeskChatbotUtil.fillCommandAttachments(command, requestAttributes);
201
196
  }
202
197
  }
203
198
  }
@@ -15,15 +15,13 @@ class DirSendEmail {
15
15
  this.context = context;
16
16
  this.tdcache = context.tdcache;
17
17
  this.requestId = context.requestId;
18
- this.log = context.log;
19
18
 
20
19
  this.API_ENDPOINT = context.API_ENDPOINT;
21
20
  this.tdClient = new TiledeskClient({
22
21
  projectId: this.context.projectId,
23
22
  token: this.context.token,
24
23
  APIURL: this.API_ENDPOINT,
25
- APIKEY: "___",
26
- log: this.log
24
+ APIKEY: "___"
27
25
  });
28
26
  }
29
27
 
@@ -19,7 +19,6 @@ class DirSendWhatsapp {
19
19
  this.requestId = this.context.requestId;
20
20
  this.intentDir = new DirIntent(context);
21
21
  this.API_ENDPOINT = this.context.API_ENDPOINT;
22
- this.log = context.log;
23
22
  }
24
23
 
25
24
  execute(directive, callback) {
@@ -77,7 +77,6 @@ class DirSetAttribute {
77
77
  throw new Error('context object is mandatory.');
78
78
  }
79
79
  this.context = context;
80
- this.log = context.log;
81
80
  }
82
81
 
83
82
  execute(directive, callback) {
@@ -79,7 +79,6 @@ class DirSetAttributeV2 {
79
79
  }
80
80
  this.context = context;
81
81
  this.tdcache = context.tdcache;
82
- this.log = context.log;
83
82
  }
84
83
 
85
84
  execute(directive, callback) {
@@ -199,9 +198,7 @@ class DirSetAttributeV2 {
199
198
  httpUtils.request(
200
199
  HTTPREQUEST, async (err, resbody) => {
201
200
  if (err) {
202
- if (this.log) {
203
- winston.error("(DirSetAttributeV2) persistOnTiledesk() error: ", err);
204
- }
201
+ winston.error("(DirSetAttributeV2) persistOnTiledesk() error: ", err);
205
202
  } else {
206
203
  winston.debug("(DirSetAttributeV2) Attributes saved: ", resbody);
207
204
  }
@@ -9,7 +9,6 @@ class DirSetConversationTags {
9
9
  throw new Error('context object is mandatory.');
10
10
  }
11
11
  this.context = context;
12
- this.log = context.log;
13
12
  this.requestId = context.requestId;
14
13
 
15
14
  this.API_ENDPOINT = context.API_ENDPOINT;
@@ -17,8 +16,7 @@ class DirSetConversationTags {
17
16
  projectId: this.context.projectId,
18
17
  token: this.context.token,
19
18
  APIURL: this.API_ENDPOINT,
20
- APIKEY: "___",
21
- log: this.log
19
+ APIKEY: "___"
22
20
  });
23
21
  }
24
22
 
@@ -11,7 +11,6 @@ class DirUnlockIntent {
11
11
  throw new Error('tdcache (TdCache) object is mandatory.');
12
12
  }
13
13
  this.tdcache = context.tdcache;
14
- this.log = context.log;
15
14
  }
16
15
 
17
16
  async execute(directive, callback) {
@@ -12,7 +12,6 @@ class DirWait {
12
12
  this.chatbot = context.chatbot;
13
13
  this.tdcache = context.tdcache;
14
14
  this.requestId = context.requestId;
15
- this.log = context.log;
16
15
  }
17
16
 
18
17
  execute(directive, callback) {
@@ -13,7 +13,6 @@ class DirWebRequest {
13
13
  this.context = context;
14
14
  this.tdcache = context.tdcache;
15
15
  this.requestId = context.requestId;
16
- this.log = context.log;
17
16
  }
18
17
 
19
18
  execute(directive, callback) {