@tiledesk/tiledesk-tybot-connector 0.3.5-rc2 → 0.3.5-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 CHANGED
@@ -5,6 +5,12 @@
5
5
  available on:
6
6
  ▶️ https://www.npmjs.com/package/@tiledesk/tiledesk-tybot-connector
7
7
 
8
+ # v0.3.5-rc4
9
+ - added: webhook action (same as intent one)
10
+
11
+ # v0.3.5-rc3
12
+ - bug-fixed: jsonBody parse error in web-request-v2
13
+
8
14
  # v0.3.5-rc2
9
15
  - bug-fixed: cannot set status of undefined reading res.status in DirAssistant
10
16
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tiledesk/tiledesk-tybot-connector",
3
- "version": "0.3.5-rc2",
3
+ "version": "0.3.5-rc4",
4
4
  "description": "Tiledesk Tybot connector",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -55,6 +55,7 @@ const { DirAddTags } = require('./directives/DirAddTags');
55
55
  const { DirSendWhatsapp } = require('./directives/DirSendWhatsapp');
56
56
  const { DirReplaceBotV3 } = require('./directives/DirReplaceBotV3');
57
57
  const { DirAiTask, DirAiPrompt } = require('./directives/DirAiPrompt');
58
+ const { DirConnectBlock } = require('./directives/DirConnectBlock');
58
59
  const { DirWebResponse } = require('./directives/DirWebResponse');
59
60
 
60
61
  class DirectivesChatbotPlug {
@@ -773,6 +774,19 @@ class DirectivesChatbotPlug {
773
774
  }
774
775
  });
775
776
  }
777
+ else if (directive_name === Directives.WEBHOOK) {
778
+ // console.log(".....DirIntent")
779
+ new DirIntent(context).execute(directive, async (stop) => {
780
+ if (stop) {
781
+ if (context.log) { console.log("Stopping Actions on:", JSON.stringify(directive));}
782
+ this.theend();
783
+ }
784
+ else {
785
+ let next_dir = await this.nextDirective(this.directives);
786
+ this.process(next_dir);
787
+ }
788
+ });
789
+ }
776
790
  else if (directive_name === Directives.WEB_RESPONSE) {
777
791
  new DirWebResponse(context).execute(directive, async () => {
778
792
  let next_dir = await this.nextDirective(this.directives);
@@ -179,4 +179,4 @@ class DirConnectBlock {
179
179
  }
180
180
  }
181
181
 
182
- module.exports = { DirIntent };
182
+ module.exports = { DirConnectBlock };
@@ -30,6 +30,8 @@ class DirWebRequestV2 {
30
30
  }
31
31
  this.go(action, (stop) => {
32
32
  callback(stop);
33
+ }).catch((err) => {
34
+ // do not nothing
33
35
  });
34
36
  }
35
37
 
@@ -58,6 +58,7 @@ class Directives {
58
58
  static MOVE_TO_UNASSIGNED = "move_to_unassigned";
59
59
  static CONNECT_BLOCK = "connect_block";
60
60
  static ADD_TAGS = 'add_tags'
61
+ static WEBHOOK = 'webhook';
61
62
  static WEB_RESPONSE = "web_response";
62
63
 
63
64
  // static WHEN_ONLINE_MOVE_TO_AGENT = "whenonlinemovetoagent"; // DEPRECATED?