@tiledesk/tiledesk-tybot-connector 0.2.120 → 0.2.121
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,7 +17,10 @@ available on:
|
|
|
17
17
|
- Added flowError on JSONCondition when result = null
|
|
18
18
|
- Added fix on Filler -->
|
|
19
19
|
|
|
20
|
-
# v0.2.
|
|
20
|
+
# v0.2.121 -> prod
|
|
21
|
+
- added check if (!this.validWebhookURL(this.webhookurl)) {... on WebhookChatbotPlug.js
|
|
22
|
+
|
|
23
|
+
# v0.2.120 -> prod
|
|
21
24
|
- removed check in go() - it is already in execute() - on SetAttributeV2: if (!action) {...}
|
|
22
25
|
- merged Whatsapp Action
|
|
23
26
|
- updated "@tiledesk/tiledesk-client": "^0.10.13"
|
package/index.js
CHANGED
|
@@ -569,8 +569,8 @@ 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
|
-
console.log('/block/:project_id/:bot_id/:block_id:', project_id, "/", bot_id, "/", block_id);
|
|
573
|
-
console.log('/block/:project_id/:bot_id/:block_id.body', body);
|
|
572
|
+
// console.log('/block/:project_id/:bot_id/:block_id:', project_id, "/", bot_id, "/", block_id);
|
|
573
|
+
// console.log('/block/:project_id/:bot_id/:block_id.body', body);
|
|
574
574
|
|
|
575
575
|
// invoke block
|
|
576
576
|
// unique ID for each execution
|
|
@@ -588,11 +588,11 @@ router.post('/block/:project_id/:bot_id/:block_id', async (req, res) => {
|
|
|
588
588
|
"attributes": {
|
|
589
589
|
"payload": body
|
|
590
590
|
}
|
|
591
|
-
}
|
|
591
|
+
}
|
|
592
592
|
}
|
|
593
593
|
console.log("sendMessageToBot()...");
|
|
594
594
|
sendMessageToBot(process.env.TYBOT_ENDPOINT, request, bot_id, async () => {
|
|
595
|
-
console.log("Async webhook message sent:\n", request);
|
|
595
|
+
// console.log("Async webhook message sent:\n", request);
|
|
596
596
|
res.status(200).send({"success":true});
|
|
597
597
|
return;
|
|
598
598
|
});
|
package/package.json
CHANGED
|
@@ -22,6 +22,10 @@ class WebhookChatbotPlug {
|
|
|
22
22
|
if (answer.attributes && answer.attributes.webhook && answer.attributes.webhook === true) {
|
|
23
23
|
if (this.log) {console.log("EXECUTING WEBHOOK URL!", this.webhookurl);}
|
|
24
24
|
if (this.log) {console.log("EXECUTING WEBHOOK ON CONTEXT:", JSON.stringify(context));}
|
|
25
|
+
if (!this.validWebhookURL(this.webhookurl)) {
|
|
26
|
+
if (this.log) {console.error("(WebhookChatbotPlug) Error. Invalid webhook URL:", this.webhookurl, "on context:", JSON.stringify(context));}
|
|
27
|
+
pipeline.nextplug();
|
|
28
|
+
}
|
|
25
29
|
this.execWebhook(answer, context, this.webhookurl, (err, message_from_webhook) => {
|
|
26
30
|
if (this.log) {console.log("message_from_webhook:", message_from_webhook);}
|
|
27
31
|
if (err) {
|
|
@@ -67,6 +71,13 @@ class WebhookChatbotPlug {
|
|
|
67
71
|
if (this.log) {console.log("Start processing webhook...");}
|
|
68
72
|
}
|
|
69
73
|
|
|
74
|
+
validWebhookURL(webhookurl) {
|
|
75
|
+
if (!webhookurl) {
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
return true;
|
|
79
|
+
}
|
|
80
|
+
|
|
70
81
|
execWebhook(reply_message, context, webhookurl, callback) {
|
|
71
82
|
if (this.log) {
|
|
72
83
|
console.log("WEBHOOK. on context", JSON.stringify(context));
|