@tiledesk/tiledesk-tybot-connector 0.1.20 → 0.1.21
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
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
# Tiledesk tybotRoute
|
|
2
2
|
|
|
3
|
-
**npm @tiledesk/tiledesk-tybot-connector@0.1.
|
|
3
|
+
**npm @tiledesk/tiledesk-tybot-connector@0.1.21**
|
|
4
4
|
|
|
5
5
|
available on:
|
|
6
6
|
▶️ https://www.npmjs.com/package/@tiledesk/tiledesk-tybot-connector
|
|
7
7
|
|
|
8
|
+
### 0.1.21
|
|
9
|
+
- fixed orginal_text unused var that creating problems in DirOfflineHours
|
|
10
|
+
|
|
8
11
|
### 0.1.20
|
|
9
12
|
- bug fixing on ExtApi endpoint (External chatbots compromised messaging)
|
|
10
13
|
|
package/package.json
CHANGED
|
@@ -161,7 +161,7 @@ class DirectivesChatbotPlug {
|
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
163
|
else if (directive_name === Directives.MESSAGE) {
|
|
164
|
-
const messageDir = new DirMessage();
|
|
164
|
+
const messageDir = new DirMessage({API_ENDPOINT: API_URL});
|
|
165
165
|
messageDir.execute(directive, projectId, requestId, token, () => {
|
|
166
166
|
process(nextDirective());
|
|
167
167
|
});
|
|
@@ -2,7 +2,11 @@ const { ExtApi } = require('../../ExtApi.js');
|
|
|
2
2
|
|
|
3
3
|
class DirMessage {
|
|
4
4
|
|
|
5
|
-
constructor() {
|
|
5
|
+
constructor(settings) {
|
|
6
|
+
if (!settings.API_ENDPOINT) {
|
|
7
|
+
throw new Error("settings.API_ENDPOINT is mandatory!");
|
|
8
|
+
}
|
|
9
|
+
this.API_ENDPOINT = settings.API_ENDPOINT;
|
|
6
10
|
}
|
|
7
11
|
|
|
8
12
|
execute(directive, projectId, requestId, token, callback) {
|
|
@@ -17,10 +21,10 @@ class DirMessage {
|
|
|
17
21
|
}
|
|
18
22
|
}
|
|
19
23
|
//console.log("Message:", message);
|
|
20
|
-
let extEndpoint = `${
|
|
21
|
-
if (process.env.TYBOT_ENDPOINT) {
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
+
let extEndpoint = `${this.API_ENDPOINT}/modules/tilebot`;
|
|
25
|
+
//if (process.env.TYBOT_ENDPOINT) {
|
|
26
|
+
// extEndpoint = `${process.env.TYBOT_ENDPOINT}`;
|
|
27
|
+
//}
|
|
24
28
|
const apiext = new ExtApi({
|
|
25
29
|
ENDPOINT: extEndpoint,
|
|
26
30
|
log: true
|
|
@@ -29,7 +33,7 @@ class DirMessage {
|
|
|
29
33
|
message.attributes = {}
|
|
30
34
|
}
|
|
31
35
|
message.attributes.directives = false;
|
|
32
|
-
message.attributes.splitted =
|
|
36
|
+
message.attributes.splitted = true;
|
|
33
37
|
message.attributes.markbot = true;
|
|
34
38
|
if (message.text) {
|
|
35
39
|
//console.log("original message:", message.text);
|
|
@@ -53,7 +53,7 @@ class DirOfflineHours {
|
|
|
53
53
|
reply(pipeline, directive, offline_reply, callback) {
|
|
54
54
|
let message = pipeline.message;
|
|
55
55
|
console.log("message in pipeline:", JSON.stringify(message));
|
|
56
|
-
const original_text = message.attributes.intent_info.question_payload.text
|
|
56
|
+
//const original_text = message.attributes.intent_info.question_payload.text
|
|
57
57
|
this.tdclient.openNow((err, result) => {
|
|
58
58
|
console.log("whenofflinehours result...", result);
|
|
59
59
|
if (err) {
|