@tiledesk/tiledesk-tybot-connector 2.0.16-rc4 → 2.0.16
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.
- package/CHANGELOG.md +3 -28
- package/Logger.js +4 -14
- package/TdCache copy.js +242 -0
- package/engine/mock/MockBotsDataSource.js +2 -1
- package/index.js +0 -3
- package/logs/app.log +44714 -5981
- package/logs/app1.log +16653 -0
- package/package.json +2 -2
- package/tiledeskChatbotPlugs/DirectivesChatbotPlug.js +11 -29
- package/tiledeskChatbotPlugs/directives/DirAddKbContent.js +21 -20
- package/tiledeskChatbotPlugs/directives/DirAddTags.js +6 -5
- package/tiledeskChatbotPlugs/directives/DirAiPrompt.js +8 -7
- package/tiledeskChatbotPlugs/directives/DirAskGPTV2.js +21 -53
- package/tiledeskChatbotPlugs/directives/DirAssistant.js +2 -1
- package/tiledeskChatbotPlugs/directives/DirBrevo.js +2 -1
- package/tiledeskChatbotPlugs/directives/DirCaptureUserReply.js +5 -4
- package/tiledeskChatbotPlugs/directives/DirClearTranscript.js +2 -1
- package/tiledeskChatbotPlugs/directives/DirClose.js +3 -2
- package/tiledeskChatbotPlugs/directives/DirCode.js +2 -1
- package/tiledeskChatbotPlugs/directives/DirCondition.js +4 -3
- package/tiledeskChatbotPlugs/directives/DirContactUpdate.js +2 -1
- package/tiledeskChatbotPlugs/directives/DirCustomerio.js +2 -1
- package/tiledeskChatbotPlugs/directives/DirDeleteVariable.js +2 -1
- package/tiledeskChatbotPlugs/directives/DirDepartment.js +4 -3
- package/tiledeskChatbotPlugs/directives/DirFlowLog.js +5 -5
- package/tiledeskChatbotPlugs/directives/DirGptTask.js +5 -4
- package/tiledeskChatbotPlugs/directives/DirHubspot.js +2 -1
- package/tiledeskChatbotPlugs/directives/DirIfOnlineAgentsV2.js +2 -1
- package/tiledeskChatbotPlugs/directives/DirIfOpenHours.js +4 -3
- package/tiledeskChatbotPlugs/directives/DirIntent.js +0 -1
- package/tiledeskChatbotPlugs/directives/DirJSONCondition.js +5 -4
- package/tiledeskChatbotPlugs/directives/DirMake.js +2 -1
- package/tiledeskChatbotPlugs/directives/DirMoveToAgent.js +2 -1
- package/tiledeskChatbotPlugs/directives/DirMoveToUnassigned.js +2 -1
- package/tiledeskChatbotPlugs/directives/DirQapla.js +2 -1
- package/tiledeskChatbotPlugs/directives/DirRandomReply.js +2 -1
- package/tiledeskChatbotPlugs/directives/DirReplaceBot.js +2 -1
- package/tiledeskChatbotPlugs/directives/DirReplaceBotV2.js +2 -1
- package/tiledeskChatbotPlugs/directives/DirReplaceBotV3.js +2 -1
- package/tiledeskChatbotPlugs/directives/DirReply.js +5 -6
- package/tiledeskChatbotPlugs/directives/DirReplyV2.js +2 -1
- package/tiledeskChatbotPlugs/directives/DirSendEmail.js +2 -1
- package/tiledeskChatbotPlugs/directives/DirSendWhatsapp.js +2 -1
- package/tiledeskChatbotPlugs/directives/DirSetAttributeV2.js +2 -1
- package/tiledeskChatbotPlugs/directives/DirWait.js +3 -2
- package/tiledeskChatbotPlugs/directives/DirWebRequestV2.js +9 -8
- package/tiledeskChatbotPlugs/directives/DirWebRequestV2_old.js +418 -0
- package/tiledeskChatbotPlugs/directives/DirWebResponse.js +3 -2
- package/tiledeskChatbotPlugs/directives/DirWhatsappByAttribute.js +2 -1
- package/tiledeskChatbotPlugs/directives/Directives.js +0 -1
- package/utils/TiledeskChatbotUtil.js +25 -4
- package/logs/app4.log +0 -46163
- package/logs/app5.log +0 -39983
- package/logs/app6.log +0 -50376
- package/logs/app7.log +0 -43568
- package/logs/app8.log +0 -4779
|
@@ -19,6 +19,7 @@ class DirCondition {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
execute(directive, callback) {
|
|
22
|
+
this.logger.info("[Condition] Executing action");
|
|
22
23
|
winston.verbose("Execute Condition directive");
|
|
23
24
|
let action;
|
|
24
25
|
if (directive.action) {
|
|
@@ -44,7 +45,7 @@ class DirCondition {
|
|
|
44
45
|
return;
|
|
45
46
|
}
|
|
46
47
|
this.go(action, (stop) => {
|
|
47
|
-
this.logger.
|
|
48
|
+
this.logger.info("[Condition] Action completed");
|
|
48
49
|
callback(stop);
|
|
49
50
|
});
|
|
50
51
|
|
|
@@ -130,7 +131,7 @@ class DirCondition {
|
|
|
130
131
|
});
|
|
131
132
|
}
|
|
132
133
|
else {
|
|
133
|
-
this.logger.
|
|
134
|
+
this.logger.debug("[Condition] No trueIntentDirective specified");
|
|
134
135
|
winston.debug("(DirCondition) No trueIntentDirective specified");
|
|
135
136
|
callback();
|
|
136
137
|
return;
|
|
@@ -143,7 +144,7 @@ class DirCondition {
|
|
|
143
144
|
});
|
|
144
145
|
}
|
|
145
146
|
else {
|
|
146
|
-
this.logger.
|
|
147
|
+
this.logger.debug("[Condition] No falseIntentDirective specified");
|
|
147
148
|
winston.debug("(DirCondition) No falseIntentDirective specified");
|
|
148
149
|
callback();
|
|
149
150
|
return;
|
|
@@ -26,6 +26,7 @@ class DirContactUpdate {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
execute(directive, callback) {
|
|
29
|
+
this.logger.info("[Lead Update] Executing action");
|
|
29
30
|
winston.verbose("Execute ContactUpdate directive")
|
|
30
31
|
let action;
|
|
31
32
|
if (directive.action) {
|
|
@@ -42,7 +43,7 @@ class DirContactUpdate {
|
|
|
42
43
|
return;
|
|
43
44
|
}
|
|
44
45
|
this.go(action, () => {
|
|
45
|
-
this.logger.
|
|
46
|
+
this.logger.info("[Lead Update] Action completed");
|
|
46
47
|
callback();
|
|
47
48
|
});
|
|
48
49
|
}
|
|
@@ -26,6 +26,7 @@ class DirCustomerio {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
execute(directive, callback) {
|
|
29
|
+
this.logger.info("[Customer.io] Executing action");
|
|
29
30
|
winston.verbose("Execute Customerio directive");
|
|
30
31
|
let action;
|
|
31
32
|
if (directive.action) {
|
|
@@ -38,7 +39,7 @@ class DirCustomerio {
|
|
|
38
39
|
return;
|
|
39
40
|
}
|
|
40
41
|
this.go(action, (stop) => {
|
|
41
|
-
this.logger.
|
|
42
|
+
this.logger.info("[Customer.io] Action completed");
|
|
42
43
|
callback(stop);
|
|
43
44
|
})
|
|
44
45
|
}
|
|
@@ -18,6 +18,7 @@ class DirDeleteVariable {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
async execute(directive, callback) {
|
|
21
|
+
this.logger.info("[Delete Attribute] Executing action");
|
|
21
22
|
winston.verbose("Execute DeleteVariable directive");
|
|
22
23
|
let action;
|
|
23
24
|
if (directive.action) {
|
|
@@ -35,7 +36,7 @@ class DirDeleteVariable {
|
|
|
35
36
|
return;
|
|
36
37
|
}
|
|
37
38
|
this.go(action, () => {
|
|
38
|
-
this.logger.
|
|
39
|
+
this.logger.info("[Delete Attribute] Action completed");
|
|
39
40
|
callback();
|
|
40
41
|
});
|
|
41
42
|
}
|
|
@@ -18,6 +18,7 @@ class DirDepartment {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
execute(directive, callback) {
|
|
21
|
+
this.logger.info("[Change Department] Executing action");
|
|
21
22
|
winston.verbose("Execute Department directive");
|
|
22
23
|
let action;
|
|
23
24
|
if (directive.action) {
|
|
@@ -33,7 +34,7 @@ class DirDepartment {
|
|
|
33
34
|
}
|
|
34
35
|
}
|
|
35
36
|
this.go(action, () => {
|
|
36
|
-
this.logger.
|
|
37
|
+
this.logger.info("[Change Department] Action executed");
|
|
37
38
|
callback();
|
|
38
39
|
});
|
|
39
40
|
|
|
@@ -95,7 +96,7 @@ class DirDepartment {
|
|
|
95
96
|
this.logger.error("[Change Department] Unable to trigger bot");
|
|
96
97
|
winston.error("(DirDepartment) Error sending hidden message: " + err.message)
|
|
97
98
|
} else {
|
|
98
|
-
this.logger.
|
|
99
|
+
this.logger.debug("[Change Department] Bot triggered");
|
|
99
100
|
winston.debug("(DirDepartment) Hidden message sent.");
|
|
100
101
|
|
|
101
102
|
}
|
|
@@ -104,7 +105,7 @@ class DirDepartment {
|
|
|
104
105
|
}
|
|
105
106
|
}
|
|
106
107
|
else {
|
|
107
|
-
this.logger.
|
|
108
|
+
this.logger.debug("[Change Department] No triggering bot");
|
|
108
109
|
winston.debug("(DirDepartment) No action.triggerBot");
|
|
109
110
|
callback();
|
|
110
111
|
}
|
|
@@ -62,22 +62,22 @@ class DirFlowLog {
|
|
|
62
62
|
|
|
63
63
|
const filler = new Filler();
|
|
64
64
|
const filled_log = filler.fill(action.log, requestVariables);
|
|
65
|
-
winston.debug("(DirFlowLog)
|
|
65
|
+
winston.debug("(DirFlowLog) fille log: ", filled_log);
|
|
66
66
|
|
|
67
67
|
if (level === 'error') {
|
|
68
|
-
winston.
|
|
68
|
+
winston.info("Adding log '" + filled_log + "' with level " + level);
|
|
69
69
|
this.logger.error(filled_log);
|
|
70
70
|
}
|
|
71
71
|
else if (level === 'warn') {
|
|
72
|
-
winston.
|
|
72
|
+
winston.info("Adding log '" + filled_log + "' with level " + level);
|
|
73
73
|
this.logger.warn(filled_log);
|
|
74
74
|
}
|
|
75
75
|
else if (level === 'info') {
|
|
76
|
-
winston.
|
|
76
|
+
winston.info("Adding log '" + filled_log + "' with level " + level);
|
|
77
77
|
this.logger.info(filled_log);
|
|
78
78
|
}
|
|
79
79
|
else if (level === 'debug') {
|
|
80
|
-
winston.
|
|
80
|
+
winston.info("Adding log '" + filled_log + "' with level " + level);
|
|
81
81
|
this.logger.debug(filled_log);
|
|
82
82
|
}
|
|
83
83
|
|
|
@@ -30,6 +30,7 @@ class DirGptTask {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
execute(directive, callback) {
|
|
33
|
+
this.logger.info("[ChatGPT Task] Executing action");
|
|
33
34
|
winston.verbose("Execute GptTask directive");
|
|
34
35
|
let action;
|
|
35
36
|
if (directive.action) {
|
|
@@ -42,7 +43,7 @@ class DirGptTask {
|
|
|
42
43
|
return;
|
|
43
44
|
}
|
|
44
45
|
this.go(action, (stop) => {
|
|
45
|
-
this.logger.
|
|
46
|
+
this.logger.info("[ChatGPT Task] Action completed");
|
|
46
47
|
callback(stop);
|
|
47
48
|
})
|
|
48
49
|
}
|
|
@@ -124,13 +125,13 @@ class DirGptTask {
|
|
|
124
125
|
|
|
125
126
|
let key = await integrationService.getKeyFromIntegrations(this.projectId, 'openai', this.token);
|
|
126
127
|
if (!key) {
|
|
127
|
-
this.logger.
|
|
128
|
+
this.logger.debug("[ChatGPT Task] Key not found in Integrations.");
|
|
128
129
|
winston.debug("(DirGptTask) - Key not found in Integrations. Searching in kb settings...");
|
|
129
130
|
key = await this.getKeyFromKbSettings();
|
|
130
131
|
}
|
|
131
132
|
|
|
132
133
|
if (!key) {
|
|
133
|
-
this.logger.
|
|
134
|
+
this.logger.debug("[ChatGPT Task] Retrieve shared gptkey.");
|
|
134
135
|
winston.debug("(DirGptTask) - Retrieve public gptkey")
|
|
135
136
|
key = process.env.GPTKEY;
|
|
136
137
|
publicKey = true;
|
|
@@ -228,7 +229,7 @@ class DirGptTask {
|
|
|
228
229
|
answer = await this.convertToJson(answer);
|
|
229
230
|
}
|
|
230
231
|
|
|
231
|
-
this.logger.
|
|
232
|
+
this.logger.debug("[ChatGPT Task] Completions answer: ", answer);
|
|
232
233
|
|
|
233
234
|
await this.#assignAttributes(action, answer);
|
|
234
235
|
|
|
@@ -26,6 +26,7 @@ class DirHubspot {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
execute(directive, callback) {
|
|
29
|
+
this.logger.info("[Hubspot] Executing action");
|
|
29
30
|
winston.verbose("Execute Hubspot directive");
|
|
30
31
|
let action;
|
|
31
32
|
if (directive.action) {
|
|
@@ -38,7 +39,7 @@ class DirHubspot {
|
|
|
38
39
|
return;
|
|
39
40
|
}
|
|
40
41
|
this.go(action, (stop) => {
|
|
41
|
-
this.logger.
|
|
42
|
+
this.logger.info("[Hubspot] Action completed");
|
|
42
43
|
callback(stop);
|
|
43
44
|
})
|
|
44
45
|
}
|
|
@@ -25,6 +25,7 @@ class DirIfOnlineAgentsV2 {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
execute(directive, callback) {
|
|
28
|
+
this.logger.info("[If Online Agents] Executing action");
|
|
28
29
|
winston.verbose("Execute IfOnlineAgentsV2 directive");
|
|
29
30
|
let action;
|
|
30
31
|
if (directive.action) {
|
|
@@ -37,7 +38,7 @@ class DirIfOnlineAgentsV2 {
|
|
|
37
38
|
return;
|
|
38
39
|
}
|
|
39
40
|
this.go(action, (stop) => {
|
|
40
|
-
this.logger.
|
|
41
|
+
this.logger.info("[If Online Agents] Action completed");
|
|
41
42
|
callback(stop);
|
|
42
43
|
});
|
|
43
44
|
}
|
|
@@ -22,6 +22,7 @@ class DirIfOpenHours {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
execute(directive, callback) {
|
|
25
|
+
this.logger.info("[If Operating Hours] Executing action");
|
|
25
26
|
winston.verbose("Execute IfOpenHours directive");
|
|
26
27
|
let action;
|
|
27
28
|
if (directive.action) {
|
|
@@ -47,7 +48,7 @@ class DirIfOpenHours {
|
|
|
47
48
|
return;
|
|
48
49
|
}
|
|
49
50
|
this.go(action, (stop) => {
|
|
50
|
-
this.logger.
|
|
51
|
+
this.logger.info("[If Operating Hours] Action complteted");
|
|
51
52
|
callback(stop);
|
|
52
53
|
});
|
|
53
54
|
}
|
|
@@ -114,7 +115,7 @@ class DirIfOpenHours {
|
|
|
114
115
|
}
|
|
115
116
|
} else {
|
|
116
117
|
if (resbody.isopen && resbody.isopen === true) {
|
|
117
|
-
this.logger.
|
|
118
|
+
this.logger.debug("[If Operating Hours] is open: true")
|
|
118
119
|
if (trueIntent) {
|
|
119
120
|
let intentDirective = DirIntent.intentDirectiveFor(trueIntent);
|
|
120
121
|
winston.debug("(DirIfOpenHours) agents (openHours) => trueIntent");
|
|
@@ -125,7 +126,7 @@ class DirIfOpenHours {
|
|
|
125
126
|
callback();
|
|
126
127
|
return;
|
|
127
128
|
} else {
|
|
128
|
-
this.logger.
|
|
129
|
+
this.logger.debug("[If Operating Hours] is open: false")
|
|
129
130
|
if (falseIntent) {
|
|
130
131
|
let intentDirective = DirIntent.intentDirectiveFor(falseIntent);
|
|
131
132
|
winston.debug("(DirIfOpenHours) !agents (openHours) => falseIntent", falseIntent);
|
|
@@ -19,6 +19,7 @@ class DirJSONCondition {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
execute(directive, callback) {
|
|
22
|
+
this.logger.info("[Condition] Executing action");
|
|
22
23
|
winston.verbose("Execute JSONCondition directive");
|
|
23
24
|
let action;
|
|
24
25
|
if (directive.action) {
|
|
@@ -31,7 +32,7 @@ class DirJSONCondition {
|
|
|
31
32
|
return;
|
|
32
33
|
}
|
|
33
34
|
this.go(action, (stop) => {
|
|
34
|
-
this.logger.
|
|
35
|
+
this.logger.info("[Condition] Action completed");
|
|
35
36
|
callback(stop);
|
|
36
37
|
});
|
|
37
38
|
|
|
@@ -87,7 +88,7 @@ class DirJSONCondition {
|
|
|
87
88
|
// const result = await this.evaluateCondition(scriptCondition, variables);
|
|
88
89
|
let result;
|
|
89
90
|
const expression = TiledeskExpression.JSONGroupsToExpression(groups, variables);
|
|
90
|
-
this.logger.
|
|
91
|
+
this.logger.debug("[Condition] Evaluating expression: ", expression);
|
|
91
92
|
result = new TiledeskExpression().evaluateStaticExpression(expression, variables);
|
|
92
93
|
winston.debug("(DirJSONCondition) Evaluation result: ", result);
|
|
93
94
|
if (result === true) {
|
|
@@ -97,7 +98,7 @@ class DirJSONCondition {
|
|
|
97
98
|
});
|
|
98
99
|
}
|
|
99
100
|
else {
|
|
100
|
-
this.logger.
|
|
101
|
+
this.logger.debug("[Condition] No trueIntentDirective specified");
|
|
101
102
|
winston.debug("(DirJSONCondition) No trueIntentDirective specified");
|
|
102
103
|
callback();
|
|
103
104
|
return;
|
|
@@ -114,7 +115,7 @@ class DirJSONCondition {
|
|
|
114
115
|
});
|
|
115
116
|
}
|
|
116
117
|
else {
|
|
117
|
-
this.logger.
|
|
118
|
+
this.logger.debug("[Condition] No falseIntentDirective specified");
|
|
118
119
|
winston.debug("(DirJSONCondition) No falseIntentDirective specified");
|
|
119
120
|
callback();
|
|
120
121
|
return;
|
|
@@ -22,6 +22,7 @@ class DirMake {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
execute(directive, callback) {
|
|
25
|
+
this.logger.info("[Make] Executing action");
|
|
25
26
|
winston.verbose("Execute Make directive");
|
|
26
27
|
let action;
|
|
27
28
|
if (directive.action) {
|
|
@@ -34,7 +35,7 @@ class DirMake {
|
|
|
34
35
|
return;
|
|
35
36
|
}
|
|
36
37
|
this.go(action, (stop) => {
|
|
37
|
-
this.logger.
|
|
38
|
+
this.logger.info("[Make] Action completed");
|
|
38
39
|
callback(stop);
|
|
39
40
|
})
|
|
40
41
|
}
|
|
@@ -21,10 +21,11 @@ class DirMoveToAgent {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
execute(directive, callback) {
|
|
24
|
+
this.logger.info("[Transfer to a Human] Executing action");
|
|
24
25
|
winston.verbose("Execute MoveToAgent directive");
|
|
25
26
|
directive.action = {};
|
|
26
27
|
this.go(directive.action, () => {
|
|
27
|
-
this.logger.
|
|
28
|
+
this.logger.info("[Transfer to a Human] Action completed");
|
|
28
29
|
callback();
|
|
29
30
|
});
|
|
30
31
|
}
|
|
@@ -20,10 +20,11 @@ class DirMoveToUnassigned {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
execute(directive, callback) {
|
|
23
|
+
this.logger.info("[Move to Unassigned] Executing action");
|
|
23
24
|
winston.verbose("Execute MoveToUnassigned directive");
|
|
24
25
|
directive.action = {};
|
|
25
26
|
this.go(directive.action, () => {
|
|
26
|
-
this.logger.
|
|
27
|
+
this.logger.info("[Move to Unassigned] Action completed");
|
|
27
28
|
callback();
|
|
28
29
|
});
|
|
29
30
|
}
|
|
@@ -27,6 +27,7 @@ class DirQapla {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
execute(directive, callback) {
|
|
30
|
+
this.logger.info("[Qapla] Executing action");
|
|
30
31
|
let action;
|
|
31
32
|
if (directive.action) {
|
|
32
33
|
action = directive.action;
|
|
@@ -38,7 +39,7 @@ class DirQapla {
|
|
|
38
39
|
return;
|
|
39
40
|
}
|
|
40
41
|
this.go(action, (stop) => {
|
|
41
|
-
this.logger.
|
|
42
|
+
this.logger.info("[Qapla] Action completed");
|
|
42
43
|
callback(stop);
|
|
43
44
|
})
|
|
44
45
|
}
|
|
@@ -23,6 +23,7 @@ class DirRandomReply {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
execute(directive, callback) {
|
|
26
|
+
this.logger.info("[Random Reply] Executing action");
|
|
26
27
|
winston.verbose("Execute RandomReply directive");
|
|
27
28
|
let action;
|
|
28
29
|
if (directive.action) {
|
|
@@ -39,7 +40,7 @@ class DirRandomReply {
|
|
|
39
40
|
return;
|
|
40
41
|
}
|
|
41
42
|
this.go(action, () => {
|
|
42
|
-
this.logger.
|
|
43
|
+
this.logger.info("[Random Reply] Action completed");
|
|
43
44
|
callback();
|
|
44
45
|
});
|
|
45
46
|
}
|
|
@@ -19,6 +19,7 @@ class DirReplaceBot {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
execute(directive, callback) {
|
|
22
|
+
this.logger.info("[Replace Bot] Executing action");
|
|
22
23
|
winston.verbose("Execute ReplaceBot directive");
|
|
23
24
|
let action;
|
|
24
25
|
if (directive.action) {
|
|
@@ -36,7 +37,7 @@ class DirReplaceBot {
|
|
|
36
37
|
callback();
|
|
37
38
|
}
|
|
38
39
|
this.go(action, () => {
|
|
39
|
-
this.logger.
|
|
40
|
+
this.logger.info("[Replace Bot] Action completed");
|
|
40
41
|
callback();
|
|
41
42
|
})
|
|
42
43
|
}
|
|
@@ -23,6 +23,7 @@ class DirReplaceBotV2 {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
execute(directive, callback) {
|
|
26
|
+
this.logger.info("[Replace Bot] Executing action");
|
|
26
27
|
winston.verbose("Execute ReplaceBotV2 directive");
|
|
27
28
|
let action;
|
|
28
29
|
if (directive.action) {
|
|
@@ -40,7 +41,7 @@ class DirReplaceBotV2 {
|
|
|
40
41
|
callback();
|
|
41
42
|
}
|
|
42
43
|
this.go(action, () => {
|
|
43
|
-
this.logger.
|
|
44
|
+
this.logger.info("[Replace Bot] Action completed");
|
|
44
45
|
callback();
|
|
45
46
|
})
|
|
46
47
|
}
|
|
@@ -23,6 +23,7 @@ class DirReplaceBotV3 {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
execute(directive, callback) {
|
|
26
|
+
this.logger.info("[Replace Bot] Executing action");
|
|
26
27
|
winston.verbose("Execute ReplaceBotV3 directive");
|
|
27
28
|
let action;
|
|
28
29
|
if (directive.action) {
|
|
@@ -35,7 +36,7 @@ class DirReplaceBotV3 {
|
|
|
35
36
|
return;
|
|
36
37
|
}
|
|
37
38
|
this.go(action, () => {
|
|
38
|
-
this.logger.
|
|
39
|
+
this.logger.info("[Replace Bot] Action completed");
|
|
39
40
|
callback();
|
|
40
41
|
})
|
|
41
42
|
}
|
|
@@ -19,14 +19,13 @@ class DirReply {
|
|
|
19
19
|
this.tdcache = context.tdcache;
|
|
20
20
|
this.log = context.log;
|
|
21
21
|
this.API_ENDPOINT = context.API_ENDPOINT;
|
|
22
|
-
|
|
23
|
-
console.log("context.supportRequest: ", context.supportRequest);
|
|
24
22
|
|
|
25
23
|
this.logger = new Logger({ request_id: this.requestId, dev: this.context.supportRequest?.draft, intent_id: this.context.reply?.attributes?.intent_info?.intent_id });
|
|
26
24
|
this.tdClient = new TiledeskClient({ projectId: this.context.projectId, token: this.context.token, APIURL: this.API_ENDPOINT, APIKEY: "___", log: this.log });
|
|
27
25
|
}
|
|
28
26
|
|
|
29
27
|
execute(directive, callback) {
|
|
28
|
+
this.logger.info("[Reply] Executing action");
|
|
30
29
|
let action;
|
|
31
30
|
if (directive.action) {
|
|
32
31
|
action = directive.action;
|
|
@@ -43,7 +42,7 @@ class DirReply {
|
|
|
43
42
|
}
|
|
44
43
|
|
|
45
44
|
this.go(action, () => {
|
|
46
|
-
this.logger.
|
|
45
|
+
this.logger.info("[Reply] Action completed");
|
|
47
46
|
callback();
|
|
48
47
|
});
|
|
49
48
|
}
|
|
@@ -64,17 +63,17 @@ class DirReply {
|
|
|
64
63
|
const filler = new Filler();
|
|
65
64
|
// fill text attribute
|
|
66
65
|
message.text = filler.fill(message.text, requestAttributes);
|
|
67
|
-
this.logger.
|
|
66
|
+
this.logger.debug("[Reply] Reply with: " + message.text);
|
|
68
67
|
|
|
69
68
|
if (message.metadata) {
|
|
70
69
|
winston.debug("DirReply filling message 'metadata':", message.metadata);
|
|
71
70
|
if (message.metadata.src) {
|
|
72
71
|
message.metadata.src = filler.fill(message.metadata.src, requestAttributes);
|
|
73
|
-
this.logger.
|
|
72
|
+
this.logger.debug("Filled metadata.src with ", message.metadata.src);
|
|
74
73
|
}
|
|
75
74
|
if (message.metadata.name) {
|
|
76
75
|
message.metadata.name = filler.fill(message.metadata.name, requestAttributes);
|
|
77
|
-
this.logger.
|
|
76
|
+
this.logger.debug("Filled metadata.name with ", message.metadata.name);
|
|
78
77
|
}
|
|
79
78
|
}
|
|
80
79
|
winston.debug("DirReply filling commands'. Message:", message);
|
|
@@ -32,6 +32,7 @@ class DirReplyV2 {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
execute(directive, callback) {
|
|
35
|
+
this.logger.info("[Advanced Reply] Executing action");
|
|
35
36
|
winston.verbose("Execute ReplyV2 directive");
|
|
36
37
|
let action;
|
|
37
38
|
if (directive.action) {
|
|
@@ -48,7 +49,7 @@ class DirReplyV2 {
|
|
|
48
49
|
return;
|
|
49
50
|
}
|
|
50
51
|
this.go(action, (stop) => {
|
|
51
|
-
this.logger.
|
|
52
|
+
this.logger.info("[Advanced Reply] Action completed");
|
|
52
53
|
callback(stop);
|
|
53
54
|
});
|
|
54
55
|
}
|
|
@@ -23,6 +23,7 @@ class DirSendEmail {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
execute(directive, callback) {
|
|
26
|
+
this.logger.info("[Send Email] Executing action");
|
|
26
27
|
winston.verbose("Execute SendEmail directive");
|
|
27
28
|
let action;
|
|
28
29
|
if (directive.action) {
|
|
@@ -43,7 +44,7 @@ class DirSendEmail {
|
|
|
43
44
|
return;
|
|
44
45
|
}
|
|
45
46
|
this.go(action, () => {
|
|
46
|
-
this.logger.
|
|
47
|
+
this.logger.info("[Send Email] Action completed");
|
|
47
48
|
callback();
|
|
48
49
|
});
|
|
49
50
|
}
|
|
@@ -25,6 +25,7 @@ class DirSendWhatsapp {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
execute(directive, callback) {
|
|
28
|
+
this.logger.info("[Send Whatsapp] Executing action");
|
|
28
29
|
winston.verbose("Execute SendWhatsapp directive");
|
|
29
30
|
let action;
|
|
30
31
|
if (directive.action) {
|
|
@@ -37,7 +38,7 @@ class DirSendWhatsapp {
|
|
|
37
38
|
return;
|
|
38
39
|
}
|
|
39
40
|
this.go(action, (stop) => {
|
|
40
|
-
this.logger.
|
|
41
|
+
this.logger.info("[Send Whatsapp] Action completed");
|
|
41
42
|
callback(stop);
|
|
42
43
|
})
|
|
43
44
|
}
|
|
@@ -86,6 +86,7 @@ class DirSetAttributeV2 {
|
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
execute(directive, callback) {
|
|
89
|
+
this.logger.info("[Set Attribute] Executing action");
|
|
89
90
|
winston.verbose("Execute SetAttributeV2 directive");
|
|
90
91
|
let action;
|
|
91
92
|
if (directive.action) {
|
|
@@ -98,7 +99,7 @@ class DirSetAttributeV2 {
|
|
|
98
99
|
return;
|
|
99
100
|
}
|
|
100
101
|
this.go(action, () => {
|
|
101
|
-
this.logger.
|
|
102
|
+
this.logger.info("[Set Attribute] Action completed");
|
|
102
103
|
callback();
|
|
103
104
|
});
|
|
104
105
|
}
|
|
@@ -19,6 +19,7 @@ class DirWait {
|
|
|
19
19
|
|
|
20
20
|
execute(directive, callback) {
|
|
21
21
|
// 500ms < wait-time < 10.000ms
|
|
22
|
+
this.logger.info("[Wait] Executing action");
|
|
22
23
|
winston.verbose("Execute Wait directive");
|
|
23
24
|
let action;
|
|
24
25
|
if (directive.action) {
|
|
@@ -47,7 +48,7 @@ class DirWait {
|
|
|
47
48
|
}
|
|
48
49
|
|
|
49
50
|
this.go(action, () => {
|
|
50
|
-
this.logger.
|
|
51
|
+
this.logger.info("[Wait] Action completed");
|
|
51
52
|
callback();
|
|
52
53
|
})
|
|
53
54
|
}
|
|
@@ -60,7 +61,7 @@ class DirWait {
|
|
|
60
61
|
// await this.tdcache.set(step_key, 0);
|
|
61
62
|
await TiledeskChatbot.resetStep(this.tdcache, this.requestId);
|
|
62
63
|
}
|
|
63
|
-
this.logger.
|
|
64
|
+
this.logger.info("[Wait] Waiting for ", action.millis, "[ms]")
|
|
64
65
|
setTimeout(() => {
|
|
65
66
|
callback();
|
|
66
67
|
}, action.millis);
|
|
@@ -23,6 +23,7 @@ class DirWebRequestV2 {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
execute(directive, callback) {
|
|
26
|
+
this.logger.info("[Web Request] Executing action");
|
|
26
27
|
winston.verbose("Execute WebRequestV2 directive");
|
|
27
28
|
let action;
|
|
28
29
|
if (directive.action) {
|
|
@@ -34,9 +35,9 @@ class DirWebRequestV2 {
|
|
|
34
35
|
callback();
|
|
35
36
|
return;
|
|
36
37
|
}
|
|
37
|
-
this.logger.
|
|
38
|
+
this.logger.info("Executing WebRequest action ", directive.action)
|
|
38
39
|
this.go(action, (stop) => {
|
|
39
|
-
this.logger.
|
|
40
|
+
this.logger.info("[Web Request] Action completed");
|
|
40
41
|
callback(stop);
|
|
41
42
|
}).catch((err) => {
|
|
42
43
|
// do not nothing
|
|
@@ -115,10 +116,10 @@ class DirWebRequestV2 {
|
|
|
115
116
|
let error = res.error;
|
|
116
117
|
await this.#assignAttributes(action, resbody, status, error)
|
|
117
118
|
winston.debug("DirWebRequestV2 resbody:", resbody);
|
|
118
|
-
this.logger.
|
|
119
|
+
this.logger.debug("[Web Request] resbody: ", resbody);
|
|
119
120
|
|
|
120
121
|
if (err) {
|
|
121
|
-
this.logger.error("
|
|
122
|
+
this.logger.error("WebRequest error: ", err);
|
|
122
123
|
winston.log("webRequest error: ", err);
|
|
123
124
|
if (callback) {
|
|
124
125
|
if (falseIntent) {
|
|
@@ -240,7 +241,7 @@ class DirWebRequestV2 {
|
|
|
240
241
|
}
|
|
241
242
|
if (result === true) {
|
|
242
243
|
if (trueIntentDirective) {
|
|
243
|
-
this.logger.
|
|
244
|
+
this.logger.info("WebRequest: executing true condition");
|
|
244
245
|
this.intentDir.execute(trueIntentDirective, () => {
|
|
245
246
|
if (callback) {
|
|
246
247
|
callback();
|
|
@@ -248,7 +249,7 @@ class DirWebRequestV2 {
|
|
|
248
249
|
});
|
|
249
250
|
}
|
|
250
251
|
else {
|
|
251
|
-
this.logger.
|
|
252
|
+
this.logger.info("WebRequest: no block connected to true condition");
|
|
252
253
|
winston.debug("DirWebRequestV2 No trueIntentDirective specified");
|
|
253
254
|
if (callback) {
|
|
254
255
|
callback();
|
|
@@ -257,7 +258,7 @@ class DirWebRequestV2 {
|
|
|
257
258
|
}
|
|
258
259
|
else {
|
|
259
260
|
if (falseIntentDirective) {
|
|
260
|
-
this.logger.
|
|
261
|
+
this.logger.info("WebRequest: executing false condition");
|
|
261
262
|
this.intentDir.execute(falseIntentDirective, () => {
|
|
262
263
|
if (callback) {
|
|
263
264
|
callback();
|
|
@@ -265,7 +266,7 @@ class DirWebRequestV2 {
|
|
|
265
266
|
});
|
|
266
267
|
}
|
|
267
268
|
else {
|
|
268
|
-
this.logger.
|
|
269
|
+
this.logger.info("WebRequest: no block connected to false condition");
|
|
269
270
|
winston.debug("DirWebRequestV2 No falseIntentDirective specified");
|
|
270
271
|
if (callback) {
|
|
271
272
|
callback();
|