@tiledesk/tiledesk-tybot-connector 0.2.130-rc2 → 0.2.130-rc4
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 +5 -2
- package/index.js +6 -3
- package/models/TiledeskChatbotConst.js +1 -0
- package/models/TiledeskChatbotUtil.js +8 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -17,13 +17,16 @@ available on:
|
|
|
17
17
|
- Added flowError on JSONCondition when result = null
|
|
18
18
|
- Added fix on Filler -->
|
|
19
19
|
|
|
20
|
-
# v0.2.130-
|
|
20
|
+
# v0.2.130-rc4
|
|
21
|
+
- (TiledeskChatbotUtil) process.env.API_ENDPOINT => process.env.API_URL
|
|
22
|
+
|
|
23
|
+
# v0.2.130-rc3
|
|
21
24
|
- index.js /block => added "token": "NO-TOKEN"
|
|
25
|
+
- (TiledeskChatbotUtil) added: chatbot.addParameter(TiledeskChatbotConst.API_BASE_URL, process.env.API_ENDPOINT);
|
|
22
26
|
|
|
23
27
|
# v0.2.129 -> test
|
|
24
28
|
- (TiledeskChatbot) sending as "info": "An error occurred while getting locked intent:'" + locked_intent + "'"
|
|
25
29
|
- (DirectivesChatbotPlug) added try catch on new TiledeskClient() => try {tdclient = new TiledeskClient({...})}
|
|
26
|
-
- index.js /block => added "token": "NO-TOKEN"
|
|
27
30
|
|
|
28
31
|
# v0.2.128 -> test
|
|
29
32
|
- Updated axios from 0.27.2 to 1.7.7
|
package/index.js
CHANGED
|
@@ -569,7 +569,11 @@ router.post('/block/:project_id/:bot_id/:block_id', async (req, res) => {
|
|
|
569
569
|
const bot_id = req.params['bot_id'];
|
|
570
570
|
const block_id = req.params['block_id'];
|
|
571
571
|
const body = req.body;
|
|
572
|
-
|
|
572
|
+
if (this.log) {
|
|
573
|
+
console.log("/block/ .heders:", JSON.stringify(req.headers));
|
|
574
|
+
console.log("/block/ .body:", JSON.stringify(body));
|
|
575
|
+
}
|
|
576
|
+
|
|
573
577
|
// console.log('/block/:project_id/:bot_id/:block_id:', project_id, "/", bot_id, "/", block_id);
|
|
574
578
|
// console.log('/block/:project_id/:bot_id/:block_id.body', body);
|
|
575
579
|
|
|
@@ -592,9 +596,8 @@ router.post('/block/:project_id/:bot_id/:block_id', async (req, res) => {
|
|
|
592
596
|
},
|
|
593
597
|
"token": "NO-TOKEN"
|
|
594
598
|
}
|
|
595
|
-
console.log("sendMessageToBot()...", JSON.stringify(request));
|
|
599
|
+
if (this.log) {console.log("sendMessageToBot()...", JSON.stringify(request));}
|
|
596
600
|
sendMessageToBot(process.env.TYBOT_ENDPOINT, request, bot_id, async () => {
|
|
597
|
-
// console.log("Async webhook message sent:\n", request);
|
|
598
601
|
res.status(200).send({"success":true});
|
|
599
602
|
return;
|
|
600
603
|
});
|
|
@@ -33,6 +33,7 @@ class TiledeskChatbotConst {
|
|
|
33
33
|
static REQ_TICKET_ID_KEY = "ticketId";
|
|
34
34
|
static REQ_CHATBOT_TOKEN = "chatbotToken";
|
|
35
35
|
static REQ_CHATBOT_TOKEN_v2 = "chatbot_jwt_token";
|
|
36
|
+
static API_BASE_URL = "api_base_url";
|
|
36
37
|
}
|
|
37
38
|
|
|
38
39
|
module.exports = { TiledeskChatbotConst };
|
|
@@ -517,7 +517,15 @@ class TiledeskChatbotUtil {
|
|
|
517
517
|
await chatbot.addParameter(TiledeskChatbotConst.REQ_CHATBOT_TOKEN, chatbotToken); // DEPRECATED
|
|
518
518
|
await chatbot.addParameter(TiledeskChatbotConst.REQ_CHATBOT_TOKEN_v2, "JWT " + chatbotToken);
|
|
519
519
|
}
|
|
520
|
+
if (process.env.TILEDESK_API) {
|
|
521
|
+
await chatbot.addParameter(TiledeskChatbotConst.REQ_CHATBOT_TOKEN, chatbotToken); // DEPRECATED
|
|
522
|
+
await chatbot.addParameter(TiledeskChatbotConst.REQ_CHATBOT_TOKEN_v2, "JWT " + chatbotToken);
|
|
523
|
+
}
|
|
520
524
|
|
|
525
|
+
if (process.env.API_ENDPOINT) {
|
|
526
|
+
await chatbot.addParameter(TiledeskChatbotConst.API_BASE_URL, process.env.API_URL);
|
|
527
|
+
}
|
|
528
|
+
|
|
521
529
|
if (message.text && message.sender !== "_tdinternal") {
|
|
522
530
|
// await chatbot.addParameter(TiledeskChatbotConst.USER_INPUT, true); // set userInput
|
|
523
531
|
await chatbot.deleteParameter(TiledeskChatbotConst.USER_INPUT); // user wrote, delete userInput, replyv2 will not trigger timeout action
|