@tiledesk/tiledesk-tybot-connector 2.0.10-rc13 → 2.0.10-rc15

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 (51) hide show
  1. package/Logger.js +4 -0
  2. package/logs/app2.log +11113 -0
  3. package/package.json +1 -1
  4. package/tiledeskChatbotPlugs/directives/DirAddTags.js +3 -8
  5. package/tiledeskChatbotPlugs/directives/DirAiPrompt.js +3 -2
  6. package/tiledeskChatbotPlugs/directives/DirAskGPT.js +2 -1
  7. package/tiledeskChatbotPlugs/directives/DirAskGPTV2.js +3 -2
  8. package/tiledeskChatbotPlugs/directives/DirAssign.js +0 -6
  9. package/tiledeskChatbotPlugs/directives/DirAssignFromFunction.js +1 -6
  10. package/tiledeskChatbotPlugs/directives/DirAssistant.js +3 -2
  11. package/tiledeskChatbotPlugs/directives/DirBrevo.js +3 -2
  12. package/tiledeskChatbotPlugs/directives/DirCaptureUserReply.js +2 -1
  13. package/tiledeskChatbotPlugs/directives/DirClearTranscript.js +2 -1
  14. package/tiledeskChatbotPlugs/directives/DirClose.js +3 -8
  15. package/tiledeskChatbotPlugs/directives/DirCode.js +2 -1
  16. package/tiledeskChatbotPlugs/directives/DirCondition.js +2 -1
  17. package/tiledeskChatbotPlugs/directives/DirContactUpdate.js +3 -8
  18. package/tiledeskChatbotPlugs/directives/DirCustomerio.js +3 -2
  19. package/tiledeskChatbotPlugs/directives/DirDeflectToHelpCenter.js +1 -6
  20. package/tiledeskChatbotPlugs/directives/DirDeleteVariable.js +2 -1
  21. package/tiledeskChatbotPlugs/directives/DirDepartment.js +3 -8
  22. package/tiledeskChatbotPlugs/directives/DirFireTiledeskEvent.js +3 -7
  23. package/tiledeskChatbotPlugs/directives/DirForm.js +4 -10
  24. package/tiledeskChatbotPlugs/directives/DirGptTask.js +3 -2
  25. package/tiledeskChatbotPlugs/directives/DirGptTask_OLD.js +3 -1
  26. package/tiledeskChatbotPlugs/directives/DirHubspot.js +3 -2
  27. package/tiledeskChatbotPlugs/directives/DirIfOnlineAgents.js +4 -8
  28. package/tiledeskChatbotPlugs/directives/DirIfOnlineAgentsV2.js +4 -9
  29. package/tiledeskChatbotPlugs/directives/DirIfOpenHours.js +2 -1
  30. package/tiledeskChatbotPlugs/directives/DirIfOpenHours_OLD.js +4 -8
  31. package/tiledeskChatbotPlugs/directives/DirJSONCondition.js +2 -1
  32. package/tiledeskChatbotPlugs/directives/DirMake.js +2 -1
  33. package/tiledeskChatbotPlugs/directives/DirMessage.js +1 -6
  34. package/tiledeskChatbotPlugs/directives/DirMoveToAgent.js +2 -8
  35. package/tiledeskChatbotPlugs/directives/DirMoveToUnassigned.js +3 -8
  36. package/tiledeskChatbotPlugs/directives/DirQapla.js +3 -2
  37. package/tiledeskChatbotPlugs/directives/DirRandomReply.js +3 -8
  38. package/tiledeskChatbotPlugs/directives/DirRemoveCurrentBot.js +1 -6
  39. package/tiledeskChatbotPlugs/directives/DirReplaceBot.js +3 -8
  40. package/tiledeskChatbotPlugs/directives/DirReplaceBotV2.js +4 -8
  41. package/tiledeskChatbotPlugs/directives/DirReplaceBotV3.js +4 -8
  42. package/tiledeskChatbotPlugs/directives/DirReply.js +4 -9
  43. package/tiledeskChatbotPlugs/directives/DirReplyV2.js +4 -9
  44. package/tiledeskChatbotPlugs/directives/DirSendEmail.js +3 -8
  45. package/tiledeskChatbotPlugs/directives/DirSendWhatsapp.js +3 -2
  46. package/tiledeskChatbotPlugs/directives/DirSetAttributeV2.js +1 -3
  47. package/tiledeskChatbotPlugs/directives/DirSetConversationTags.js +2 -7
  48. package/tiledeskChatbotPlugs/directives/DirWait.js +2 -1
  49. package/tiledeskChatbotPlugs/directives/DirWebRequestV2.js +3 -2
  50. package/tiledeskChatbotPlugs/directives/DirWebResponse.js +2 -1
  51. package/tiledeskChatbotPlugs/directives/DirWhatsappByAttribute.js +2 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tiledesk/tiledesk-tybot-connector",
3
- "version": "2.0.10-rc13",
3
+ "version": "2.0.10-rc15",
4
4
  "description": "Tiledesk Tybot connector",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -24,14 +24,9 @@ class DirAddTags {
24
24
  this.tdcache = this.context.tdcache;
25
25
  this.requestId = this.context.requestId;
26
26
  this.API_ENDPOINT = this.context.API_ENDPOINT;
27
- this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest.draft, intent_id: this.context.reply.attributes.intent_info.intent_id });
28
-
29
- this.tdClient = new TiledeskClient({
30
- projectId: this.context.projectId,
31
- token: this.context.token,
32
- APIURL: this.API_ENDPOINT,
33
- APIKEY: "___"
34
- });
27
+
28
+ 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.tdClient = new TiledeskClient({ projectId: this.context.projectId, token: this.context.token, APIURL: this.API_ENDPOINT, APIKEY: "___" });
35
30
  }
36
31
 
37
32
  execute(directive, callback) {
@@ -26,9 +26,10 @@ class DirAiPrompt {
26
26
  this.requestId = this.context.requestId;
27
27
  this.projectId = this.context.projectId;
28
28
  this.token = this.context.token;
29
- this.intentDir = new DirIntent(context);
30
29
  this.API_ENDPOINT = this.context.API_ENDPOINT;
31
- this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest.draft, intent_id: this.context.reply.attributes.intent_info.intent_id });
30
+
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
33
  }
33
34
 
34
35
  execute(directive, callback) {
@@ -19,8 +19,9 @@ class DirAskGPT {
19
19
  this.requestId = this.context.requestId;
20
20
  this.projectId = this.context.projectId;
21
21
  this.token = this.context.token;
22
- this.intentDir = new DirIntent(context);
23
22
  this.API_ENDPOINT = this.context.API_ENDPOINT;
23
+
24
+ this.intentDir = new DirIntent(context);
24
25
  }
25
26
 
26
27
  execute(directive, callback) {
@@ -24,9 +24,10 @@ class DirAskGPTV2 {
24
24
  this.requestId = this.context.requestId;
25
25
  this.projectId = this.context.projectId;
26
26
  this.token = this.context.token;
27
- this.intentDir = new DirIntent(context);
28
27
  this.API_ENDPOINT = this.context.API_ENDPOINT;
29
- this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest.draft, intent_id: this.context.reply.attributes.intent_info.intent_id });
28
+
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
31
  }
31
32
 
32
33
  execute(directive, callback) {
@@ -62,12 +62,6 @@ class DirAssign {
62
62
  const value = new TiledeskExpression().evaluateExpression(expression, variables);
63
63
  winston.debug("(DirAssign) executed expression: " + expression + " value: " + value);
64
64
  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)
70
- }
71
65
 
72
66
  callback();
73
67
  }
@@ -13,12 +13,7 @@ class DirAssignFromFunction {
13
13
  this.tdcache = context.tdcache;
14
14
  this.API_ENDPOINT = context.API_ENDPOINT;
15
15
 
16
- this.tdClient = new TiledeskClient({
17
- projectId: this.context.projectId,
18
- token: this.context.token,
19
- APIURL: this.API_ENDPOINT,
20
- APIKEY: "___"
21
- });
16
+ this.tdClient = new TiledeskClient({ projectId: this.context.projectId, token: this.context.token, APIURL: this.API_ENDPOINT, APIKEY: "___" });
22
17
  }
23
18
 
24
19
  async execute(directive, callback) {
@@ -18,9 +18,10 @@ class DirAssistant {
18
18
  this.requestId = context.requestId;
19
19
  this.projectId = this.context.projectId;
20
20
  this.token = this.context.token;
21
- this.intentDir = new DirIntent(context);
22
21
  this.API_ENDPOINT = 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
+
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
25
  }
25
26
 
26
27
  execute(directive, callback) {
@@ -19,9 +19,10 @@ class DirBrevo {
19
19
  this.requestId = this.context.requestId;
20
20
  this.projectId = this.context.projectId;
21
21
  this.token = this.context.token;
22
- this.intentDir = new DirIntent(context);
23
22
  this.API_ENDPOINT = this.context.API_ENDPOINT;
24
- this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest.draft, intent_id: this.context.reply.attributes.intent_info.intent_id });
23
+
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
26
  }
26
27
 
27
28
  execute(directive, callback) {
@@ -16,8 +16,9 @@ class DirCaptureUserReply {
16
16
  this.chatbot = context.chatbot;
17
17
  this.tdcache = context.tdcache;
18
18
  this.requestId = context.requestId;
19
+
19
20
  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 });
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
22
  }
22
23
 
23
24
  execute(directive, callback) {
@@ -10,7 +10,8 @@ class DirClearTranscript {
10
10
  }
11
11
  this.context = context;
12
12
  this.requestId = context.requestId;
13
- this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest.draft, intent_id: this.context.reply.attributes.intent_info.intent_id });
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
15
  }
15
16
 
16
17
  execute(directive, callback) {
@@ -14,14 +14,9 @@ class DirClose {
14
14
  this.requestId = context.requestId;
15
15
  this.chatbot = context.chatbot;
16
16
  this.API_ENDPOINT = context.API_ENDPOINT;
17
- 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
- this.tdClient = new TiledeskClient({
20
- projectId: this.context.projectId,
21
- token: this.context.token,
22
- APIURL: this.API_ENDPOINT,
23
- APIKEY: "___"
24
- });
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 });
19
+ this.tdClient = new TiledeskClient({ projectId: this.context.projectId, token: this.context.token, APIURL: this.API_ENDPOINT, APIKEY: "___" });
25
20
  }
26
21
 
27
22
  execute(directive, callback) {
@@ -12,7 +12,8 @@ class DirCode {
12
12
  }
13
13
  this.context = context;
14
14
  this.requestId = this.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 });
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
17
  }
17
18
 
18
19
  execute(directive, callback) {
@@ -13,8 +13,9 @@ class DirCondition {
13
13
  }
14
14
  this.context = context;
15
15
  this.requestId = this.context.requestId;
16
+
16
17
  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 });
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
 
20
21
  execute(directive, callback) {
@@ -20,14 +20,9 @@ class DirContactUpdate {
20
20
  this.token = context.token;
21
21
  this.tdcache = context.tdcache;
22
22
  this.API_ENDPOINT = 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 });
24
-
25
- this.tdClient = new TiledeskClient({
26
- projectId: this.context.projectId,
27
- token: this.context.token,
28
- APIURL: this.API_ENDPOINT,
29
- APIKEY: "___"
30
- });
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 });
25
+ this.tdClient = new TiledeskClient({ projectId: this.context.projectId, token: this.context.token, APIURL: this.API_ENDPOINT, APIKEY: "___" });
31
26
  }
32
27
 
33
28
  execute(directive, callback) {
@@ -19,9 +19,10 @@ class DirCustomerio {
19
19
  this.requestId = this.context.requestId;
20
20
  this.projectId = this.context.projectId;
21
21
  this.token = this.context.token;
22
- this.intentDir = new DirIntent(context);
23
22
  this.API_ENDPOINT = this.context.API_ENDPOINT;
24
- this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest.draft, intent_id: this.context.reply.attributes.intent_info.intent_id });
23
+
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
26
  }
26
27
 
27
28
  execute(directive, callback) {
@@ -14,12 +14,7 @@ class DirDeflectToHelpCenter {
14
14
  this.context = context;
15
15
  this.API_ENDPOINT = context.API_ENDPOINT;
16
16
 
17
- this.tdClient = new TiledeskClient({
18
- projectId: this.context.projectId,
19
- token: this.context.token,
20
- APIURL: this.API_ENDPOINT,
21
- APIKEY: "___"
22
- });
17
+ this.tdClient = new TiledeskClient({ projectId: this.context.projectId, token: this.context.token, APIURL: this.API_ENDPOINT, APIKEY: "___", log: this.log });
23
18
  }
24
19
 
25
20
  async execute(directive, callback) {
@@ -13,7 +13,8 @@ class DirDeleteVariable {
13
13
  }
14
14
  this.context = context;
15
15
  this.requestId = this.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 });
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
18
  }
18
19
 
19
20
  async execute(directive, callback) {
@@ -12,14 +12,9 @@ class DirDepartment {
12
12
  this.requestId = context.requestId;
13
13
  this.API_ENDPOINT = context.API_ENDPOINT;
14
14
  this.log = context.log;
15
- this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest.draft, intent_id: this.context.reply.attributes.intent_info.intent_id });
16
-
17
- this.tdClient = new TiledeskClient({
18
- projectId: this.context.projectId,
19
- token: this.context.token,
20
- APIURL: this.API_ENDPOINT,
21
- APIKEY: "___"
22
- });
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 });
17
+ this.tdClient = new TiledeskClient({ projectId: this.context.projectId, token: this.context.token, APIURL: this.API_ENDPOINT, APIKEY: "___" });
23
18
  }
24
19
 
25
20
  execute(directive, callback) {
@@ -10,14 +10,10 @@ class DirFireTiledeskEvent {
10
10
  }
11
11
 
12
12
  this.context = context;
13
-
13
+ this.log = context.log;
14
14
  this.API_ENDPOINT = context.API_ENDPOINT;
15
- this.tdClient = new TiledeskClient({
16
- projectId: this.context.projectId,
17
- token: this.context.token,
18
- APIURL: this.API_ENDPOINT,
19
- APIKEY: "___"
20
- });
15
+
16
+ this.tdClient = new TiledeskClient({ projectId: this.context.projectId, token: this.context.token, APIURL: this.API_ENDPOINT, APIKEY: "___", log: this.log });
21
17
  }
22
18
 
23
19
  execute(directive, callback) {
@@ -14,17 +14,11 @@ class DirForm {
14
14
  this.chatbot = context.chatbot;
15
15
  this.tdcache = context.tdcache;
16
16
  this.requestId = context.requestId;
17
- this.intentDir = new DirIntent(context);
18
-
19
- console.log("\n\n\nDIR FORMmmm")
17
+ this.log = context.log;
20
18
  this.API_ENDPOINT = context.API_ENDPOINT;
21
- this.tdClient = new TiledeskClient({
22
- projectId: this.context.projectId,
23
- token: this.context.token,
24
- APIURL: this.API_ENDPOINT,
25
- APIKEY: "___"
26
- });
27
-
19
+
20
+ this.intentDir = new DirIntent(context);
21
+ this.tdClient = new TiledeskClient({ projectId: this.context.projectId, token: this.context.token, APIURL: this.API_ENDPOINT, APIKEY: "___", log: this.log });
28
22
  }
29
23
 
30
24
  execute(directive, callback) {
@@ -23,9 +23,10 @@ class DirGptTask {
23
23
  this.requestId = this.context.requestId;
24
24
  this.projectId = this.context.projectId;
25
25
  this.token = this.context.token;
26
- this.intentDir = new DirIntent(context);
27
26
  this.API_ENDPOINT = this.context.API_ENDPOINT;
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
+
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
30
  }
30
31
 
31
32
  execute(directive, callback) {
@@ -16,8 +16,10 @@ class DirGptTask {
16
16
  this.context = context;
17
17
  this.tdcache = this.context.tdcache;
18
18
  this.requestId = this.context.requestId;
19
- this.intentDir = new DirIntent(context);
20
19
  this.API_ENDPOINT = this.context.API_ENDPOINT;
20
+ this.log = context.log;
21
+
22
+ this.intentDir = new DirIntent(context);
21
23
  }
22
24
 
23
25
  execute(directive, callback) {
@@ -19,9 +19,10 @@ class DirHubspot {
19
19
  this.requestId = this.context.requestId;
20
20
  this.projectId = this.context.projectId;
21
21
  this.token = this.context.token;
22
- this.intentDir = new DirIntent(context);
23
22
  this.API_ENDPOINT = this.context.API_ENDPOINT;
24
- this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest.draft, intent_id: this.context.reply.attributes.intent_info.intent_id });
23
+
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
26
  }
26
27
 
27
28
  execute(directive, callback) {
@@ -11,15 +11,11 @@ class DirIfOnlineAgents {
11
11
  }
12
12
 
13
13
  this.context = context;
14
- this.intentDir = new DirIntent(context);
15
14
  this.API_ENDPOINT = context.API_ENDPOINT;
16
-
17
- this.tdClient = new TiledeskClient({
18
- projectId: this.context.projectId,
19
- token: this.context.token,
20
- APIURL: this.API_ENDPOINT,
21
- APIKEY: "___"
22
- });
15
+ this.log = context.log;
16
+
17
+ this.intentDir = new DirIntent(context);
18
+ this.tdClient = new TiledeskClient({ projectId: this.context.projectId, token: this.context.token, APIURL: this.API_ENDPOINT, APIKEY: "___", log: this.log });
23
19
  }
24
20
 
25
21
  execute(directive, callback) {
@@ -16,16 +16,11 @@ class DirIfOnlineAgentsV2 {
16
16
  this.context = context;
17
17
  this.chatbot = context.chatbot;
18
18
  this.requestId = this.context.requestId;
19
- this.intentDir = new DirIntent(context);
20
19
  this.API_ENDPOINT = context.API_ENDPOINT;
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
-
23
- this.tdClient = new TiledeskClient({
24
- projectId: this.context.projectId,
25
- token: this.context.token,
26
- APIURL: this.API_ENDPOINT,
27
- APIKEY: "___"
28
- });
20
+
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 });
23
+ this.tdClient = new TiledeskClient({ projectId: this.context.projectId, token: this.context.token, APIURL: this.API_ENDPOINT, APIKEY: "___" });
29
24
 
30
25
  }
31
26
 
@@ -16,8 +16,9 @@ class DirIfOpenHours {
16
16
  this.context = context;
17
17
  this.requestId = this.context.requestId;
18
18
  this.API_ENDPOINT = context.API_ENDPOINT;
19
+
19
20
  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 });
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
22
  }
22
23
 
23
24
  execute(directive, callback) {
@@ -11,15 +11,11 @@ class DirIfOpenHours {
11
11
  }
12
12
 
13
13
  this.context = context;
14
- this.intentDir = new DirIntent(context);
15
-
14
+ this.log = context.log;
16
15
  this.API_ENDPOINT = context.API_ENDPOINT;
17
- this.tdClient = new TiledeskClient({
18
- projectId: this.context.projectId,
19
- token: this.context.token,
20
- APIURL: this.API_ENDPOINT,
21
- APIKEY: "___"
22
- });
16
+
17
+ this.intentDir = new DirIntent(context);
18
+ this.tdClient = new TiledeskClient({ projectId: this.context.projectId, token: this.context.token, APIURL: this.API_ENDPOINT, APIKEY: "___", log: this.log });
23
19
  }
24
20
 
25
21
  execute(directive, callback) {
@@ -13,8 +13,9 @@ class DirJSONCondition {
13
13
  this.context = context;
14
14
  this.chatbot = context.chatbot;
15
15
  this.requestId = this.context.requestId;
16
+
16
17
  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 });
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
 
20
21
  execute(directive, callback) {
@@ -16,8 +16,9 @@ class DirMake {
16
16
  this.context = context;
17
17
  this.tdcache = this.context.tdcache;
18
18
  this.requestId = this.context.requestId;
19
+
19
20
  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 });
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
22
  }
22
23
 
23
24
  execute(directive, callback) {
@@ -18,12 +18,7 @@ class DirMessage {
18
18
  this.token = context.token;
19
19
  this.supportRequest = this.context.supportRequest
20
20
 
21
- this.tdClient = new TiledeskClient({
22
- projectId: this.context.projectId,
23
- token: this.context.token,
24
- APIURL: this.API_ENDPOINT,
25
- APIKEY: "___"
26
- });
21
+ this.tdClient = new TiledeskClient({ projectId: this.context.projectId, token: this.context.token, APIURL: this.API_ENDPOINT, APIKEY: "___", log: this.log });
27
22
  }
28
23
 
29
24
  execute(directive, callback) {
@@ -14,16 +14,10 @@ class DirMoveToAgent {
14
14
  this.context = context;
15
15
  this.tdcache = context.tdcache;
16
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 });
18
-
19
17
  this.API_ENDPOINT = context.API_ENDPOINT;
20
- this.tdClient = new TiledeskClient({
21
- projectId: this.context.projectId,
22
- token: this.context.token,
23
- APIURL: this.API_ENDPOINT,
24
- APIKEY: "___"
25
- });
26
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 });
20
+ this.tdClient = new TiledeskClient({ projectId: this.context.projectId, token: this.context.token, APIURL: this.API_ENDPOINT, APIKEY: "___" });
27
21
  }
28
22
 
29
23
  execute(directive, callback) {
@@ -13,15 +13,10 @@ class DirMoveToUnassigned {
13
13
  }
14
14
  this.context = context;
15
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 });
17
-
18
16
  this.API_ENDPOINT = context.API_ENDPOINT;
19
- this.tdClient = new TiledeskClient({
20
- projectId: this.context.projectId,
21
- token: this.context.token,
22
- APIURL: this.API_ENDPOINT,
23
- APIKEY: "___"
24
- });
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 });
19
+ this.tdClient = new TiledeskClient({ projectId: this.context.projectId, token: this.context.token, APIURL: this.API_ENDPOINT, APIKEY: "___" });
25
20
  }
26
21
 
27
22
  execute(directive, callback) {
@@ -20,9 +20,10 @@ class DirQapla {
20
20
  this.requestId = this.context.requestId;
21
21
  this.projectId = this.context.projectId;
22
22
  this.token = this.context.token;
23
- this.intentDir = new DirIntent(context);
24
23
  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
+
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
27
  }
27
28
 
28
29
  execute(directive, callback) {
@@ -16,15 +16,10 @@ class DirRandomReply {
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.context.supportRequest.draft, intent_id: this.context.reply.attributes.intent_info.intent_id });
20
-
21
19
  this.API_ENDPOINT = context.API_ENDPOINT;
22
- this.tdClient = new TiledeskClient({
23
- projectId: this.context.projectId,
24
- token: this.context.token,
25
- APIURL: this.API_ENDPOINT,
26
- APIKEY: "___"
27
- });
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 });
22
+ this.tdClient = new TiledeskClient({ projectId: this.context.projectId, token: this.context.token, APIURL: this.API_ENDPOINT, APIKEY: "___" });
28
23
  }
29
24
 
30
25
  execute(directive, callback) {
@@ -12,12 +12,7 @@ class DirRemoveCurrentBot {
12
12
  this.requestId = context.requestId;
13
13
  this.API_ENDPOINT = context.API_ENDPOINT;
14
14
 
15
- this.tdClient = new TiledeskClient({
16
- projectId: this.context.projectId,
17
- token: this.context.token,
18
- APIURL: this.API_ENDPOINT,
19
- APIKEY: "___"
20
- });
15
+ this.tdClient = new TiledeskClient({ projectId: this.context.projectId, token: this.context.token, APIURL: this.API_ENDPOINT, APIKEY: "___", log: this.log });
21
16
  }
22
17
 
23
18
  execute(directive, callback) {
@@ -12,15 +12,10 @@ class DirReplaceBot {
12
12
  }
13
13
  this.context = context;
14
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 });
16
-
17
15
  this.API_ENDPOINT = context.API_ENDPOINT;
18
- this.tdClient = new TiledeskClient({
19
- projectId: this.context.projectId,
20
- token: this.context.token,
21
- APIURL: this.API_ENDPOINT,
22
- APIKEY: "___"
23
- });
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 });
18
+ this.tdClient = new TiledeskClient({ projectId: this.context.projectId, token: this.context.token, APIURL: this.API_ENDPOINT, APIKEY: "___" });
24
19
  }
25
20
 
26
21
  execute(directive, callback) {
@@ -6,6 +6,7 @@ const axios = require("axios").default;
6
6
  let https = require("https");
7
7
  const winston = require('../../utils/winston');
8
8
  const httpUtils = require('../../utils/HttpUtils');
9
+ const { Logger } = require('../../Logger');
9
10
 
10
11
  class DirReplaceBotV2 {
11
12
 
@@ -15,15 +16,10 @@ class DirReplaceBotV2 {
15
16
  }
16
17
  this.context = context;
17
18
  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 });
19
-
20
19
  this.API_ENDPOINT = context.API_ENDPOINT;
21
- this.tdClient = new TiledeskClient({
22
- projectId: this.context.projectId,
23
- token: this.context.token,
24
- APIURL: this.API_ENDPOINT,
25
- APIKEY: "___"
26
- });
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 });
22
+ this.tdClient = new TiledeskClient({ projectId: this.context.projectId, token: this.context.token, APIURL: this.API_ENDPOINT, APIKEY: "___" });
27
23
  }
28
24
 
29
25
  execute(directive, callback) {
@@ -6,6 +6,7 @@ const axios = require("axios").default;
6
6
  let https = require("https");
7
7
  const winston = require('../../utils/winston');
8
8
  const httpUtils = require('../../utils/HttpUtils');
9
+ const { Logger } = require('../../Logger');
9
10
 
10
11
  class DirReplaceBotV3 {
11
12
 
@@ -15,15 +16,10 @@ class DirReplaceBotV3 {
15
16
  }
16
17
  this.context = context;
17
18
  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 });
19
-
20
19
  this.API_ENDPOINT = context.API_ENDPOINT;
21
- this.tdClient = new TiledeskClient({
22
- projectId: this.context.projectId,
23
- token: this.context.token,
24
- APIURL: this.API_ENDPOINT,
25
- APIKEY: "___"
26
- });
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 });
22
+ this.tdClient = new TiledeskClient({ projectId: this.context.projectId, token: this.context.token, APIURL: this.API_ENDPOINT, APIKEY: "___" });
27
23
  }
28
24
 
29
25
  execute(directive, callback) {