@tiledesk/tiledesk-tybot-connector 2.0.10-rc10 → 2.0.10-rc12

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 (43) hide show
  1. package/logs/app.log +43071 -4803
  2. package/logs/app1.log +41129 -0
  3. package/logs/app2.log +4140 -46280
  4. package/logs/app6.log +29039 -0
  5. package/logs/app7.log +4726 -0
  6. package/package.json +1 -1
  7. package/tiledeskChatbotPlugs/directives/DirAddTags.js +11 -12
  8. package/tiledeskChatbotPlugs/directives/DirAiPrompt.js +15 -16
  9. package/tiledeskChatbotPlugs/directives/DirAskGPTV2.js +13 -14
  10. package/tiledeskChatbotPlugs/directives/DirAssistant.js +11 -1
  11. package/tiledeskChatbotPlugs/directives/DirBrevo.js +9 -5
  12. package/tiledeskChatbotPlugs/directives/DirCaptureUserReply.js +5 -0
  13. package/tiledeskChatbotPlugs/directives/DirClearTranscript.js +4 -0
  14. package/tiledeskChatbotPlugs/directives/DirClose.js +7 -1
  15. package/tiledeskChatbotPlugs/directives/DirCode.js +8 -0
  16. package/tiledeskChatbotPlugs/directives/DirCondition.js +12 -0
  17. package/tiledeskChatbotPlugs/directives/DirContactUpdate.js +5 -0
  18. package/tiledeskChatbotPlugs/directives/DirCustomerio.js +9 -0
  19. package/tiledeskChatbotPlugs/directives/DirDeleteVariable.js +13 -0
  20. package/tiledeskChatbotPlugs/directives/DirDepartment.js +12 -1
  21. package/tiledeskChatbotPlugs/directives/DirForm.js +1 -0
  22. package/tiledeskChatbotPlugs/directives/DirGptTask.js +17 -5
  23. package/tiledeskChatbotPlugs/directives/DirHubspot.js +10 -1
  24. package/tiledeskChatbotPlugs/directives/DirIfOnlineAgentsV2.js +10 -1
  25. package/tiledeskChatbotPlugs/directives/DirIfOpenHours.js +10 -0
  26. package/tiledeskChatbotPlugs/directives/DirJSONCondition.js +13 -3
  27. package/tiledeskChatbotPlugs/directives/DirMake.js +5 -0
  28. package/tiledeskChatbotPlugs/directives/DirMoveToAgent.js +4 -0
  29. package/tiledeskChatbotPlugs/directives/DirMoveToUnassigned.js +5 -1
  30. package/tiledeskChatbotPlugs/directives/DirQapla.js +5 -1
  31. package/tiledeskChatbotPlugs/directives/DirRandomReply.js +5 -0
  32. package/tiledeskChatbotPlugs/directives/DirReplaceBot.js +5 -0
  33. package/tiledeskChatbotPlugs/directives/DirReplaceBotV2.js +4 -0
  34. package/tiledeskChatbotPlugs/directives/DirReplaceBotV3.js +4 -0
  35. package/tiledeskChatbotPlugs/directives/DirReply.js +1 -1
  36. package/tiledeskChatbotPlugs/directives/DirReplyV2.js +5 -0
  37. package/tiledeskChatbotPlugs/directives/DirSendEmail.js +5 -0
  38. package/tiledeskChatbotPlugs/directives/DirSendWhatsapp.js +5 -0
  39. package/tiledeskChatbotPlugs/directives/DirSetAttributeV2.js +9 -0
  40. package/tiledeskChatbotPlugs/directives/DirWait.js +5 -0
  41. package/tiledeskChatbotPlugs/directives/DirWebRequestV2.js +10 -9
  42. package/tiledeskChatbotPlugs/directives/DirWebResponse.js +5 -4
  43. package/tiledeskChatbotPlugs/directives/DirWhatsappByAttribute.js +6 -0
@@ -2,6 +2,7 @@ const { DirIntent } = require('./DirIntent');
2
2
  const { TiledeskChatbot } = require('../../engine/TiledeskChatbot');
3
3
  const { TiledeskExpression } = require('../../TiledeskExpression');
4
4
  const winston = require('../../utils/winston');
5
+ const { Logger } = require('../../Logger');
5
6
 
6
7
  class DirJSONCondition {
7
8
 
@@ -11,22 +12,26 @@ class DirJSONCondition {
11
12
  }
12
13
  this.context = context;
13
14
  this.chatbot = context.chatbot;
14
- this.chatbot = context.chatbot;
15
+ this.requestId = this.context.requestId;
15
16
  this.intentDir = new DirIntent(context);
17
+ this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest.draft, intent_id: this.context.reply.attributes.intent_info.intent_id });
16
18
  }
17
19
 
18
20
  execute(directive, callback) {
21
+ this.logger.info("[Condition] Executing action");
19
22
  winston.verbose("Execute JSONCondition directive");
20
23
  let action;
21
24
  if (directive.action) {
22
25
  action = directive.action
23
26
  }
24
27
  else {
28
+ this.logger.error("Incorrect action for ", directive.name, directive)
25
29
  winston.warn("DirJSONCondition Incorrect directive: ", directive);
26
30
  callback();
27
31
  return;
28
32
  }
29
33
  this.go(action, (stop) => {
34
+ this.logger.info("[Condition] Action completed");
30
35
  callback(stop);
31
36
  });
32
37
 
@@ -49,11 +54,13 @@ class DirJSONCondition {
49
54
  falseIntent = null;
50
55
  }
51
56
  if (!trueIntent && !falseIntent) {
57
+ this.logger.warn("[Condition] Invalid jsonCondition, no intents specified");
52
58
  winston.warn("(DirJSONCondition) Invalid jsonCondition, no intents specified");
53
59
  callback();
54
60
  return;
55
61
  }
56
62
  else if (groups === null) {
63
+ this.logger.warn("[Condition] Invalid jsonCondition, no groups");
57
64
  winston.warn("(DirJSONCondition) Invalid jsonCondition, no groups.");
58
65
  callback();
59
66
  return;
@@ -80,9 +87,9 @@ class DirJSONCondition {
80
87
  // const result = await this.evaluateCondition(scriptCondition, variables);
81
88
  let result;
82
89
  const expression = TiledeskExpression.JSONGroupsToExpression(groups, variables);
83
-
90
+ this.logger.debug("[Condition] Evaluating expression: ", expression);
84
91
  result = new TiledeskExpression().evaluateStaticExpression(expression, variables);
85
- winston.debug("(DirJSONCondition) executed condition: ", expression);
92
+ winston.debug("(DirJSONCondition) Evaluation result: ", result);
86
93
  if (result === true) {
87
94
  if (trueIntentDirective) {
88
95
  this.intentDir.execute(trueIntentDirective, () => {
@@ -90,6 +97,7 @@ class DirJSONCondition {
90
97
  });
91
98
  }
92
99
  else {
100
+ this.logger.debug("[Condition] No trueIntentDirective specified");
93
101
  winston.debug("(DirJSONCondition) No trueIntentDirective specified");
94
102
  callback();
95
103
  return;
@@ -97,6 +105,7 @@ class DirJSONCondition {
97
105
  }
98
106
  else {
99
107
  if (result === null) {
108
+ this.logger.error("[Condition] An error occurred evaluating the condition");
100
109
  await this.chatbot.addParameter("flowError", "An error occurred evaluating condition: result === null");
101
110
  }
102
111
  if (falseIntentDirective) {
@@ -105,6 +114,7 @@ class DirJSONCondition {
105
114
  });
106
115
  }
107
116
  else {
117
+ this.logger.debug("[Condition] No falseIntentDirective specified");
108
118
  winston.debug("(DirJSONCondition) No falseIntentDirective specified");
109
119
  callback();
110
120
  return;
@@ -5,6 +5,7 @@ const { DirIntent } = require("./DirIntent");
5
5
  let https = require("https");
6
6
  require('dotenv').config();
7
7
  const winston = require('../../utils/winston');
8
+ const { Logger } = require("../../Logger");
8
9
 
9
10
  class DirMake {
10
11
 
@@ -16,20 +17,24 @@ class DirMake {
16
17
  this.tdcache = this.context.tdcache;
17
18
  this.requestId = this.context.requestId;
18
19
  this.intentDir = new DirIntent(context);
20
+ this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest.draft, intent_id: this.context.reply.attributes.intent_info.intent_id });
19
21
  }
20
22
 
21
23
  execute(directive, callback) {
24
+ this.logger.info("[Make] Executing action");
22
25
  winston.verbose("Execute Make directive");
23
26
  let action;
24
27
  if (directive.action) {
25
28
  action = directive.action;
26
29
  }
27
30
  else {
31
+ this.logger.error("Incorrect action for ", directive.name, directive)
28
32
  winston.warn("DirMake Incorrect directive: ", directive);
29
33
  callback();
30
34
  return;
31
35
  }
32
36
  this.go(action, (stop) => {
37
+ this.logger.info("[Make] Action completed");
33
38
  callback(stop);
34
39
  })
35
40
  }
@@ -3,6 +3,7 @@ const { TiledeskChatbot } = require('../../engine/TiledeskChatbot');
3
3
  const { TiledeskChatbotConst } = require('../../engine/TiledeskChatbotConst');
4
4
  const { TiledeskClient } = require('@tiledesk/tiledesk-client');
5
5
  const winston = require('../../utils/winston');
6
+ const { Logger } = require('../../Logger');
6
7
 
7
8
  class DirMoveToAgent {
8
9
 
@@ -13,6 +14,7 @@ class DirMoveToAgent {
13
14
  this.context = context;
14
15
  this.tdcache = context.tdcache;
15
16
  this.requestId = context.requestId;
17
+ this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest.draft, intent_id: this.context.reply.attributes.intent_info.intent_id });
16
18
 
17
19
  this.API_ENDPOINT = context.API_ENDPOINT;
18
20
  this.tdClient = new TiledeskClient({
@@ -25,9 +27,11 @@ class DirMoveToAgent {
25
27
  }
26
28
 
27
29
  execute(directive, callback) {
30
+ this.logger.info("[Transfer to a Human] Executing action");
28
31
  winston.verbose("Execute MoveToAgent directive");
29
32
  directive.action = {};
30
33
  this.go(directive.action, () => {
34
+ this.logger.info("[Transfer to a Human] Action completed");
31
35
  callback();
32
36
  });
33
37
  }
@@ -3,6 +3,7 @@ const { TiledeskChatbot } = require('../../engine/TiledeskChatbot');
3
3
  const { TiledeskChatbotConst } = require('../../engine/TiledeskChatbotConst');
4
4
  const { TiledeskClient } = require('@tiledesk/tiledesk-client');
5
5
  const winston = require('../../utils/winston');
6
+ const { Logger } = require('../../Logger');
6
7
 
7
8
  class DirMoveToUnassigned {
8
9
 
@@ -12,20 +13,23 @@ class DirMoveToUnassigned {
12
13
  }
13
14
  this.context = context;
14
15
  this.requestId = context.requestId;
16
+ this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest.draft, intent_id: this.context.reply.attributes.intent_info.intent_id });
15
17
 
16
18
  this.API_ENDPOINT = context.API_ENDPOINT;
17
19
  this.tdClient = new TiledeskClient({
18
20
  projectId: this.context.projectId,
19
21
  token: this.context.token,
20
22
  APIURL: this.API_ENDPOINT,
21
- APIKEY: "___",
23
+ APIKEY: "___"
22
24
  });
23
25
  }
24
26
 
25
27
  execute(directive, callback) {
28
+ this.logger.info("[Move to Unassigned] Executing action");
26
29
  winston.verbose("Execute MoveToUnassigned directive");
27
30
  directive.action = {};
28
31
  this.go(directive.action, () => {
32
+ this.logger.info("[Move to Unassigned] Action completed");
29
33
  callback();
30
34
  });
31
35
  }
@@ -7,6 +7,7 @@ require('dotenv').config();
7
7
  const winston = require('../../utils/winston');
8
8
  const httpUtils = require("../../utils/HttpUtils");
9
9
  const integrationService = require("../../services/IntegrationService");
10
+ const { Logger } = require("../../Logger");
10
11
 
11
12
  class DirQapla {
12
13
 
@@ -21,20 +22,23 @@ class DirQapla {
21
22
  this.token = this.context.token;
22
23
  this.intentDir = new DirIntent(context);
23
24
  this.API_ENDPOINT = this.context.API_ENDPOINT;
25
+ this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest.draft, intent_id: this.context.reply.attributes.intent_info.intent_id });
24
26
  }
25
27
 
26
28
  execute(directive, callback) {
27
- winston.verbose("Execute Qapla directive");
29
+ this.logger.info("[Qapla] Executing action");
28
30
  let action;
29
31
  if (directive.action) {
30
32
  action = directive.action;
31
33
  }
32
34
  else {
35
+ this.logger.error("Incorrect action for ", directive.name, directive)
33
36
  winston.warn("DirQapla Incorrect directive: ", directive);
34
37
  callback();
35
38
  return;
36
39
  }
37
40
  this.go(action, (stop) => {
41
+ this.logger.info("[Qapla] Action completed");
38
42
  callback(stop);
39
43
  })
40
44
  }
@@ -3,6 +3,7 @@ const { TiledeskChatbot } = require('../../engine/TiledeskChatbot');
3
3
  const { TiledeskChatbotUtil } = require('../../utils/TiledeskChatbotUtil');
4
4
  const { TiledeskClient } = require('@tiledesk/tiledesk-client');
5
5
  const winston = require('../../utils/winston');
6
+ const { Logger } = require('../../Logger');
6
7
 
7
8
  class DirRandomReply {
8
9
 
@@ -15,6 +16,7 @@ class DirRandomReply {
15
16
  this.requestId = context.requestId;
16
17
  this.token = context.token;
17
18
  this.tdcache = context.tdcache;
19
+ this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest.draft, intent_id: this.context.reply.attributes.intent_info.intent_id });
18
20
 
19
21
  this.API_ENDPOINT = context.API_ENDPOINT;
20
22
  this.tdClient = new TiledeskClient({
@@ -26,6 +28,7 @@ class DirRandomReply {
26
28
  }
27
29
 
28
30
  execute(directive, callback) {
31
+ this.logger.info("[Random Reply] Executing action");
29
32
  winston.verbose("Execute RandomReply directive");
30
33
  let action;
31
34
  if (directive.action) {
@@ -36,11 +39,13 @@ class DirRandomReply {
36
39
  action.attributes.fillParams = true;
37
40
  }
38
41
  else {
42
+ this.logger.error("Incorrect action for ", directive.name, directive)
39
43
  winston.warn("DirRandomReply Incorrect directive: ", directive);
40
44
  callback();
41
45
  return;
42
46
  }
43
47
  this.go(action, () => {
48
+ this.logger.info("[Random Reply] Action completed");
44
49
  callback();
45
50
  });
46
51
  }
@@ -2,6 +2,7 @@ const { TiledeskClient } = require('@tiledesk/tiledesk-client');
2
2
  const { TiledeskChatbot } = require('../../engine/TiledeskChatbot');
3
3
  const { Filler } = require('../Filler');
4
4
  const winston = require('../../utils/winston');
5
+ const { Logger } = require('../../Logger');
5
6
 
6
7
  class DirReplaceBot {
7
8
 
@@ -11,6 +12,7 @@ class DirReplaceBot {
11
12
  }
12
13
  this.context = context;
13
14
  this.requestId = context.requestId;
15
+ this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest.draft, intent_id: this.context.reply.attributes.intent_info.intent_id });
14
16
 
15
17
  this.API_ENDPOINT = context.API_ENDPOINT;
16
18
  this.tdClient = new TiledeskClient({
@@ -22,6 +24,7 @@ class DirReplaceBot {
22
24
  }
23
25
 
24
26
  execute(directive, callback) {
27
+ this.logger.info("[Replace Bot] Executing action");
25
28
  winston.verbose("Execute ReplaceBot directive");
26
29
  let action;
27
30
  if (directive.action) {
@@ -34,10 +37,12 @@ class DirReplaceBot {
34
37
  }
35
38
  }
36
39
  else {
40
+ this.logger.error("Incorrect action for ", directive.name, directive)
37
41
  winston.warn("DirReplaceBot Incorrect directive: ", directive);
38
42
  callback();
39
43
  }
40
44
  this.go(action, () => {
45
+ this.logger.info("[Replace Bot] Action completed");
41
46
  callback();
42
47
  })
43
48
  }
@@ -15,6 +15,7 @@ class DirReplaceBotV2 {
15
15
  }
16
16
  this.context = context;
17
17
  this.requestId = context.requestId;
18
+ this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest.draft, intent_id: this.context.reply.attributes.intent_info.intent_id });
18
19
 
19
20
  this.API_ENDPOINT = context.API_ENDPOINT;
20
21
  this.tdClient = new TiledeskClient({
@@ -26,6 +27,7 @@ class DirReplaceBotV2 {
26
27
  }
27
28
 
28
29
  execute(directive, callback) {
30
+ this.logger.info("[Replace Bot] Executing action");
29
31
  winston.verbose("Execute ReplaceBotV2 directive");
30
32
  let action;
31
33
  if (directive.action) {
@@ -38,10 +40,12 @@ class DirReplaceBotV2 {
38
40
  }
39
41
  }
40
42
  else {
43
+ this.logger.error("Incorrect action for ", directive.name, directive)
41
44
  winston.warn("DirReplaceBotV2 Incorrect directive: ", directive);
42
45
  callback();
43
46
  }
44
47
  this.go(action, () => {
48
+ this.logger.info("[Replace Bot] Action completed");
45
49
  callback();
46
50
  })
47
51
  }
@@ -15,6 +15,7 @@ class DirReplaceBotV3 {
15
15
  }
16
16
  this.context = context;
17
17
  this.requestId = context.requestId;
18
+ this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest.draft, intent_id: this.context.reply.attributes.intent_info.intent_id });
18
19
 
19
20
  this.API_ENDPOINT = context.API_ENDPOINT;
20
21
  this.tdClient = new TiledeskClient({
@@ -26,17 +27,20 @@ class DirReplaceBotV3 {
26
27
  }
27
28
 
28
29
  execute(directive, callback) {
30
+ this.logger.info("[Replace Bot] Executing action");
29
31
  winston.verbose("Execute ReplaceBotV3 directive");
30
32
  let action;
31
33
  if (directive.action) {
32
34
  action = directive.action;
33
35
  }
34
36
  else {
37
+ this.logger.error("Incorrect action for ", directive.name, directive)
35
38
  winston.warn("DirReplaceBotV3 Incorrect directive: ", directive);
36
39
  callback();
37
40
  return;
38
41
  }
39
42
  this.go(action, () => {
43
+ this.logger.info("[Replace Bot] Action completed");
40
44
  callback();
41
45
  })
42
46
  }
@@ -18,7 +18,7 @@ class DirReply {
18
18
  this.token = context.token;
19
19
  this.tdcache = context.tdcache;
20
20
  this.supportRequest = this.context.supportRequest;
21
- this.logger = new Logger({ request_id: this.requestId, dev: this.supportRequest.draft, intent_id: this.context.reply.attributes.intent_info.intent_id });
21
+ this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest.draft, intent_id: this.context.reply.attributes.intent_info.intent_id });
22
22
 
23
23
  this.API_ENDPOINT = context.API_ENDPOINT;
24
24
  this.tdClient = new TiledeskClient({
@@ -8,6 +8,7 @@ const { DirMessageToBot } = require('./DirMessageToBot');
8
8
  const { v4: uuidv4 } = require('uuid');
9
9
  const { TiledeskClient } = require('@tiledesk/tiledesk-client');
10
10
  const winston = require('../../utils/winston');
11
+ const { Logger } = require('../../Logger');
11
12
 
12
13
  class DirReplyV2 {
13
14
 
@@ -24,6 +25,7 @@ class DirReplyV2 {
24
25
  this.chatbot = context.chatbot;
25
26
  this.reply = context.reply;
26
27
  this.originalMessage = context.message;
28
+ this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest.draft, intent_id: this.context.reply.attributes.intent_info.intent_id });
27
29
 
28
30
  this.API_ENDPOINT = context.API_ENDPOINT;
29
31
  this.tdClient = new TiledeskClient({
@@ -35,6 +37,7 @@ class DirReplyV2 {
35
37
  }
36
38
 
37
39
  execute(directive, callback) {
40
+ this.logger.info("[Reply] Executing action");
38
41
  winston.verbose("Execute ReplyV2 directive");
39
42
  let action;
40
43
  if (directive.action) {
@@ -45,11 +48,13 @@ class DirReplyV2 {
45
48
  action.attributes.fillParams = true;
46
49
  }
47
50
  else {
51
+ this.logger.error("Incorrect action for ", directive.name, directive)
48
52
  winston.warn("DirReplyV2 Incorrect directive: ", directive);
49
53
  callback();
50
54
  return;
51
55
  }
52
56
  this.go(action, (stop) => {
57
+ this.logger.info("[Reply] Action completed");
53
58
  callback(stop);
54
59
  });
55
60
  }
@@ -4,6 +4,7 @@ const { TiledeskChatbot } = require('../../engine/TiledeskChatbot');
4
4
  const { Filler } = require('../Filler');
5
5
  const { TiledeskClient } = require('@tiledesk/tiledesk-client');
6
6
  const winston = require('../../utils/winston');
7
+ const { Logger } = require('../../Logger');
7
8
  // const { TiledeskClient } = require('@tiledesk/tiledesk-client');
8
9
 
9
10
  class DirSendEmail {
@@ -15,6 +16,7 @@ class DirSendEmail {
15
16
  this.context = context;
16
17
  this.tdcache = context.tdcache;
17
18
  this.requestId = context.requestId;
19
+ this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest.draft, intent_id: this.context.reply.attributes.intent_info.intent_id });
18
20
 
19
21
  this.API_ENDPOINT = context.API_ENDPOINT;
20
22
  this.tdClient = new TiledeskClient({
@@ -26,6 +28,7 @@ class DirSendEmail {
26
28
  }
27
29
 
28
30
  execute(directive, callback) {
31
+ this.logger.info("[Send Email] Executing action");
29
32
  winston.verbose("Execute SendEmail directive");
30
33
  let action;
31
34
  if (directive.action) {
@@ -40,11 +43,13 @@ class DirSendEmail {
40
43
  }
41
44
  }
42
45
  else {
46
+ this.logger.error("Incorrect action for ", directive.name, directive)
43
47
  winston.warn("DirSendEmail Incorrect directive: ", directive);
44
48
  callback();
45
49
  return;
46
50
  }
47
51
  this.go(action, () => {
52
+ this.logger.info("[Send Email] Action completed");
48
53
  callback();
49
54
  });
50
55
  }
@@ -4,6 +4,7 @@ const { Filler } = require("../Filler");
4
4
  const { DirIntent } = require("./DirIntent");
5
5
  const winston = require('../../utils/winston');
6
6
  const httpUtils = require("../../utils/HttpUtils");
7
+ const { Logger } = require("../../Logger");
7
8
 
8
9
  let whatsapp_api_url;
9
10
 
@@ -19,20 +20,24 @@ class DirSendWhatsapp {
19
20
  this.requestId = this.context.requestId;
20
21
  this.intentDir = new DirIntent(context);
21
22
  this.API_ENDPOINT = this.context.API_ENDPOINT;
23
+ this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest.draft, intent_id: this.context.reply.attributes.intent_info.intent_id });
22
24
  }
23
25
 
24
26
  execute(directive, callback) {
27
+ this.logger.info("[Send Whatsapp] Executing action");
25
28
  winston.verbose("Execute SendWhatsapp directive");
26
29
  let action;
27
30
  if (directive.action) {
28
31
  action = directive.action;
29
32
  }
30
33
  else {
34
+ this.logger.error("Incorrect action for ", directive.name, directive)
31
35
  winston.warn("DirSendWhatsapp Incorrect directive: ", directive);
32
36
  callback();
33
37
  return;
34
38
  }
35
39
  this.go(action, (stop) => {
40
+ this.logger.info("[Send Whatsapp] Action completed");
36
41
  callback(stop);
37
42
  })
38
43
  }
@@ -6,6 +6,7 @@ const { Filler } = require('../Filler');
6
6
  const validate = require('jsonschema').validate;
7
7
  const winston = require('../../utils/winston');
8
8
  const httpUtils = require('../../utils/HttpUtils');
9
+ const { Logger } = require('../../Logger');
9
10
 
10
11
  const schema = {
11
12
  "type": "object",
@@ -79,20 +80,28 @@ class DirSetAttributeV2 {
79
80
  }
80
81
  this.context = context;
81
82
  this.tdcache = context.tdcache;
83
+ this.requestId = context.requestId;
84
+
85
+ let dev = this.context.supportRequest?.draft || false;
86
+ let intent_id = this.context.reply?.attributes?.intent_info?.intent_id || undefined;
87
+ this.logger = new Logger({ request_id: this.requestId, dev: dev, intent_id: intent_id });
82
88
  }
83
89
 
84
90
  execute(directive, callback) {
91
+ this.logger.info("[Set Attribute] Executing action");
85
92
  winston.verbose("Execute SetAttributeV2 directive");
86
93
  let action;
87
94
  if (directive.action) {
88
95
  action = directive.action
89
96
  }
90
97
  else {
98
+ this.logger.error("Incorrect action for ", directive.name, directive)
91
99
  winston.warn("DirSetAttributeV2 Incorrect directive: ", directive);
92
100
  callback();
93
101
  return;
94
102
  }
95
103
  this.go(action, () => {
104
+ this.logger.info("[Set Attribute] Action completed");
96
105
  callback();
97
106
  });
98
107
  }
@@ -1,4 +1,5 @@
1
1
 
2
+ const { Logger } = require('../../Logger');
2
3
  const { TiledeskChatbot } = require('../../engine/TiledeskChatbot');
3
4
  const winston = require('../../utils/winston');
4
5
 
@@ -12,10 +13,12 @@ class DirWait {
12
13
  this.chatbot = context.chatbot;
13
14
  this.tdcache = context.tdcache;
14
15
  this.requestId = context.requestId;
16
+ this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest.draft, intent_id: this.context.reply.attributes.intent_info.intent_id });
15
17
  }
16
18
 
17
19
  execute(directive, callback) {
18
20
  // 500ms < wait-time < 10.000ms
21
+ this.logger.info("[Wait] Executing action");
19
22
  winston.verbose("Execute Wait directive");
20
23
  let action;
21
24
  if (directive.action) {
@@ -44,6 +47,7 @@ class DirWait {
44
47
  }
45
48
 
46
49
  this.go(action, () => {
50
+ this.logger.info("[Wait] Action completed");
47
51
  callback();
48
52
  })
49
53
  }
@@ -56,6 +60,7 @@ class DirWait {
56
60
  // await this.tdcache.set(step_key, 0);
57
61
  await TiledeskChatbot.resetStep(this.tdcache, this.requestId);
58
62
  }
63
+ this.logger.verbose("[Wait] Waiting for ", action.millis, "[ms]")
59
64
  setTimeout(() => {
60
65
  callback();
61
66
  }, action.millis);
@@ -18,23 +18,24 @@ class DirWebRequestV2 {
18
18
  this.chatbot = context.chatbot;
19
19
  this.intentDir = new DirIntent(context);
20
20
  this.log = context.log;
21
- this.logger = new Logger({ request_id: this.requestId, dev: this.supportRequest.draft, intent_id: this.context.reply.attributes.intent_info.intent_id });
21
+ this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest.draft, intent_id: this.context.reply.attributes.intent_info.intent_id });
22
22
  }
23
23
 
24
24
  execute(directive, callback) {
25
+ this.logger.info("[Web Request] Executing action");
25
26
  winston.verbose("Execute WebRequestV2 directive");
26
27
  let action;
27
28
  if (directive.action) {
28
29
  action = directive.action;
29
30
  }
30
31
  else {
32
+ this.logger.error("Incorrect action for ", directive.name, directive)
31
33
  winston.warn("DirWebRequestV2 Incorrect directive: ", directive);
32
34
  callback();
33
35
  return;
34
36
  }
35
- this.logger.info("Executing WebRequest action ", directive.action)
36
37
  this.go(action, (stop) => {
37
- this.logger.info("WebRequest action terminated")
38
+ this.logger.info("[Web Request] Action completed");
38
39
  callback(stop);
39
40
  }).catch((err) => {
40
41
  // do not nothing
@@ -69,7 +70,7 @@ class DirWebRequestV2 {
69
70
  const url = filler.fill(action.url, requestAttributes);
70
71
 
71
72
  let headers = await this.getHeadersFromAction(action, filler, requestAttributes).catch( async (err) => {
72
- this.logger.error("WebRequest: error getting headers");
73
+ this.logger.error("[Web Request] Error getting headers");
73
74
  await this.chatbot.addParameter("flowError", "Error getting headers");
74
75
  if (falseIntent) {
75
76
  await this.#executeCondition(false, trueIntent, trueIntentAttributes, falseIntent, falseIntentAttributes);
@@ -81,7 +82,7 @@ class DirWebRequestV2 {
81
82
  });
82
83
 
83
84
  let json = await this.getJsonFromAction(action, filler, requestAttributes).catch( async (err) => {
84
- this.logger.error("WebRequest: error parsing json body");
85
+ this.logger.error("[Web Request] Error parsing json body");
85
86
  await this.chatbot.addParameter("flowError", "Error parsing json body");
86
87
  if (falseIntent) {
87
88
  await this.#executeCondition(false, trueIntent, trueIntentAttributes, falseIntent, falseIntentAttributes);
@@ -113,10 +114,10 @@ class DirWebRequestV2 {
113
114
  let error = res.error;
114
115
  await this.#assignAttributes(action, resbody, status, error)
115
116
  winston.debug("DirWebRequestV2 resbody:", resbody);
116
- this.logger.info("WebRequest resbody: ", resbody);
117
+ this.logger.debug("[Web Request] resbody: ", resbody);
117
118
 
118
119
  if (err) {
119
- this.logger.error("WebRequest error: ", err);
120
+ this.logger.error("[Web Request] error: ", err);
120
121
  winston.log("webRequest error: ", err);
121
122
  if (callback) {
122
123
  if (falseIntent) {
@@ -138,8 +139,8 @@ class DirWebRequestV2 {
138
139
  return;
139
140
  }
140
141
  else {
141
- this.logger.warn("WebRequest status ", status);
142
- this.logger.error("WebRequest error ", error);
142
+ this.logger.warn("[Web Request] status ", status);
143
+ this.logger.error("[Web Request] error ", error);
143
144
  if (falseIntent) {
144
145
  await this.#executeCondition(false, trueIntent, trueIntentAttributes, falseIntent, falseIntentAttributes);
145
146
  callback(true);
@@ -16,23 +16,24 @@ class DirWebResponse {
16
16
  this.requestId = context.requestId;
17
17
  this.token = context.token;
18
18
  this.tdcache = context.tdcache;
19
- this.logger = new Logger({ request_id: this.requestId, dev: this.supportRequest.draft, intent_id: this.context.reply.attributes.intent_info.intent_id });
19
+ this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest.draft, intent_id: this.context.reply.attributes.intent_info.intent_id });
20
20
  }
21
21
 
22
22
  execute(directive, callback) {
23
+ this.logger.info("[Web Response] Executing action");
23
24
  winston.debug("Execute WebResponse directive: ", directive);
24
25
  let action;
25
26
  if (directive.action) {
26
27
  action = directive.action;
27
28
  }
28
29
  else {
30
+ this.logger.error("Incorrect action for ", directive.name, directive)
29
31
  winston.debug("DirWebResponse Incorrect directive: ", directive);
30
32
  callback();
31
33
  return;
32
34
  }
33
- this.logger.info("Executing WebResponse action ", directive.action)
34
35
  this.go(action, () => {
35
- this.logger.info("WebResponse action terminated")
36
+ this.logger.info("[Web Response] Action completed");
36
37
  callback();
37
38
  });
38
39
  }
@@ -61,7 +62,7 @@ class DirWebResponse {
61
62
  payload: json
62
63
  }
63
64
 
64
- this.logger.debug("WebResponse payload: ", webResponse);
65
+ this.logger.debug("[Web Response] payload: ", webResponse);
65
66
 
66
67
  const topic = `/webhooks/${this.requestId}`;
67
68