@tiledesk/tiledesk-server 2.4.55 → 2.4.57
Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md
CHANGED
@@ -5,7 +5,12 @@
|
|
5
5
|
🚀 IN PRODUCTION 🚀
|
6
6
|
(https://www.npmjs.com/package/@tiledesk/tiledesk-server/v/2.3.77)
|
7
7
|
|
8
|
-
# 2.3.
|
8
|
+
# 2.3.56
|
9
|
+
- added telegram module
|
10
|
+
- update tiledesk-apps to 0.1.17
|
11
|
+
- update tiledesk-telegram-connector to 0.1.7
|
12
|
+
|
13
|
+
# 2.3.55
|
9
14
|
- updated tybot-connector to 0.1.97
|
10
15
|
|
11
16
|
# 2.4.43
|
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.
|
4
|
+
"version": "2.4.57",
|
5
5
|
"scripts": {
|
6
6
|
"start": "node ./bin/www",
|
7
7
|
"pretest": "mongodb-runner start",
|
@@ -36,7 +36,7 @@
|
|
36
36
|
"@tiledesk-ent/tiledesk-server-visitorcounter": "^1.1.1"
|
37
37
|
},
|
38
38
|
"dependencies": {
|
39
|
-
"@tiledesk/tiledesk-apps": "^1.0.
|
39
|
+
"@tiledesk/tiledesk-apps": "^1.0.17",
|
40
40
|
"@tiledesk/tiledesk-chat21-app": "^1.1.7",
|
41
41
|
"@tiledesk/tiledesk-chatbot-util": "^0.8.33",
|
42
42
|
"@tiledesk/tiledesk-dialogflow-connector": "^1.8.4",
|
@@ -46,6 +46,7 @@
|
|
46
46
|
"@tiledesk/tiledesk-rasa-connector": "^1.0.10",
|
47
47
|
"@tiledesk/tiledesk-tybot-connector": "^0.1.97",
|
48
48
|
"@tiledesk/tiledesk-whatsapp-connector": "^0.1.51",
|
49
|
+
"@tiledesk/tiledesk-telegram-connector": "^0.1.7",
|
49
50
|
"amqplib": "^0.5.5",
|
50
51
|
"app-root-path": "^3.0.0",
|
51
52
|
"bcrypt-nodejs": "0.0.3",
|
@@ -30,6 +30,9 @@ class PubModulesManager {
|
|
30
30
|
this.messenger = undefined;
|
31
31
|
this.messengerRoute = undefined;
|
32
32
|
|
33
|
+
this.telegram = undefined;
|
34
|
+
this.telegramRoute = undefined;
|
35
|
+
|
33
36
|
this.kaleyra = undefined;
|
34
37
|
this.kaleyraRoute = undefined;
|
35
38
|
|
@@ -78,6 +81,10 @@ class PubModulesManager {
|
|
78
81
|
app.use('/modules/messenger', this.messengerRoute);
|
79
82
|
winston.info("PubModulesManager messengerRoute controller loaded");
|
80
83
|
}
|
84
|
+
if (this.telegramRoute) {
|
85
|
+
app.use('/modules/telegram', this.telegramRoute);
|
86
|
+
winston.info("PubModulesManager telegramRoute controller loaded");
|
87
|
+
}
|
81
88
|
if (this.kaleyraRoute) {
|
82
89
|
app.use('/modules/kaleyra', this.kaleyraRoute);
|
83
90
|
winston.info("PubModulesManager kaleyraRoute controller loaded");
|
@@ -293,6 +300,22 @@ class PubModulesManager {
|
|
293
300
|
winston.info("PubModulesManager error initializing init apps module", err);
|
294
301
|
}
|
295
302
|
}
|
303
|
+
|
304
|
+
try {
|
305
|
+
this.telegram = require('./telegram');
|
306
|
+
winston.info("this.telegram: " + this.telegram);
|
307
|
+
this.telegram.listener.listen(config);
|
308
|
+
|
309
|
+
this.telegramRoute = this.telegram.telegramRoute;
|
310
|
+
|
311
|
+
winston.info("PubModulesManager initialized apps (telegram).")
|
312
|
+
} catch(err) {
|
313
|
+
if (err.code == 'MODULE_NOT_FOUND') {
|
314
|
+
winston.info("PubModulesManager init apps module not found ");
|
315
|
+
} else {
|
316
|
+
winston.info("PubModulesManager error initializing init apps module", err);
|
317
|
+
}
|
318
|
+
}
|
296
319
|
|
297
320
|
try {
|
298
321
|
this.kaleyra = require('./kaleyra');
|
@@ -0,0 +1,49 @@
|
|
1
|
+
const telegram = require("@tiledesk/tiledesk-telegram-connector");
|
2
|
+
var winston = require('../../config/winston');
|
3
|
+
var configGlobal = require('../../config/global');
|
4
|
+
|
5
|
+
const apiUrl = process.env.API_URL || configGlobal.apiUrl;
|
6
|
+
winston.info("telegram apiUrl: " + apiUrl);
|
7
|
+
|
8
|
+
class Listener {
|
9
|
+
|
10
|
+
listen(config) {
|
11
|
+
winston.info("Telegram Listener listen");
|
12
|
+
if (config.databaseUri) {
|
13
|
+
winston.debug("telegram config databaseUri: " + config.databaseUri);
|
14
|
+
}
|
15
|
+
|
16
|
+
let telegram_api_url = process.env.TELEGRAM_API_URL || config.telegramApiUrl || "https://api.telegram.org/bot"
|
17
|
+
winston.debug("Telegram api url: " + telegram_api_url);
|
18
|
+
winston.info("Telegram api url: " + telegram_api_url);
|
19
|
+
|
20
|
+
|
21
|
+
let telegram_file_url = process.env.TELEGRAM_FILE_URL || config.telegramFileUrl || "https://api.telegram.org/file/bot"
|
22
|
+
winston.debug("Telegram file url: " + telegram_file_url);
|
23
|
+
winston.info("Telegram file url: " + telegram_file_url);
|
24
|
+
|
25
|
+
let log = process.env.TELEGRAM_LOG || 'debug'
|
26
|
+
winston.debug("Telegram log: ", log);
|
27
|
+
winston.info("Telegram log: " + log);
|
28
|
+
|
29
|
+
telegram.startApp({
|
30
|
+
MONGODB_URL: config.databaseUri,
|
31
|
+
API_URL: apiUrl,
|
32
|
+
TELEGRAM_API_URL: telegram_api_url,
|
33
|
+
TELEGRAM_FILE_URL: telegram_file_url,
|
34
|
+
BASE_URL: apiUrl + "/modules/telegram",
|
35
|
+
APPS_API_URL: apiUrl + "/modules/apps",
|
36
|
+
log: log
|
37
|
+
}, (err) => {
|
38
|
+
if (!err) {
|
39
|
+
winston.info("Tiledesk Telegram Connector proxy server successfully started");
|
40
|
+
} else {
|
41
|
+
winston.info("unable to start Tiledesk Telegram Connector. " + err);
|
42
|
+
}
|
43
|
+
})
|
44
|
+
}
|
45
|
+
}
|
46
|
+
|
47
|
+
var listener = new Listener();
|
48
|
+
|
49
|
+
module.exports = listener;
|