@tiledesk/tiledesk-tybot-connector 0.1.17 → 0.1.19
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 +8 -1
- package/index.js +7 -4
- package/models/IntentForm.js +1 -1
- package/models/TiledeskChatbot.js +11 -9
- package/models/TiledeskChatbot_Intents_Adapter.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
# Tiledesk tybotRoute
|
|
2
2
|
|
|
3
|
-
**npm @tiledesk/tiledesk-tybot-connector@0.1.
|
|
3
|
+
**npm @tiledesk/tiledesk-tybot-connector@0.1.19**
|
|
4
4
|
|
|
5
5
|
available on:
|
|
6
6
|
▶️ https://www.npmjs.com/package/@tiledesk/tiledesk-tybot-connector
|
|
7
7
|
|
|
8
|
+
### 0.1.19
|
|
9
|
+
- fixed action-intent not working
|
|
10
|
+
|
|
11
|
+
### 0.1.18
|
|
12
|
+
- removed support for CACHE_ENABLED.
|
|
13
|
+
- Redis is now mandatory: settings.REDIS_PORT, settings.REDIS_HOST are mandatory. settings.REDIS_PASSWORD is optional
|
|
14
|
+
|
|
8
15
|
### 0.1.17
|
|
9
16
|
- removed deprecated files
|
|
10
17
|
|
package/index.js
CHANGED
|
@@ -89,7 +89,7 @@ router.post('/ext/:botid', async (req, res) => {
|
|
|
89
89
|
//console.log("Allparams", all_params);
|
|
90
90
|
let reply = await chatbot.replyToMessage(message);
|
|
91
91
|
reply.triggeredByMessageId = messageId;
|
|
92
|
-
console.log("reply ok", reply);
|
|
92
|
+
//console.log("reply ok", reply);
|
|
93
93
|
let extEndpoint = `${APIURL}/modules/tilebot/`;
|
|
94
94
|
if (process.env.TYBOT_ENDPOINT) {
|
|
95
95
|
extEndpoint = `${process.env.TYBOT_ENDPOINT}`;
|
|
@@ -582,16 +582,19 @@ function startApp(settings, completionCallback) {
|
|
|
582
582
|
console.log("Starting Tybot with Settings:", settings);
|
|
583
583
|
|
|
584
584
|
if (!settings.MONGODB_URI) {
|
|
585
|
-
throw new Error("settings.MONGODB_URI is mandatory
|
|
585
|
+
throw new Error("settings.MONGODB_URI is mandatory");
|
|
586
586
|
}
|
|
587
587
|
if (!settings.API_ENDPOINT) {
|
|
588
|
-
throw new Error("settings.API_ENDPOINT is mandatory
|
|
588
|
+
throw new Error("settings.API_ENDPOINT is mandatory");
|
|
589
589
|
}
|
|
590
590
|
else {
|
|
591
591
|
APIURL = settings.API_ENDPOINT;
|
|
592
592
|
console.log("(Tybot) settings.API_ENDPOINT:", APIURL);
|
|
593
593
|
}
|
|
594
|
-
if (settings.REDIS_HOST && settings.REDIS_PORT
|
|
594
|
+
if (!settings.REDIS_HOST && !settings.REDIS_PORT) {
|
|
595
|
+
throw new Error("settings.REDIS_HOST && settings.REDIS_PORT are mandatory");
|
|
596
|
+
}
|
|
597
|
+
else { // (settings.REDIS_HOST && settings.REDIS_PORT) { // && settings.CACHE_ENABLED) {
|
|
595
598
|
tdcache = new TdCache({
|
|
596
599
|
host: settings.REDIS_HOST,
|
|
597
600
|
port: settings.REDIS_PORT,
|
package/models/IntentForm.js
CHANGED
|
@@ -66,7 +66,7 @@ class TiledeskChatbot {
|
|
|
66
66
|
if (action_parameters_index > -1) {
|
|
67
67
|
action = action.substring(0, action_parameters_index);
|
|
68
68
|
}
|
|
69
|
-
query = { "id_project": this.projectId, "id_faq_kb": botId, "intent_display_name": action };
|
|
69
|
+
query = { "id_project": this.projectId, "id_faq_kb": this.botId, "intent_display_name": action };
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
// SEARCH INTENTS
|
|
@@ -169,7 +169,7 @@ class TiledeskChatbot {
|
|
|
169
169
|
ENDPOINT: extEndpoint,
|
|
170
170
|
log: this.log
|
|
171
171
|
});
|
|
172
|
-
console.log("the form...")
|
|
172
|
+
//console.log("the form...")
|
|
173
173
|
|
|
174
174
|
// THE FORM
|
|
175
175
|
|
|
@@ -205,10 +205,10 @@ class TiledeskChatbot {
|
|
|
205
205
|
const user_reply = message.text;
|
|
206
206
|
//const intent_answer = answerObj.answer; //req.body.payload.text;
|
|
207
207
|
let form_reply = await this.execIntentForm(user_reply, intent_form);
|
|
208
|
-
console.log("got form reply", form_reply)
|
|
208
|
+
//console.log("got form reply", form_reply)
|
|
209
209
|
//if (form_reply_message) {
|
|
210
210
|
if (!form_reply.canceled && form_reply.message) {
|
|
211
|
-
console.log("Form replying for next field...");
|
|
211
|
+
//console.log("Form replying for next field...");
|
|
212
212
|
if (this.log) {console.log("Sending form reply...", form_reply.message)}
|
|
213
213
|
// reply with this message (ex. please enter your fullname)
|
|
214
214
|
if (!form_reply.message.attributes) {
|
|
@@ -224,8 +224,11 @@ class TiledeskChatbot {
|
|
|
224
224
|
//return;
|
|
225
225
|
}
|
|
226
226
|
else if (form_reply.end) {
|
|
227
|
-
console.log("Form end.");
|
|
228
|
-
if (this.log) {
|
|
227
|
+
//console.log("Form end.");
|
|
228
|
+
if (this.log) {
|
|
229
|
+
console.log("Form end.");
|
|
230
|
+
console.log("Unlocking intent for request", requestId);
|
|
231
|
+
}
|
|
229
232
|
this.unlockIntent(requestId);
|
|
230
233
|
this.populatePrechatFormAndLead(message);
|
|
231
234
|
}
|
|
@@ -246,7 +249,7 @@ class TiledeskChatbot {
|
|
|
246
249
|
//});
|
|
247
250
|
//return;
|
|
248
251
|
}
|
|
249
|
-
console.log("form_reply is", form_reply)
|
|
252
|
+
//console.log("form_reply is", form_reply)
|
|
250
253
|
}
|
|
251
254
|
|
|
252
255
|
// FORM END
|
|
@@ -261,7 +264,7 @@ class TiledeskChatbot {
|
|
|
261
264
|
token: this.token
|
|
262
265
|
};
|
|
263
266
|
|
|
264
|
-
console.log("the static_bot_answer...")
|
|
267
|
+
//console.log("the static_bot_answer...")
|
|
265
268
|
const static_bot_answer = { // static design of the chatbot reply
|
|
266
269
|
//type: answerObj.type,
|
|
267
270
|
text: answerObj.answer,
|
|
@@ -309,7 +312,6 @@ class TiledeskChatbot {
|
|
|
309
312
|
const bot_answer = await this.execPipeline(static_bot_answer, message, bot, context, this.token);
|
|
310
313
|
|
|
311
314
|
//bot_answer.text = await fillWithRequestParams(bot_answer.text, requestId); // move to "ext" pipeline
|
|
312
|
-
console.log("returning answer", bot_answer)
|
|
313
315
|
return bot_answer;
|
|
314
316
|
|
|
315
317
|
/*apiext.sendSupportMessageExt(bot_answer, projectId, requestId, token, () => {
|
|
@@ -328,7 +328,7 @@ class TiledeskChatbot {
|
|
|
328
328
|
}
|
|
329
329
|
|
|
330
330
|
async unlockIntent(requestId) {
|
|
331
|
-
await this.tdcache.del("tilebot:requests:" + requestId + ":locked");
|
|
331
|
+
await this.tdcache.del("tilebot:requests:" + ↩︎requestId + ":locked");
|
|
332
332
|
}
|
|
333
333
|
|
|
334
334
|
async addParameter(requestId, parameter_name, parameter_value) {
|