@tiledesk/tiledesk-server 2.3.1 → 2.3.4

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
 
2
2
 
3
+ # 2.3.2
4
+ - Dowload trascript as csv, pdf and txt endpoint
5
+ - Added closed_by field to the request model
6
+ - Added followers field to the request model
7
+ - Added lead index
8
+ - Added widget v5 code loader /widgets/v5/:project_id -> heroku blocca cache-control
9
+ - Bugfix Cannot read property 'profile' of null
10
+ - Added filter by channel offline and online
11
+ - Updated Rasa Connector to 1.0.7
12
+ - Send info message on lead.fullaname.update
13
+
14
+
15
+ # 2.3.1
16
+ - changed tiledesk logo for emails
17
+ - open modules: analytics, activity log, multi tenancy, departments, groups, canned responses, tags, triggers, webhooks
18
+
19
+ # 2.2.39
20
+ - Added enterprise module
21
+ - Log fix
22
+ - Added DISABLE_MONGO_PASSWORD_MASK env variable
23
+ - Embedded rasa proxy
24
+ - Added Swedish, Uzbek and Kazakh languages
25
+ - Added Azerbaijani language
26
+
3
27
  # 2.2.38
4
28
  - Unlocked departments, groups, multi-tenant, tags and canned resposes modules
5
29
 
package/README.md CHANGED
@@ -9,11 +9,23 @@
9
9
 
10
10
  # Introduction
11
11
 
12
- Tiledesk-server is the server engine of Tiledesk. Tiledesk is an Open Source Live Chat platform with integrated ChatBot written in NodeJs and Express. Build your own customer support with a multi-channel platform for Web, Android and iOS. More info here https://www.tiledesk.com.
12
+ Tiledesk-server is the server engine of Tiledesk. Tiledesk is an Open Source Live Chat platform with integrated Chatbots written in NodeJs and Express. Build your own customer support with a multi-channel platform for Web, Android and iOS.
13
13
 
14
- You can find more info here: https://developer.tiledesk.com
14
+ Designed to be open source since the beginning, we actively worked on it to create a totally new, first class customer service platform based on instant messaging.
15
15
 
16
- # Prerequisites
16
+ What is Tiledesk today? It became the open source “conversational app development” platform that everyone needs 😌
17
+
18
+ You can use Tiledesk to increase sales for your website or for post-sales customer service. Every conversation can be automated using our first class native chatbot technology.
19
+ You can also connect your own applications using our APIs or Webhooks.
20
+ Moreover you can deploy entire visual applications inside a conversation. And your applications can converse with your chatbots or your end-users! We know this is cool 😎
21
+
22
+ Tiledesk is multichannel in a totally new way. You can write your chatbot scripts with images, buttons and other cool elements that your channels support. But you will configureyour chatbot replies only once. They will run on every channel, auto-adapting the responses to the target channel whatever it is, Whatsapp, Facebook Messenger, Telegram etc.
23
+
24
+ More info on Tiledesk website: https://www.tiledesk.com.
25
+
26
+ You can find technical documentation here: https://developer.tiledesk.com
27
+
28
+ # Prerequisites for Installation
17
29
 
18
30
  * [Nodejs](https://www.npmjs.com/) and npm installed. Suggested versions are NodeJS 12.20.2 and NPM 6.14.11
19
31
  * [MongoDb](https://www.mongodb.com) installed
@@ -81,7 +93,7 @@ Deploy with button:
81
93
  [![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/Tiledesk/tiledesk-server)
82
94
 
83
95
  # Community? Questions? Support ?
84
- If you need help or just want to hang out, come, say hi on our [Discord](https://discord.gg/WQPfqShJ) server.
96
+ If you need help or just want to hang out, come, say hi on our [<img width="15" alt="Tiledesk discord" src="https://seeklogo.com/images/D/discord-color-logo-E5E6DFEF80-seeklogo.com.png"> Discord](https://discord.gg/nERZEZ7SmG) server.
85
97
 
86
98
  # REST API
87
99
 
package/app.js CHANGED
@@ -175,8 +175,6 @@ if (process.env.CREATE_INITIAL_DATA !== "false") {
175
175
 
176
176
 
177
177
 
178
-
179
-
180
178
  var app = express();
181
179
 
182
180
 
@@ -404,6 +402,8 @@ app.use('/auth', auth);
404
402
  app.use('/testauth', [passport.authenticate(['basic', 'jwt'], { session: false }), validtoken], authtest);
405
403
 
406
404
  app.use('/widgets', widgetsLoader);
405
+ app.use('/w', widgetsLoader);
406
+
407
407
  app.use('/images', images);
408
408
  app.use('/files', files);
409
409
  app.use('/urls', urls);
@@ -201,12 +201,21 @@ router.post('/', function (req, res) {
201
201
  return winston.error("project_user not found with query: ", queryProjectUser);
202
202
  }
203
203
 
204
+
205
+ // var auto_close;
206
+
207
+ // // qui projecy nn c'è devi leggerlo
208
+ // if (req.project.attributes.auto_close === false) {
209
+ // auto_close = 10;
210
+ // }
211
+
204
212
 
205
213
  var new_request = {
206
214
  request_id: message.recipient, project_user_id:project_user_id, lead_id:createdLead._id, id_project:projectid, first_text:message.text,
207
215
  departmentid:departmentid, sourcePage:sourcePage, language:language, userAgent:client, status:requestStatus, createdBy: undefined,
208
216
  attributes:rAttributes, subject:undefined, preflight:false, channel:undefined, location:undefined,
209
217
  lead:createdLead, requester:project_user
218
+ // , auto_close: auto_close
210
219
  };
211
220
 
212
221
  winston.debug("new_request", new_request);
@@ -398,7 +407,9 @@ router.post('/', function (req, res) {
398
407
  // winston.debug('updatedParticipantsRequest', updatedParticipantsRequest);
399
408
  // manca id
400
409
 
401
- return requestService.closeRequestByRequestId(recipient_id, projectId).then(function(updatedStatusRequest) {
410
+ // closeRequestByRequestId(request_id, id_project, skipStatsUpdate, notify, closed_by)
411
+ const closed_by = user_id;
412
+ return requestService.closeRequestByRequestId(recipient_id, projectId, false, true,closed_by ).then(function(updatedStatusRequest) {
402
413
 
403
414
  winston.debug('updatedStatusRequest', updatedStatusRequest.toObject());
404
415
  return res.json(updatedStatusRequest);
package/event/botEvent.js CHANGED
@@ -123,7 +123,7 @@ messageEvent.on('message.create', function(message) {
123
123
  if (bot.type==="internal") {
124
124
  botEvent.emit('bot.message.received.notify.internal', message);
125
125
 
126
- }else {
126
+ }else { //external
127
127
  if (bot.url) {
128
128
  var botNotification = {bot: bot, message: message};
129
129
  botEvent.emit('bot.message.received.notify.external', botNotification);
Binary file
Binary file
Binary file
Binary file
@@ -83,9 +83,12 @@ module.exports = function(passport) {
83
83
  // qui arriva questo
84
84
  // decoded: {"_id":"5ce3ee855c520200176c189e","updatedAt":"2019-05-31T09:50:22.949Z","createdAt":"2019-05-21T12:26:45.192Z","name":"botext","url":"https://tiledesk-v2-simple--andrealeo83.repl.co","id_project":"5ce3d1ceb25ad30017274bc5","trashed":false,"createdBy":"5ce3d1c7b25ad30017274bc2","__v":0,"external":true,"iat":1559297130,"aud":"https://tiledesk.com","iss":"https://tiledesk.com","sub":"5ce3ee855c520200176c189e@tiledesk.com/bot"}
85
85
 
86
- winston.debug("decoded.aud: "+ decoded.aud );
87
86
 
88
87
  if (decoded && decoded.aud) {
88
+
89
+ winston.debug("decoded.aud: "+ decoded.aud );
90
+
91
+
89
92
  const audUrl = new URL(decoded.aud);
90
93
  winston.debug("audUrl: "+ audUrl );
91
94
  const path = audUrl.pathname;
package/models/lead.js CHANGED
@@ -96,6 +96,8 @@ var LeadSchema = new Schema({
96
96
  LeadSchema.index({fullname: 'text', email: 'text'},
97
97
  {"name":"lead_fulltext","default_language": defaultFullTextLanguage,"language_override": "dummy"}); // schema level
98
98
 
99
+ // suggested by atlas
100
+ LeadSchema.index({status: 1, id_project: 1, createdAt: -1});
99
101
 
100
102
  var lead = mongoose.model('lead', LeadSchema);
101
103
 
package/models/request.js CHANGED
@@ -58,7 +58,7 @@ var RequestSchema = new Schema({
58
58
  type: Schema.Types.ObjectId,
59
59
  ref: 'project_user',
60
60
  required: false, //ENABLEIT,
61
- index: true
61
+ // index: true //unused
62
62
  },
63
63
 
64
64
 
@@ -100,7 +100,7 @@ var RequestSchema = new Schema({
100
100
  type: Number,
101
101
  required: false,
102
102
  default: RequestConstants.UNASSIGNED,
103
- index: true
103
+ // index: true //unused
104
104
  },
105
105
 
106
106
 
@@ -134,17 +134,20 @@ var RequestSchema = new Schema({
134
134
  index: true,
135
135
  default: "medium" //translate on client side
136
136
  },
137
-
137
+
138
+ followers: [{
139
+ type: Schema.Types.ObjectId,
140
+ ref: 'project_user' }],
138
141
 
139
142
  participantsAgents: {
140
143
  type: Array,
141
144
  required: false,
142
- index: true,
145
+ // index: true, //i think unused
143
146
  },
144
147
  participantsBots: {
145
148
  type: Array,
146
149
  required: false,
147
- index: true,
150
+ // index: true, //i think unused
148
151
  },
149
152
  department: {
150
153
  type: Schema.Types.ObjectId,
@@ -161,20 +164,20 @@ var RequestSchema = new Schema({
161
164
  // First reply time is the time between ticket creation and the first public comment from an agent, displayed in minutes. Some qualifications include:
162
165
  first_response_at: {
163
166
  type: Date,
164
- index: true
167
+ // index: true // unused
165
168
  },
166
169
 
167
170
  //timestamp when the agent reply the first time to a visitor
168
171
  assigned_at: {
169
172
  type: Date,
170
- index: true
173
+ // index: true //unused
171
174
  },
172
175
 
173
176
  // Wait Time (Average and Longest): The average and longest times visitors have been waiting for their chats to be served.
174
177
  // Wait time is calculated as duration between the first visitor message in the chat and the first agent message. Wait time will be 0 for agent initiated or trigger initiated chats.
175
178
  waiting_time: {
176
179
  type: Number,
177
- index: true
180
+ // index: true // why?
178
181
  },
179
182
 
180
183
 
@@ -187,9 +190,12 @@ var RequestSchema = new Schema({
187
190
  // default: 0
188
191
  // },
189
192
 
190
- closed_at: {
193
+ closed_at: {
191
194
  type: Date
192
195
  },
196
+ closed_by: {
197
+ type: String
198
+ },
193
199
 
194
200
  tags: [TagSchema],
195
201
 
@@ -205,7 +211,11 @@ var RequestSchema = new Schema({
205
211
  },
206
212
  snapshot: {
207
213
  type: RequestSnapshotSchema,
208
- select: true
214
+ select: true,
215
+ //index: false,
216
+ // includeIndices: false,
217
+ excludeIndexes: true //testa bene
218
+
209
219
  // select: false
210
220
  },
211
221
 
@@ -254,7 +264,10 @@ var RequestSchema = new Schema({
254
264
  required: false
255
265
  },
256
266
  location: LocationSchema,
257
-
267
+ auto_close: {
268
+ type: Number,
269
+ index: true
270
+ },
258
271
  id_project: {
259
272
  type: String,
260
273
  required: true,
@@ -434,8 +447,22 @@ RequestSchema.index({ id_project: 1, preflight:1, updatedAt: -1 }); // used quer
434
447
 
435
448
  RequestSchema.index({ hasBot: 1, createdAt: 1 }); // suggested by atlas
436
449
 
450
+ // suggested by atlas
451
+ RequestSchema.index({ lead: 1, id_project: 1, participants: 1, preflight: 1, createdAt: -1 });
452
+ // suggested by atlas
453
+ RequestSchema.index({ lead: 1, id_project: 1, preflight: 1, createdAt: -1 });
454
+
455
+ // suggested by atlas
456
+ RequestSchema.index({ lead: 1, "snapshot.agents.id_user": 1, id_project: 1, preflight: 1, createdAt: -1 });
457
+
458
+ // suggested by atlas
437
459
  RequestSchema.index({ id_project: 1, ticket_id: 1 });
438
460
 
461
+ // suggested by atlas
462
+ RequestSchema.index({ id_project: 1, createdAt: 1, preflight: 1});
463
+
464
+ //suggested by atlas profiler. Used by auto closing requests
465
+ RequestSchema.index({ hasBot: 1, status: 1, createdAt: 1});
439
466
 
440
467
 
441
468
  // cannot index parallel arrays [agents] [participants] {"driv
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.1",
4
+ "version": "2.3.4",
5
5
  "scripts": {
6
6
  "start": "node ./bin/www",
7
7
  "pretest": "mongodb-runner start",
@@ -42,8 +42,8 @@
42
42
  "dependencies": {
43
43
  "@tiledesk/tiledesk-chat21-app": "^1.1.4",
44
44
  "@tiledesk/tiledesk-chatbot-util": "^0.8.33",
45
- "@tiledesk/tiledesk-rasa-connector": "^1.0.5",
46
45
  "@tiledesk/tiledesk-json-rules-engine": "^4.0.3",
46
+ "@tiledesk/tiledesk-rasa-connector": "^1.0.7",
47
47
  "app-root-path": "^3.0.0",
48
48
  "bcrypt-nodejs": "0.0.3",
49
49
  "body-parser": "^1.20.0",
@@ -86,6 +86,7 @@
86
86
  "passport": "^0.4.1",
87
87
  "passport-http": "^0.3.0",
88
88
  "passport-jwt": "^4.0.0",
89
+ "pdfmake": "^0.2.5",
89
90
  "promise-events": "^0.2.4",
90
91
  "request": "^2.88.2",
91
92
  "request-promise": "^4.2.6",
@@ -76,7 +76,7 @@ class ActivityArchiver {
76
76
 
77
77
  authEvent.on('project_user.update', function(event) {
78
78
  setImmediate(() => {
79
- console.log("project_user.update");
79
+ // console.log("project_user.update");
80
80
  /*
81
81
  2019-11-20T10:40:52.686991+00:00 app[web.1]: TypeError: Cannot read property '_id' of undefined
82
82
  */
@@ -2,15 +2,15 @@
2
2
  process.env.NODE_ENV = 'test';
3
3
 
4
4
  var Activity = require('../models/activity');
5
- var projectService = require('../../../../services/projectService');
6
- var userService = require('../../../../services/userService');
5
+ var projectService = require('../../../services/projectService');
6
+ var userService = require('../../../services/userService');
7
7
 
8
8
  //Require the dev-dependencies
9
9
  let chai = require('chai');
10
10
  let chaiHttp = require('chai-http');
11
- let server = require('../../../../app');
11
+ let server = require('../../../app');
12
12
  let should = chai.should();
13
- var winston = require('../../../../config/winston');
13
+ var winston = require('../../../config/winston');
14
14
 
15
15
  // chai.config.includeStack = true;
16
16