@tiledesk/tiledesk-tybot-connector 2.0.38 → 2.0.40

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 (48) hide show
  1. package/engine/TiledeskChatbot.js +60 -3
  2. package/engine/mock/MockBotsDataSource.js +1 -1
  3. package/index.js +154 -3
  4. package/logs/app.log +110 -0
  5. package/package.json +1 -1
  6. package/services/TilebotService.js +36 -0
  7. package/tiledeskChatbotPlugs/DirectivesChatbotPlug.js +100 -519
  8. package/tiledeskChatbotPlugs/directives/DirAddKbContent.js +1 -1
  9. package/tiledeskChatbotPlugs/directives/DirAddTags.js +1 -1
  10. package/tiledeskChatbotPlugs/directives/DirAiCondition.js +1 -1
  11. package/tiledeskChatbotPlugs/directives/DirAiPrompt.js +1 -1
  12. package/tiledeskChatbotPlugs/directives/DirAskGPTV2.js +2 -2
  13. package/tiledeskChatbotPlugs/directives/DirAssistant.js +1 -1
  14. package/tiledeskChatbotPlugs/directives/DirBrevo.js +1 -1
  15. package/tiledeskChatbotPlugs/directives/DirCaptureUserReply.js +1 -1
  16. package/tiledeskChatbotPlugs/directives/DirClearTranscript.js +1 -1
  17. package/tiledeskChatbotPlugs/directives/DirClose.js +1 -1
  18. package/tiledeskChatbotPlugs/directives/DirCode.js +1 -1
  19. package/tiledeskChatbotPlugs/directives/DirCondition.js +1 -1
  20. package/tiledeskChatbotPlugs/directives/DirContactUpdate.js +1 -1
  21. package/tiledeskChatbotPlugs/directives/DirCustomerio.js +1 -1
  22. package/tiledeskChatbotPlugs/directives/DirDeleteVariable.js +1 -1
  23. package/tiledeskChatbotPlugs/directives/DirDepartment.js +1 -1
  24. package/tiledeskChatbotPlugs/directives/DirFlowLog.js +1 -1
  25. package/tiledeskChatbotPlugs/directives/DirGptTask.js +1 -1
  26. package/tiledeskChatbotPlugs/directives/DirHubspot.js +1 -1
  27. package/tiledeskChatbotPlugs/directives/DirIfOnlineAgentsV2.js +1 -1
  28. package/tiledeskChatbotPlugs/directives/DirIfOpenHours.js +1 -1
  29. package/tiledeskChatbotPlugs/directives/DirIntent.js +4 -0
  30. package/tiledeskChatbotPlugs/directives/DirJSONCondition.js +1 -1
  31. package/tiledeskChatbotPlugs/directives/DirMake.js +1 -1
  32. package/tiledeskChatbotPlugs/directives/DirMoveToAgent.js +1 -1
  33. package/tiledeskChatbotPlugs/directives/DirMoveToUnassigned.js +1 -1
  34. package/tiledeskChatbotPlugs/directives/DirQapla.js +1 -1
  35. package/tiledeskChatbotPlugs/directives/DirRandomReply.js +1 -1
  36. package/tiledeskChatbotPlugs/directives/DirReplaceBot.js +1 -1
  37. package/tiledeskChatbotPlugs/directives/DirReplaceBotV2.js +1 -1
  38. package/tiledeskChatbotPlugs/directives/DirReplaceBotV3.js +1 -1
  39. package/tiledeskChatbotPlugs/directives/DirReply.js +10 -2
  40. package/tiledeskChatbotPlugs/directives/DirReplyV2.js +1 -1
  41. package/tiledeskChatbotPlugs/directives/DirSendEmail.js +1 -1
  42. package/tiledeskChatbotPlugs/directives/DirSendWhatsapp.js +1 -1
  43. package/tiledeskChatbotPlugs/directives/DirSetAttributeV2.js +1 -1
  44. package/tiledeskChatbotPlugs/directives/DirWait.js +1 -1
  45. package/tiledeskChatbotPlugs/directives/DirWebRequestV2.js +1 -1
  46. package/tiledeskChatbotPlugs/directives/DirWebResponse.js +1 -1
  47. package/tiledeskChatbotPlugs/directives/DirWhatsappByAttribute.js +1 -1
  48. package/utils/TiledeskChatbotUtil.js +131 -141
@@ -30,7 +30,7 @@ class DirAiCondition {
30
30
  this.API_ENDPOINT = this.context.API_ENDPOINT;
31
31
 
32
32
  this.intentDir = new DirIntent(context);
33
- this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest?.draft, intent_id: this.context.reply?.attributes?.intent_info?.intent_id });
33
+ this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest?.draft, intent_id: this.context.reply?.intent_id || this.context.reply?.attributes?.intent_info?.intent_id });
34
34
  }
35
35
 
36
36
  execute(directive, callback) {
@@ -33,7 +33,7 @@ class DirAiPrompt {
33
33
  this.API_ENDPOINT = this.context.API_ENDPOINT;
34
34
 
35
35
  this.intentDir = new DirIntent(context);
36
- this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest?.draft, intent_id: this.context.reply?.attributes?.intent_info?.intent_id });
36
+ this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest?.draft, intent_id: this.context.reply?.intent_id || this.context.reply?.attributes?.intent_info?.intent_id });
37
37
  }
38
38
 
39
39
  execute(directive, callback) {
@@ -29,7 +29,7 @@ class DirAskGPTV2 {
29
29
  this.API_ENDPOINT = this.context.API_ENDPOINT;
30
30
 
31
31
  this.intentDir = new DirIntent(context);
32
- this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest?.draft, intent_id: this.context.reply?.attributes?.intent_info?.intent_id });
32
+ this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest?.draft, intent_id: this.context.reply?.intent_id || this.context.reply?.attributes?.intent_info?.intent_id });
33
33
  }
34
34
 
35
35
  execute(directive, callback) {
@@ -82,7 +82,7 @@ class DirAskGPTV2 {
82
82
  let chunks_only = false;
83
83
  let engine;
84
84
  let reranking;
85
- let skip_unanswered;
85
+ let skip_unanswered = false;
86
86
 
87
87
  let contexts = {
88
88
  "gpt-3.5-turbo": process.env.GPT_3_5_CONTEXT || "You are an helpful assistant for question-answering tasks.\nUse ONLY the pieces of retrieved context delimited by #### and the chat history to answer the question.\nIf you don't know the answer, just say: \"I don't know<NOANS>\"\n\n####{context}####",
@@ -21,7 +21,7 @@ class DirAssistant {
21
21
  this.API_ENDPOINT = context.API_ENDPOINT;
22
22
 
23
23
  this.intentDir = new DirIntent(context);
24
- this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest?.draft, intent_id: this.context.reply?.attributes?.intent_info?.intent_id });
24
+ this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest?.draft, intent_id: this.context.reply?.intent_id || this.context.reply?.attributes?.intent_info?.intent_id });
25
25
  }
26
26
 
27
27
  execute(directive, callback) {
@@ -22,7 +22,7 @@ class DirBrevo {
22
22
  this.API_ENDPOINT = this.context.API_ENDPOINT;
23
23
 
24
24
  this.intentDir = new DirIntent(context);
25
- this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest?.draft, intent_id: this.context.reply?.attributes?.intent_info?.intent_id });
25
+ this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest?.draft, intent_id: this.context.reply?.intent_id || this.context.reply?.attributes?.intent_info?.intent_id });
26
26
  }
27
27
 
28
28
  execute(directive, callback) {
@@ -18,7 +18,7 @@ class DirCaptureUserReply {
18
18
  this.requestId = context.requestId;
19
19
 
20
20
  this.intentDir = new DirIntent(context);
21
- this.logger = new Logger({ request_id: this.requestId, dev: this.context.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?.intent_id || this.context.reply?.attributes?.intent_info?.intent_id });
22
22
  }
23
23
 
24
24
  execute(directive, callback) {
@@ -11,7 +11,7 @@ class DirClearTranscript {
11
11
  this.context = context;
12
12
  this.requestId = context.requestId;
13
13
 
14
- this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest?.draft, intent_id: this.context.reply?.attributes?.intent_info?.intent_id });
14
+ this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest?.draft, intent_id: this.context.reply?.intent_id || this.context.reply?.attributes?.intent_info?.intent_id });
15
15
  }
16
16
 
17
17
  execute(directive, callback) {
@@ -15,7 +15,7 @@ class DirClose {
15
15
  this.chatbot = context.chatbot;
16
16
  this.API_ENDPOINT = context.API_ENDPOINT;
17
17
 
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
+ this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest?.draft, intent_id: this.context.reply?.intent_id || this.context.reply?.attributes?.intent_info?.intent_id });
19
19
  this.tdClient = new TiledeskClient({ projectId: this.context.projectId, token: this.context.token, APIURL: this.API_ENDPOINT, APIKEY: "___" });
20
20
  }
21
21
 
@@ -13,7 +13,7 @@ class DirCode {
13
13
  this.context = context;
14
14
  this.requestId = this.context.requestId;
15
15
 
16
- this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest?.draft, intent_id: this.context.reply?.attributes?.intent_info?.intent_id });
16
+ this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest?.draft, intent_id: this.context.reply?.intent_id || this.context.reply?.attributes?.intent_info?.intent_id });
17
17
  }
18
18
 
19
19
  execute(directive, callback) {
@@ -14,7 +14,7 @@ class DirCondition {
14
14
  this.requestId = this.context.requestId;
15
15
 
16
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 });
17
+ this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest?.draft, intent_id: this.context.reply?.intent_id || this.context.reply?.attributes?.intent_info?.intent_id });
18
18
  }
19
19
 
20
20
  execute(directive, callback) {
@@ -21,7 +21,7 @@ class DirContactUpdate {
21
21
  this.tdcache = context.tdcache;
22
22
  this.API_ENDPOINT = context.API_ENDPOINT;
23
23
 
24
- this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest?.draft, intent_id: this.context.reply?.attributes?.intent_info?.intent_id });
24
+ this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest?.draft, intent_id: this.context.reply?.intent_id || this.context.reply?.attributes?.intent_info?.intent_id });
25
25
  this.tdClient = new TiledeskClient({ projectId: this.context.projectId, token: this.context.token, APIURL: this.API_ENDPOINT, APIKEY: "___" });
26
26
  }
27
27
 
@@ -22,7 +22,7 @@ class DirCustomerio {
22
22
  this.API_ENDPOINT = this.context.API_ENDPOINT;
23
23
 
24
24
  this.intentDir = new DirIntent(context);
25
- this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest?.draft, intent_id: this.context.reply?.attributes?.intent_info?.intent_id });
25
+ this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest?.draft, intent_id: this.context.reply?.intent_id || this.context.reply?.attributes?.intent_info?.intent_id });
26
26
  }
27
27
 
28
28
  execute(directive, callback) {
@@ -13,7 +13,7 @@ class DirDeleteVariable {
13
13
  this.context = context;
14
14
  this.requestId = this.context.requestId;
15
15
 
16
- this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest?.draft, intent_id: this.context.reply?.attributes?.intent_info?.intent_id });
16
+ this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest?.draft, intent_id: this.context.reply?.intent_id || this.context.reply?.attributes?.intent_info?.intent_id });
17
17
  }
18
18
 
19
19
  async execute(directive, callback) {
@@ -13,7 +13,7 @@ class DirDepartment {
13
13
  this.API_ENDPOINT = context.API_ENDPOINT;
14
14
  this.log = context.log;
15
15
 
16
- this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest?.draft, intent_id: this.context.reply?.attributes?.intent_info?.intent_id });
16
+ this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest?.draft, intent_id: this.context.reply?.intent_id || this.context.reply?.attributes?.intent_info?.intent_id });
17
17
  this.tdClient = new TiledeskClient({ projectId: this.context.projectId, token: this.context.token, APIURL: this.API_ENDPOINT, APIKEY: "___" });
18
18
  }
19
19
 
@@ -19,7 +19,7 @@ class DirFlowLog {
19
19
  this.requestId = context.requestId;
20
20
  this.log = context.log;
21
21
 
22
- this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest?.draft, intent_id: this.context.reply?.attributes?.intent_info?.intent_id });
22
+ this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest?.draft, intent_id: this.context.reply?.intent_id || this.context.reply?.attributes?.intent_info?.intent_id });
23
23
  }
24
24
 
25
25
  execute(directive, callback) {
@@ -26,7 +26,7 @@ class DirGptTask {
26
26
  this.API_ENDPOINT = this.context.API_ENDPOINT;
27
27
 
28
28
  this.intentDir = new DirIntent(context);
29
- this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest?.draft, intent_id: this.context.reply?.attributes?.intent_info?.intent_id });
29
+ this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest?.draft, intent_id: this.context.reply?.intent_id || this.context.reply?.attributes?.intent_info?.intent_id });
30
30
  }
31
31
 
32
32
  execute(directive, callback) {
@@ -22,7 +22,7 @@ class DirHubspot {
22
22
  this.API_ENDPOINT = this.context.API_ENDPOINT;
23
23
 
24
24
  this.intentDir = new DirIntent(context);
25
- this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest?.draft, intent_id: this.context.reply?.attributes?.intent_info?.intent_id });
25
+ this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest?.draft, intent_id: this.context.reply?.intent_id || this.context.reply?.attributes?.intent_info?.intent_id });
26
26
  }
27
27
 
28
28
  execute(directive, callback) {
@@ -19,7 +19,7 @@ class DirIfOnlineAgentsV2 {
19
19
  this.API_ENDPOINT = context.API_ENDPOINT;
20
20
 
21
21
  this.intentDir = new DirIntent(context);
22
- this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest?.draft, intent_id: this.context.reply?.attributes?.intent_info?.intent_id });
22
+ this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest?.draft, intent_id: this.context.reply?.intent_id || this.context.reply?.attributes?.intent_info?.intent_id });
23
23
  this.tdClient = new TiledeskClient({ projectId: this.context.projectId, token: this.context.token, APIURL: this.API_ENDPOINT, APIKEY: "___" });
24
24
 
25
25
  }
@@ -17,7 +17,7 @@ class DirIfOpenHours {
17
17
  this.API_ENDPOINT = context.API_ENDPOINT;
18
18
 
19
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 });
20
+ this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest?.draft, intent_id: this.context.reply?.intent_id || this.context.reply?.attributes?.intent_info?.intent_id });
21
21
  }
22
22
 
23
23
  execute(directive, callback) {
@@ -71,6 +71,10 @@ class DirIntent {
71
71
  }
72
72
  winston.debug("DirIntent move to intent message: ", intent_command_request);
73
73
 
74
+ // tilebotService.executeBlock(intent_command_request, botId, () => {
75
+ // callback(true);
76
+ // });
77
+
74
78
  tilebotService.sendMessageToBot(intent_command_request, botId, () => {
75
79
  callback(true);
76
80
  });
@@ -15,7 +15,7 @@ class DirJSONCondition {
15
15
  this.requestId = this.context.requestId;
16
16
 
17
17
  this.intentDir = new DirIntent(context);
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
+ this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest?.draft, intent_id: this.context.reply?.intent_id || this.context.reply?.attributes?.intent_info?.intent_id });
19
19
  }
20
20
 
21
21
  execute(directive, callback) {
@@ -18,7 +18,7 @@ class DirMake {
18
18
  this.requestId = this.context.requestId;
19
19
 
20
20
  this.intentDir = new DirIntent(context);
21
- this.logger = new Logger({ request_id: this.requestId, dev: this.context.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?.intent_id || this.context.reply?.attributes?.intent_info?.intent_id });
22
22
  }
23
23
 
24
24
  execute(directive, callback) {
@@ -16,7 +16,7 @@ class DirMoveToAgent {
16
16
  this.requestId = context.requestId;
17
17
  this.API_ENDPOINT = context.API_ENDPOINT;
18
18
 
19
- this.logger = new Logger({ request_id: this.requestId, dev: this.context.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?.intent_id || this.context.reply?.attributes?.intent_info?.intent_id });
20
20
  this.tdClient = new TiledeskClient({ projectId: this.context.projectId, token: this.context.token, APIURL: this.API_ENDPOINT, APIKEY: "___" });
21
21
  }
22
22
 
@@ -15,7 +15,7 @@ class DirMoveToUnassigned {
15
15
  this.requestId = context.requestId;
16
16
  this.API_ENDPOINT = context.API_ENDPOINT;
17
17
 
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
+ this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest?.draft, intent_id: this.context.reply?.intent_id || this.context.reply?.attributes?.intent_info?.intent_id });
19
19
  this.tdClient = new TiledeskClient({ projectId: this.context.projectId, token: this.context.token, APIURL: this.API_ENDPOINT, APIKEY: "___" });
20
20
  }
21
21
 
@@ -23,7 +23,7 @@ class DirQapla {
23
23
  this.API_ENDPOINT = this.context.API_ENDPOINT;
24
24
 
25
25
  this.intentDir = new DirIntent(context);
26
- this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest?.draft, intent_id: this.context.reply?.attributes?.intent_info?.intent_id });
26
+ this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest?.draft, intent_id: this.context.reply?.intent_id || this.context.reply?.attributes?.intent_info?.intent_id });
27
27
  }
28
28
 
29
29
  execute(directive, callback) {
@@ -18,7 +18,7 @@ class DirRandomReply {
18
18
  this.tdcache = context.tdcache;
19
19
  this.API_ENDPOINT = context.API_ENDPOINT;
20
20
 
21
- this.logger = new Logger({ request_id: this.requestId, dev: this.context.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?.intent_id || this.context.reply?.attributes?.intent_info?.intent_id });
22
22
  this.tdClient = new TiledeskClient({ projectId: this.context.projectId, token: this.context.token, APIURL: this.API_ENDPOINT, APIKEY: "___" });
23
23
  }
24
24
 
@@ -14,7 +14,7 @@ class DirReplaceBot {
14
14
  this.requestId = context.requestId;
15
15
  this.API_ENDPOINT = context.API_ENDPOINT;
16
16
 
17
- this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest?.draft, intent_id: this.context.reply?.attributes?.intent_info?.intent_id });
17
+ this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest?.draft, intent_id: this.context.reply?.intent_id || this.context.reply?.attributes?.intent_info?.intent_id });
18
18
  this.tdClient = new TiledeskClient({ projectId: this.context.projectId, token: this.context.token, APIURL: this.API_ENDPOINT, APIKEY: "___" });
19
19
  }
20
20
 
@@ -18,7 +18,7 @@ class DirReplaceBotV2 {
18
18
  this.requestId = context.requestId;
19
19
  this.API_ENDPOINT = context.API_ENDPOINT;
20
20
 
21
- this.logger = new Logger({ request_id: this.requestId, dev: this.context.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?.intent_id || this.context.reply?.attributes?.intent_info?.intent_id });
22
22
  this.tdClient = new TiledeskClient({ projectId: this.context.projectId, token: this.context.token, APIURL: this.API_ENDPOINT, APIKEY: "___" });
23
23
  }
24
24
 
@@ -18,7 +18,7 @@ class DirReplaceBotV3 {
18
18
  this.requestId = context.requestId;
19
19
  this.API_ENDPOINT = context.API_ENDPOINT;
20
20
 
21
- this.logger = new Logger({ request_id: this.requestId, dev: this.context.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?.intent_id || this.context.reply?.attributes?.intent_info?.intent_id });
22
22
  this.tdClient = new TiledeskClient({ projectId: this.context.projectId, token: this.context.token, APIURL: this.API_ENDPOINT, APIKEY: "___" });
23
23
  }
24
24
 
@@ -20,7 +20,7 @@ class DirReply {
20
20
  this.log = context.log;
21
21
  this.API_ENDPOINT = context.API_ENDPOINT;
22
22
 
23
- this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest?.draft, intent_id: this.context.reply?.attributes?.intent_info?.intent_id });
23
+ this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest?.draft, intent_id: this.context.reply?.intent_id || this.context.reply?.attributes?.intent_info?.intent_id });
24
24
  this.tdClient = new TiledeskClient({ projectId: this.context.projectId, token: this.context.token, APIURL: this.API_ENDPOINT, APIKEY: "___", log: this.log });
25
25
  }
26
26
 
@@ -118,9 +118,17 @@ class DirReply {
118
118
  // message.attributes.updateUserFullname = requestAttributes['userFullname'];
119
119
  // }
120
120
  // intent_info
121
- if (this.context.reply && this.context.reply.attributes && this.context.reply.attributes.intent_info) {
121
+
122
+ // REFACTOR - START
123
+ if (this.context.reply.intent_display_name) {
124
+ message.attributes.intentName = this.context.reply.intent_display_name;
125
+ }
126
+ else if (this.context.reply && this.context.reply.attributes && this.context.reply.attributes.intent_info) {
122
127
  message.attributes.intentName = this.context.reply.attributes.intent_info.intent_name;
123
128
  }
129
+ // REFACTOR - END
130
+
131
+
124
132
  // userFlowAttributes
125
133
  let userFlowAttributes = TiledeskChatbotUtil.userFlowAttributes(requestAttributes);
126
134
  winston.debug("DirReply userFlowAttributes:", userFlowAttributes);
@@ -27,7 +27,7 @@ class DirReplyV2 {
27
27
  this.API_ENDPOINT = context.API_ENDPOINT;
28
28
 
29
29
  this.intentDir = new DirIntent(context);
30
- this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest?.draft, intent_id: this.context.reply?.attributes?.intent_info?.intent_id });
30
+ this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest?.draft, intent_id: this.context.reply?.intent_id || this.context.reply?.attributes?.intent_info?.intent_id });
31
31
  this.tdClient = new TiledeskClient({ projectId: this.context.projectId, token: this.context.token, APIURL: this.API_ENDPOINT, APIKEY: "___" });
32
32
  }
33
33
 
@@ -17,7 +17,7 @@ class DirSendEmail {
17
17
  this.requestId = context.requestId;
18
18
  this.API_ENDPOINT = context.API_ENDPOINT;
19
19
 
20
- this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest?.draft, intent_id: this.context.reply?.attributes?.intent_info?.intent_id });
20
+ this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest?.draft, intent_id: this.context.reply?.intent_id || this.context.reply?.attributes?.intent_info?.intent_id });
21
21
  this.tdClient = new TiledeskClient({ projectId: this.context.projectId, token: this.context.token, APIURL: this.API_ENDPOINT, APIKEY: "___" });
22
22
  }
23
23
 
@@ -21,7 +21,7 @@ class DirSendWhatsapp {
21
21
  this.API_ENDPOINT = this.context.API_ENDPOINT;
22
22
 
23
23
  this.intentDir = new DirIntent(context);
24
- this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest?.draft, intent_id: this.context.reply?.attributes?.intent_info?.intent_id });
24
+ this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest?.draft, intent_id: this.context.reply?.intent_id || this.context.reply?.attributes?.intent_info?.intent_id });
25
25
  }
26
26
 
27
27
  execute(directive, callback) {
@@ -82,7 +82,7 @@ class DirSetAttributeV2 {
82
82
  this.tdcache = context.tdcache;
83
83
  this.requestId = context.requestId;
84
84
 
85
- this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest?.draft, intent_id: this.context.reply?.attributes?.intent_info?.intent_id });
85
+ this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest?.draft, intent_id: this.context.reply?.intent_id || this.context.reply?.attributes?.intent_info?.intent_id });
86
86
  }
87
87
 
88
88
  execute(directive, callback) {
@@ -14,7 +14,7 @@ class DirWait {
14
14
  this.tdcache = context.tdcache;
15
15
  this.requestId = context.requestId;
16
16
 
17
- this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest?.draft, intent_id: this.context.reply?.attributes?.intent_info?.intent_id });
17
+ this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest?.draft, intent_id: this.context.reply?.intent_id || this.context.reply?.attributes?.intent_info?.intent_id });
18
18
  }
19
19
 
20
20
  execute(directive, callback) {
@@ -19,7 +19,7 @@ class DirWebRequestV2 {
19
19
  this.log = context.log;
20
20
 
21
21
  this.intentDir = new DirIntent(context);
22
- this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest?.draft, intent_id: this.context.reply?.attributes?.intent_info?.intent_id });
22
+ this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest?.draft, intent_id: this.context.reply?.intent_id || this.context.reply?.attributes?.intent_info?.intent_id });
23
23
  }
24
24
 
25
25
  execute(directive, callback) {
@@ -17,7 +17,7 @@ class DirWebResponse {
17
17
  this.token = context.token;
18
18
  this.tdcache = context.tdcache;
19
19
 
20
- this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest?.draft, intent_id: this.context.reply?.attributes?.intent_info?.intent_id });
20
+ this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest?.draft, intent_id: this.context.reply?.intent_id || this.context.reply?.attributes?.intent_info?.intent_id });
21
21
  }
22
22
 
23
23
  execute(directive, callback) {
@@ -16,7 +16,7 @@ class DirWhatsappByAttribute {
16
16
  this.requestId = this.context.requestId;
17
17
  this.API_ENDPOINT = context.API_ENDPOINT;
18
18
 
19
- this.logger = new Logger({ request_id: this.requestId, dev: this.context.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?.intent_id || this.context.reply?.attributes?.intent_info?.intent_id });
20
20
  }
21
21
 
22
22
  execute(directive, callback) {