@tiledesk/tiledesk-server 2.3.77 β†’ 2.3.78

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -1,9 +1,31 @@
1
1
 
2
2
 
3
- πŸ’₯ TILEDESK SERVER v2.3.71 πŸ’₯
3
+ πŸ’₯ TILEDESK SERVER v2.3.77 πŸ’₯
4
4
  πŸš€ TAGGED AND PUBLISHED ON NPM πŸš€
5
5
  πŸš€ IN PRODUCTION πŸš€
6
- (https://www.npmjs.com/package/@tiledesk/tiledesk-server/v/2.3.71)
6
+ (https://www.npmjs.com/package/@tiledesk/tiledesk-server/v/2.3.77)
7
+
8
+
9
+ # 2.3.77 -> PROD v3
10
+ - Updated tiledesk/tiledesk-whatsapp-connector dependency to 0.1.24
11
+ - Added KALEYRA_API_URL environment variable
12
+ - Now GRAPH_URL environment variable is optional
13
+ - Added bot cache invalidation for new radis key without project for tilebot
14
+ - Added chatbot fulltext endpoint
15
+
16
+ # 2.3.76
17
+ - Adedd tag to bot model
18
+ - \\n fix for public private key
19
+ - Chatbot invalidation fix when created
20
+ - @tiledesk/tiledesk-tybot-connector@0.1.53
21
+
22
+ # 2.3.75
23
+ - @tiledesk/tiledesk-tybot-connector@0.1.51
24
+
25
+ # 2.3.74
26
+ - Added cache for bot
27
+ - @tiledesk/tiledesk-tybot-connector@0.1.50
28
+ - Added cache for user
7
29
 
8
30
  # 2.3.73
9
31
  - Removed unused mongoose-auto-increment dependency
@@ -19,9 +41,12 @@
19
41
  - Added caching for /widgets endpoint with invalidations
20
42
  - Added bot rules to /widgets endpoint
21
43
  - Select false for resetpswrequestid field of user model
22
- - Added support for Public Private Key for JWT Auth with GLOBAL_SECRET_OR_PRIVATE_KEY and GLOBAL_SECRET_OR_PUB_KEY and GLOBAL_SECRET_ALGORITHM environments variables. If these properties are configured Public Private Key method is enabled otherwise if GLOBAL_SECRET env varible is configured the shared secret method is used. algorithm (default: HS256)
44
+ - Added support for Public Private Key for JWT Auth with GLOBAL_SECRET_OR_PRIVATE_KEY and GLOBAL_SECRET_OR_PUB_KEY and GLOBAL_SECRET_ALGORITHM(default: HS256, RS256 for pub private key) environments variables. If these properties are configured Public/Private Key method is enabled otherwise if only GLOBAL_SECRET env varible is configured the shared secret method is used.
23
45
  - Updated tiledesk/tiledesk-tybot-connector@0.1.48
24
46
  - Removed β€œsnapshot” from request payload for external chatbot
47
+ - Added CHATBOT_TEMPLATES_API_URL env varible
48
+ - Updated tiledesk/tiledesk-tybot-connector@0.1.49
49
+
25
50
 
26
51
 
27
52
 
@@ -29,7 +54,10 @@
29
54
  - Added Kaleyra module
30
55
  - Updated tiledesk-apps to 1.0.12
31
56
 
32
- # 2.3.71
57
+ # 2.3.71.1 -> PROD v2
58
+ - ocf email fix
59
+
60
+ # 2.3.71
33
61
  - Email service send email direct fit without request_id
34
62
  - Removed strong from transcript email template
35
63
  - Added for updateWaitingTimeByRequestId the field enable_populate
package/docs/api-mgm.md CHANGED
@@ -1,70 +1,3 @@
1
1
  # TILEDESK REST API
2
2
 
3
- ## Signup
4
-
5
- ```
6
- curl -v -X POST -d 'email=andrea.leo@f21.it&password=123456' https://api.tiledesk.com/v1/auth/signup
7
- ```
8
-
9
- ### Signin
10
-
11
- ```
12
- curl -v -X POST -d 'email=andrea.leo@f21.it&password=123456' https://api.tiledesk.com/v1/auth/signin
13
- ```
14
-
15
- ### Firebase signin
16
-
17
- ```
18
- curl -v -X POST -d 'email=andrea.leo@f21.it&password=123456' https://api.tiledesk.com/v1/firebase/auth/signin
19
- ```
20
-
21
- ### Departments
22
-
23
- ```
24
- curl -v -X GET -u andrea.leo@f21.it:123456 https://api.tiledesk.com/v1/5ab0f32757066e0014bfd718/departments
25
- ```
26
-
27
- #### Get the available operator for a specific department
28
- ```
29
- curl -v -X GET -u andrea.leo@frontiere21.it:123456 https://api.tiledesk.com/v1/5ad4c101e774ac0014ae0d07/departments/5ad5c2c9c975820014ba901b/operators
30
- ```
31
-
32
-
33
-
34
- ### Bots
35
-
36
- #### List
37
-
38
- ```
39
- curl -v -X GET -u andrea.leo@f21.it:123456 https://api.tiledesk.com/v1/5ab0f32757066e0014bfd718/faq_kb
40
- ```
41
-
42
- #### Create
43
-
44
- ```
45
- curl -v -X POST -u andrea.leo@f21.it:123456 -d '{"name":"testbot"}' https://api.tiledesk.com/v1/5ab0f32757066e0014bfd718/faq_kb
46
- ```
47
-
48
- ## Analytics
49
- ```
50
- curl -v -X GET -u andrea.leo@f21.it:123456 https://api.tiledesk.com/v1/5ad5bd52c975820014ba900a/analytics/requests/count
51
-
52
- ```
53
-
54
- ```
55
- curl -v -X GET -u andrea.leo@f21.it:123456 https://api.tiledesk.com/v1/5ad5bd52c975820014ba900a/analytics/requests/waiting
56
-
57
- ```
58
-
59
- ```
60
- curl -v -X GET -u andrea.leo@f21.it:123456 https://api.tiledesk.com/v1/5ad5bd52c975820014ba900a/analytics/requests/waiting/day/last
61
- ```
62
-
63
- ```
64
- curl -v -X GET -u andrea.leo@f21.it:123456 https://api.tiledesk.com/v1/5ad5bd52c975820014ba900a/analytics/requests/waiting/month
65
- ```
66
-
67
-
68
- ```
69
- curl -v -X GET -u andrea.leo@f21.it:123456 https://api.tiledesk.com/v1/5ad5bd52c975820014ba900a/analytics/requests/aggregate/dayoftheweek/hours
70
- ```
3
+ Please refer to the [Developer Portal](https://developer.tiledesk.com/)
package/models/faq.js CHANGED
@@ -155,6 +155,7 @@ FaqSchema.index({ question: 'text' },
155
155
 
156
156
 
157
157
  FaqSchema.index({ id_project: 1, id_faq_kb: 1, intent_display_name: 1 }, { unique: true });
158
+ FaqSchema.index({ id_project: 1, id_faq_kb: 1, intent_id: 1 }, { unique: true });
158
159
 
159
160
 
160
161
  var faq = mongoose.model('faq', FaqSchema);
package/models/faq_kb.js CHANGED
@@ -72,12 +72,14 @@ var Faq_kbSchema = new Schema({
72
72
  public: {
73
73
  type: Boolean,
74
74
  required: false,
75
- default: false
75
+ default: false,
76
+ index:true
76
77
  },
77
78
  certified: {
78
79
  type: Boolean,
79
80
  required: false,
80
- default: false
81
+ default: false,
82
+ index:true
81
83
  },
82
84
  mainCategory: {
83
85
  type: String,
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.3.77",
4
+ "version": "2.3.78",
5
5
  "scripts": {
6
6
  "start": "node ./bin/www",
7
7
  "pretest": "mongodb-runner start",
@@ -44,7 +44,7 @@
44
44
  "@tiledesk/tiledesk-kaleyra-proxy": "^0.1.6",
45
45
  "@tiledesk/tiledesk-rasa-connector": "^1.0.10",
46
46
  "@tiledesk/tiledesk-tybot-connector": "^0.1.55",
47
- "@tiledesk/tiledesk-whatsapp-connector": "^0.1.24",
47
+ "@tiledesk/tiledesk-whatsapp-connector": "^0.1.30",
48
48
  "amqplib": "^0.5.5",
49
49
  "app-root-path": "^3.0.0",
50
50
  "bcrypt-nodejs": "0.0.3",
@@ -475,6 +475,7 @@
475
475
 
476
476
  faqBotEvent.on("faq.create", function(faq) {
477
477
  setImmediate(() => {
478
+
478
479
  // TODO invalidate widgets here
479
480
  winston.verbose("Deleting widgets cache for faq.create");
480
481
  invalidateWidgets(client, faq.id_project); //tested
@@ -483,6 +484,8 @@
483
484
 
484
485
  faqBotEvent.on("faq.update", function(faq) {
485
486
  setImmediate(() => {
487
+ invalidateFaq(client, faq);
488
+
486
489
  // TODO invalidate widgets here
487
490
  winston.verbose("Deleting widgets cache for faq.update");
488
491
  invalidateWidgets(client, faq.id_project);//tested
@@ -491,6 +494,8 @@
491
494
 
492
495
  faqBotEvent.on("faq.delete", function(faq) {
493
496
  setImmediate(() => {
497
+ invalidateFaq(client, faq);
498
+
494
499
  // TODO invalidate widgets here
495
500
  winston.verbose("Deleting widgets cache for faq.delete",faq);
496
501
  invalidateWidgets(client, faq.id_project);//tested
@@ -706,6 +711,17 @@
706
711
  }
707
712
 
708
713
 
714
+ function invalidateFaq(client, faq) {
715
+ key = "faqs:botid:"+faq.id_faq_kb+":faq:id:*";
716
+ winston.info("Deleting cache for faq with key: " + key);
717
+ client.del(key, function (err, reply) {
718
+ winston.debug("Deleted cache for faq",reply);
719
+ winston.info("Deleted cache for faq",{err:err});
720
+ });
721
+
722
+
723
+ }
724
+
709
725
  function invalidateWidgets(client, project_id) {
710
726
  key = project_id+":widgets";
711
727
  winston.verbose("Deleting cache for widgets with key: " + key);
@@ -13,20 +13,35 @@ class Listener {
13
13
  winston.debug("whatsapp config databaseUri: " + config.databaseUri);
14
14
  }
15
15
 
16
- if (!process.env.GRAPH_URL || !config.graphUrl) {
17
- winston.info("Skip WhatsApp startApp")
18
- } else {
19
- whatsapp.startApp({
20
- MONGODB_URL: config.databaseUri,
21
- API_URL: apiUrl,
22
- GRAPH_URL: process.env.META_GRAPH_URL || config.graphUrl,
23
- BASE_URL: apiUrl + "/modules/whatsapp",
24
- APPS_API_URL: apiUrl + "/modules/apps",
25
- log: process.env.WHATSAPP_LOG
26
- }, () => {
27
- winston.info("Tiledesk WhatsApp Connector proxy server succesfully started.");
28
- })
29
- }
16
+ var port = process.env.CACHE_REDIS_PORT || 6379;
17
+ winston.debug("-Redis port: "+ port);
18
+
19
+ var host = process.env.CACHE_REDIS_HOST || "127.0.0.1"
20
+ winston.debug("-Redis host: "+ host);
21
+
22
+ var password = process.env.REDIS_PASSWORD;
23
+ winston.debug("-Redis password: "+ password);
24
+
25
+
26
+ let graph_url = process.env.META_GRAPH_URL || config.graphUrl || "https://graph.facebook.com/v14.0/"
27
+ winston.debug("Whatsapp graph_url: "+ password);
28
+
29
+ let log = process.env.WHATSAPP_LOG || false
30
+ winston.debug("Whatsapp log: "+ log);
31
+
32
+ whatsapp.startApp({
33
+ MONGODB_URL: config.databaseUri,
34
+ API_URL: apiUrl,
35
+ GRAPH_URL: graph_url,
36
+ BASE_URL: apiUrl + "/modules/whatsapp",
37
+ APPS_API_URL: apiUrl + "/modules/apps",
38
+ REDIS_HOST: host,
39
+ REDIS_PORT: port,
40
+ REDIS_PASSWORD: password,
41
+ log: log
42
+ }, () => {
43
+ winston.info("Tiledesk WhatsApp Connector proxy server succesfully started.");
44
+ })
30
45
 
31
46
  }
32
47
  }
package/routes/faq_kb.js CHANGED
@@ -255,6 +255,7 @@ router.put('/:faq_kbid', function (req, res) {
255
255
  update.tags = req.body.tags;
256
256
  }
257
257
 
258
+
258
259
  Faq_kb.findByIdAndUpdate(req.params.faq_kbid, update, { new: true, upsert: true }, function (err, updatedFaq_kb) {
259
260
  if (err) {
260
261
  return res.status(500).send({ success: false, msg: 'Error updating object.' });
@@ -319,6 +320,7 @@ router.delete('/:faq_kbid', function (req, res) {
319
320
 
320
321
  winston.debug(req.body);
321
322
 
323
+
322
324
  Faq_kb.remove({ _id: req.params.faq_kbid }, function (err, faq_kb) {
323
325
  if (err) {
324
326
  return res.status(500).send({ success: false, msg: 'Error deleting object.' });
@@ -401,6 +403,13 @@ router.get('/', function (req, res) {
401
403
  query.$text = search_obj;
402
404
  }
403
405
 
406
+ if (req.query.public) {
407
+ query.public = req.query.public;
408
+ }
409
+
410
+ if (req.query.certified) {
411
+ query.certified = req.query.certified;
412
+ }
404
413
 
405
414
 
406
415
  winston.info("query", query);