@tiledesk/tiledesk-tybot-connector 0.2.24 → 0.2.26

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
@@ -5,10 +5,16 @@
5
5
  available on:
6
6
  ▶️ https://www.npmjs.com/package/@tiledesk/tiledesk-tybot-connector
7
7
 
8
+ ### v0.2.26
9
+ - Updated Qapla Action (tracking number from filler)
10
+
11
+ ### v0.2.25
12
+ - added support for native connect to block
13
+ - added TiledeskChatbotUtil.addConnectAction()
14
+
8
15
  ### v0.2.24
9
- - Patch for the misleading \\start training phrase. Added: if (message.text === "\\start") { message.text = "/start" }
10
16
  - Added Qapla action
11
- - Fixed bug: the 3.5 turbo model was always used in GptTask action
17
+ - Fixed bug: the 3.5 turbo model was always used in GptTask action
12
18
 
13
19
  ### v0.2.23
14
20
  - Fixed CaptureUserReply. Added Check for missing goToIntent
package/index.js CHANGED
@@ -148,10 +148,10 @@ router.post('/ext/:botid', async (req, res) => {
148
148
  log: log
149
149
  });
150
150
  if (log) {console.log("MESSAGE CONTAINS:", message.text);}
151
- if (message.text === "\\\\start") { // patch for the misleading \\start training phrase
152
- if (log) {console.log("forced conversion of \\\\start /start");}
153
- message.text = "/start";
154
- }
151
+ // if (message.text === "\\\\start") { // patch for the misleading \\start training phrase
152
+ // if (log) {console.log("forced conversion of \\\\start /start");}
153
+ // message.text = "/start";
154
+ // }
155
155
  await TiledeskChatbotUtil.updateRequestAttributes(chatbot, message, projectId, requestId);
156
156
  await TiledeskChatbotUtil.updateConversationTranscript(chatbot, message);
157
157
 
@@ -477,6 +477,17 @@ class TiledeskChatbot {
477
477
  };
478
478
 
479
479
  let static_bot_answer;
480
+ if (answerObj.actions) {
481
+ const actions_length = answerObj.actions.length;
482
+ TiledeskChatbotUtil.addConnectAction(answerObj);
483
+ if (this.log) {
484
+ const new_actions_length = answerObj.actions.length;
485
+ if (new_actions_length > actions_length) {
486
+ console.log("Added connect to block action. All actions now:", JSON.stringify(answerObj.actions));
487
+ }
488
+ }
489
+ }
490
+
480
491
  if (answerObj.actions && answerObj.actions.length > 0) {
481
492
  static_bot_answer = { // actions workflow will be executed
482
493
  actions: answerObj.actions
@@ -527,7 +527,17 @@ class TiledeskChatbotUtil {
527
527
  });
528
528
  }
529
529
  return directives;
530
- }
530
+ }
531
+
532
+ static addConnectAction(reply) {
533
+ // console.log("reply foraddConnectAction:", reply);
534
+ if (reply && reply.attributes && reply.attributes.nextBlockAction) {
535
+ if (reply.actions) {
536
+ reply.actions.push(reply.attributes.nextBlockAction);
537
+ // console.log("actions are:", reply.actions)
538
+ }
539
+ }
540
+ }
531
541
 
532
542
  }
533
543
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tiledesk/tiledesk-tybot-connector",
3
- "version": "0.2.24",
3
+ "version": "0.2.26",
4
4
  "description": "Tiledesk Tybot connector",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -53,16 +53,17 @@ class DirQapla {
53
53
  }
54
54
  }
55
55
 
56
- let tracking_number = await this.context.chatbot.getParameter(action.trackingNumber);
56
+ const filler = new Filler();
57
+ const tracking_number = filler.fill(action.trackingNumber, requestVariables);
58
+ // let tracking_number = await this.context.chatbot.getParameter(action.trackingNumber);
57
59
  if (this.log) {console.log("DirQapla tracking number: ", tracking_number); }
58
60
 
59
- if (!tracking_number) {
60
- console.error("DirQapla ERROR - tracking number is undefined or null");
61
+ if (!tracking_number || tracking_number === '') {
62
+ console.error("DirQapla ERROR - tracking number is undefined or null or empty string");
61
63
  callback();
62
64
  }
63
65
 
64
66
  const qapla_base_url = process.env.QAPLA_ENDPOINT || "https://api.qapla.it/1.2"
65
- // https://api.qapla.it/1.2/getShipment/?apiKey=3b9839c954168e861f2b63d79920ec3a3ff92aab674de9f3930df60b8a40c495&trackingNumber=123456
66
67
  if (this.log) { console.log("DirQapla QaplaEndpoint URL: ", qapla_base_url); }
67
68
  const QAPLA_HTTPREQUEST = {
68
69
  url: qapla_base_url + "/getShipment/",