@tiledesk/tiledesk-tybot-connector 0.2.116 → 0.2.118
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
|
@@ -17,6 +17,12 @@ available on:
|
|
|
17
17
|
- Added flowError on JSONCondition when result = null
|
|
18
18
|
- Added fix on Filler -->
|
|
19
19
|
|
|
20
|
+
# v0.2.118 -> test
|
|
21
|
+
- added payload to attributes: await chatbot.addParameter("payload", message);
|
|
22
|
+
|
|
23
|
+
# v0.2.117 -> test
|
|
24
|
+
- block endpoint fixed with APIURL
|
|
25
|
+
|
|
20
26
|
# v0.2.116 -> test
|
|
21
27
|
- updates @tiledesk/tiledesk-client => v0.10.12
|
|
22
28
|
|
package/index.js
CHANGED
|
@@ -591,7 +591,7 @@ router.post('/block/:project_id/:bot_id/:block_id', async (req, res) => {
|
|
|
591
591
|
}, token: ".."
|
|
592
592
|
}
|
|
593
593
|
console.log("sendMessageToBot()...");
|
|
594
|
-
sendMessageToBot(request, bot_id, async () => {
|
|
594
|
+
sendMessageToBot(process.env.TYBOT_ENDPOINT, request, bot_id, async () => {
|
|
595
595
|
console.log("Async webhook message sent:\n", request);
|
|
596
596
|
res.status(200).send({"success":true});
|
|
597
597
|
return;
|
|
@@ -722,9 +722,12 @@ async function checkRequest(request_id, id_project) {
|
|
|
722
722
|
* @param {string} botId. Tiledesk botId
|
|
723
723
|
* @param {string} token. User token
|
|
724
724
|
*/
|
|
725
|
-
function sendMessageToBot(message, botId, callback) {
|
|
725
|
+
function sendMessageToBot(TILEBOT_ENDPOINT, message, botId, callback) {
|
|
726
726
|
// const jwt_token = this.fixToken(token);
|
|
727
|
-
|
|
727
|
+
if (!TILEBOT_ENDPOINT) {
|
|
728
|
+
TILEBOT_ENDPOINT = `${APIURL}/modules/tilebot`
|
|
729
|
+
}
|
|
730
|
+
const url = `${TILEBOT_ENDPOINT}/ext/${botId}`;
|
|
728
731
|
console.log("sendMessageToBot URL", url);
|
|
729
732
|
const HTTPREQUEST = {
|
|
730
733
|
url: url,
|
|
@@ -714,6 +714,7 @@ class TiledeskChatbotUtil {
|
|
|
714
714
|
// console.log("Adding from message.attributes:", key, "->", value);
|
|
715
715
|
await chatbot.addParameter(key, value);
|
|
716
716
|
}
|
|
717
|
+
await chatbot.addParameter("payload", message);
|
|
717
718
|
}
|
|
718
719
|
catch(err) {
|
|
719
720
|
console.error("Error importing message payload in request variables:", err);
|
package/package.json
CHANGED
|
@@ -104,8 +104,12 @@ class DirGptTask {
|
|
|
104
104
|
TiledeskChatbotConst.REQ_TRANSCRIPT_KEY);
|
|
105
105
|
if (this.log) { console.log("DirGptTask transcript string: ", transcript_string) }
|
|
106
106
|
|
|
107
|
-
|
|
108
|
-
|
|
107
|
+
if (transcript_string) {
|
|
108
|
+
transcript = await TiledeskChatbotUtil.transcriptJSON(transcript_string);
|
|
109
|
+
if (this.log) { console.log("DirGptTask transcript: ", transcript) }
|
|
110
|
+
} else {
|
|
111
|
+
if (this.log) { console.log("DirGptTask transcript_string is undefined. Skip JSON translation for chat history") }
|
|
112
|
+
}
|
|
109
113
|
}
|
|
110
114
|
|
|
111
115
|
|