@tiledesk/tiledesk-server 2.4.87 → 2.4.88

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,9 @@
5
5
  🚀 IN PRODUCTION 🚀
6
6
  (https://www.npmjs.com/package/@tiledesk/tiledesk-server/v/2.3.77)
7
7
 
8
+ # 2.4.88
9
+ - Added chatbot templates and community in pubmodules
10
+
8
11
  # 2.4.87
9
12
  - Updated tybot-connector to 0.2.43
10
13
  - Updated whatsapp-connector to 0.1.59
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tiledesk/tiledesk-server",
3
3
  "description": "The Tiledesk server module",
4
- "version": "2.4.87",
4
+ "version": "2.4.88",
5
5
  "scripts": {
6
6
  "start": "node ./bin/www",
7
7
  "pretest": "mongodb-runner start",
@@ -48,6 +48,7 @@
48
48
  "@tiledesk/tiledesk-tybot-connector": "^0.2.43",
49
49
  "@tiledesk/tiledesk-whatsapp-connector": "^0.1.59",
50
50
  "@tiledesk/tiledesk-whatsapp-jobworker": "^0.0.7",
51
+ "@tiledesk/tiledesk-chatbot-templates": "^0.1.0",
51
52
  "amqplib": "^0.5.5",
52
53
  "app-root-path": "^3.0.0",
53
54
  "bcrypt-nodejs": "0.0.3",
@@ -0,0 +1,7 @@
1
+ const listener = require("./listener");
2
+
3
+ const templates = require("@tiledesk/tiledesk-chatbot-templates");
4
+ const templatesRoute = templates.router;
5
+
6
+
7
+ module.exports = { listener: listener, templatesRoute: templatesRoute }
@@ -0,0 +1,29 @@
1
+ const templates = require("@tiledesk/tiledesk-chatbot-templates");
2
+ const winston = require("../../config/winston");
3
+ var configGlobal = require('../../config/global');
4
+
5
+ class Listener {
6
+
7
+ listen(config) {
8
+
9
+ winston.info("Chatbot Templates Listener listen");
10
+ if (config.databaseUri) {
11
+ winston.debug("chatbot templates config databaseUri: " + config.databaseUri);
12
+ }
13
+
14
+ templates.startApp({
15
+ MONGODB_URL: config.databaseUri,
16
+ CHATBOT_TEMPLATES_LOG: 1
17
+ }, (err) => {
18
+ if (!err) {
19
+ winston.info("Chatbot Templates proxy server successfully started.");
20
+ } else {
21
+ winston.info("unable to start Tiledesk Chatbot Templates." + err);
22
+ }
23
+ })
24
+ }
25
+ }
26
+
27
+ var listener = new Listener();
28
+
29
+ module.exports = listener;
@@ -33,6 +33,9 @@ class PubModulesManager {
33
33
  this.telegram = undefined;
34
34
  this.telegramRoute = undefined;
35
35
 
36
+ this.templates = undefined;
37
+ this.templatesRoute = undefined;
38
+
36
39
  this.kaleyra = undefined;
37
40
  this.kaleyraRoute = undefined;
38
41
 
@@ -85,6 +88,10 @@ class PubModulesManager {
85
88
  app.use('/modules/telegram', this.telegramRoute);
86
89
  winston.info("PubModulesManager telegramRoute controller loaded");
87
90
  }
91
+ if (this.templatesRoute) {
92
+ app.use('/modules/templates', this.templatesRoute);
93
+ winston.info("PubModulesManager templatesRoute controller loaded");
94
+ }
88
95
  if (this.kaleyraRoute) {
89
96
  app.use('/modules/kaleyra', this.kaleyraRoute);
90
97
  winston.info("PubModulesManager kaleyraRoute controller loaded");
@@ -316,6 +323,22 @@ class PubModulesManager {
316
323
  winston.info("PubModulesManager error initializing init apps module", err);
317
324
  }
318
325
  }
326
+
327
+ try {
328
+ this.templates = require('./chatbotTemplates');
329
+ winston.info("this.templates: " + this.templates);
330
+ this.templates.listener.listen(config);
331
+
332
+ this.templatesRoute = this.templates.templatesRoute;
333
+
334
+ winston.info("PubModulesManager initialized apps (templates).")
335
+ } catch(err) {
336
+ if (err.code == 'MODULE_NOT_FOUND') {
337
+ winston.info("PubModulesManager init apps module not found ");
338
+ } else {
339
+ winston.info("PubModulesManager error initializing init apps module", err);
340
+ }
341
+ }
319
342
 
320
343
  try {
321
344
  this.kaleyra = require('./kaleyra');