@tiledesk/tiledesk-server 2.2.1 → 2.2.6
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 +14 -0
- package/package.json +2 -2
- package/pubmodules/emailNotification/requestNotification.js +31 -9
- package/routes/urls.js +1 -1
- package/services/emailService.js +45 -15
- package/services/faqService.js +2 -3
- package/template/email/assignedRequest.html +0 -2
- package/template/email/ticket.html +3 -4
package/CHANGELOG.md
CHANGED
@@ -1,3 +1,17 @@
|
|
1
|
+
# 2.2.5
|
2
|
+
- Quota license fix
|
3
|
+
|
4
|
+
# 2.2.4
|
5
|
+
- email invitation fix
|
6
|
+
|
7
|
+
# 2.2.3
|
8
|
+
- Email inboud fix (others disabled and inboudDomain variable fix and token query string encode fix)
|
9
|
+
|
10
|
+
# 2.2.2
|
11
|
+
- log fix
|
12
|
+
|
13
|
+
# 2.2.1
|
14
|
+
- log fix
|
1
15
|
|
2
16
|
# 2.2.0
|
3
17
|
- Cache circleci fix
|
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.2.
|
4
|
+
"version": "2.2.6",
|
5
5
|
"scripts": {
|
6
6
|
"start": "node ./bin/www",
|
7
7
|
"pretest": "mongodb-runner start",
|
@@ -37,7 +37,7 @@
|
|
37
37
|
"@tiledesk-ent/tiledesk-server-dialogflow": "^1.1.6",
|
38
38
|
"@tiledesk-ent/tiledesk-server-groups": "^1.1.2",
|
39
39
|
"@tiledesk-ent/tiledesk-server-jwthistory": "^1.1.9",
|
40
|
-
"@tiledesk-ent/tiledesk-server-mt": "^1.1.
|
40
|
+
"@tiledesk-ent/tiledesk-server-mt": "^1.1.7",
|
41
41
|
"@tiledesk-ent/tiledesk-server-payments": "^1.1.5",
|
42
42
|
"@tiledesk-ent/tiledesk-server-queue": "^1.1.10",
|
43
43
|
"@tiledesk-ent/tiledesk-server-request-history": "^1.1.5",
|
@@ -261,6 +261,7 @@ sendToUserEmailChannelEmail(projectid, message) {
|
|
261
261
|
jwtid: uuidv4()
|
262
262
|
};
|
263
263
|
|
264
|
+
|
264
265
|
var recipient = lead.lead_id;
|
265
266
|
winston.debug("recipient:"+ recipient);
|
266
267
|
|
@@ -291,12 +292,13 @@ sendToUserEmailChannelEmail(projectid, message) {
|
|
291
292
|
winston.debug("sourcePage "+sourcePage);
|
292
293
|
|
293
294
|
|
294
|
-
var tokenQueryString;
|
295
|
-
if(sourcePage && sourcePage.indexOf('?')>-1) {
|
296
|
-
tokenQueryString = "&tiledesk_jwt=
|
295
|
+
var tokenQueryString;
|
296
|
+
if(sourcePage && sourcePage.indexOf('?')>-1) { //controllo superfluo visto che lo metto prima? ma lascio comunque per indipendenza
|
297
|
+
tokenQueryString = encodeURIComponent("&tiledesk_jwt=JWT "+token)
|
297
298
|
}else {
|
298
|
-
tokenQueryString = "?tiledesk_jwt=
|
299
|
+
tokenQueryString = encodeURIComponent("?tiledesk_jwt=JWT "+token);
|
299
300
|
}
|
301
|
+
winston.debug("tokenQueryString: "+tokenQueryString);
|
300
302
|
|
301
303
|
emailService.sendEmailChannelNotification(message.request.lead.email, message, project, tokenQueryString, sourcePage);
|
302
304
|
|
@@ -610,11 +612,12 @@ sendUserEmail(projectid, message) {
|
|
610
612
|
|
611
613
|
var tokenQueryString;
|
612
614
|
if(sourcePage && sourcePage.indexOf('?')>-1) { //controllo superfluo visto che lo metto prima? ma lascio comunque per indipendenza
|
613
|
-
tokenQueryString = "&tiledesk_jwt=
|
615
|
+
tokenQueryString = encodeURIComponent("&tiledesk_jwt=JWT "+token)
|
614
616
|
}else {
|
615
|
-
tokenQueryString = "?tiledesk_jwt=
|
617
|
+
tokenQueryString = encodeURIComponent("?tiledesk_jwt=JWT "+token);
|
616
618
|
}
|
617
|
-
|
619
|
+
winston.debug("tokenQueryString: "+tokenQueryString);
|
620
|
+
|
618
621
|
emailService.sendNewMessageNotification(lead.email, message, project, tokenQueryString, sourcePage);
|
619
622
|
}
|
620
623
|
|
@@ -775,8 +778,27 @@ sendAgentEmail(projectid, savedRequest) {
|
|
775
778
|
winston.warn("User not found", savedRequest.participants[0]);
|
776
779
|
} else {
|
777
780
|
winston.verbose("Sending sendNewAssignedRequestNotification to user with email", user.email);
|
778
|
-
// if (user.emailverified) { enable it? send anyway to improve engagment for new account
|
779
|
-
|
781
|
+
// if (user.emailverified) { enable it? send anyway to improve engagment for new account
|
782
|
+
|
783
|
+
|
784
|
+
// var signOptions = {
|
785
|
+
// issuer: 'https://tiledesk.com',
|
786
|
+
// subject: 'user',
|
787
|
+
// audience: 'https://tiledesk.com',
|
788
|
+
// jwtid: uuidv4()
|
789
|
+
// };
|
790
|
+
|
791
|
+
// let userObject = {_id: user._id, firstname: user.firstname, lastname: user.lastname, email: user.email, attributes: user.attributes};
|
792
|
+
// winston.debug("userObject ",userObject);
|
793
|
+
|
794
|
+
|
795
|
+
// var agentToken = jwt.sign(userObject, configSecret, signOptions);
|
796
|
+
// winston.debug("agentToken "+agentToken);
|
797
|
+
|
798
|
+
|
799
|
+
|
800
|
+
|
801
|
+
emailService.sendNewAssignedRequestNotification(user.email, savedRequest, project);
|
780
802
|
// }
|
781
803
|
}
|
782
804
|
});
|
package/routes/urls.js
CHANGED
package/services/emailService.js
CHANGED
@@ -74,15 +74,15 @@ class EmailService {
|
|
74
74
|
}
|
75
75
|
winston.info('EmailService replyEnabled : '+ this.replyEnabled);
|
76
76
|
|
77
|
-
//
|
77
|
+
// this is used as fixed reply to url, but this is unused we always return support-group-dynamic
|
78
78
|
this.replyTo = process.env.EMAIL_REPLY_TO || config.replyTo;
|
79
79
|
winston.info('EmailService replyTo address: '+ this.replyTo);
|
80
80
|
|
81
|
-
this.
|
82
|
-
winston.info('EmailService
|
81
|
+
this.inboundDomain = process.env.EMAIL_INBOUND_DOMAIN || config.inboundDomain;
|
82
|
+
winston.info('EmailService inboundDomain : '+ this.inboundDomain);
|
83
83
|
|
84
|
-
this.
|
85
|
-
winston.verbose('EmailService
|
84
|
+
this.inboundDomainDomainWithAt = "@"+this.inboundDomain;
|
85
|
+
winston.verbose('EmailService inboundDomainDomainWithAt : '+ this.inboundDomainDomainWithAt);
|
86
86
|
|
87
87
|
this.pass = process.env.EMAIL_PASSWORD;
|
88
88
|
|
@@ -346,7 +346,11 @@ class EmailService {
|
|
346
346
|
|
347
347
|
let messageId = "notification" + "@" + MESSAGE_ID_DOMAIN;
|
348
348
|
|
349
|
-
let replyTo
|
349
|
+
let replyTo;
|
350
|
+
if (this.replyEnabled) { //fai anche per gli altri
|
351
|
+
replyTo = request.request_id + this.inboundDomainDomainWithAt;
|
352
|
+
}
|
353
|
+
|
350
354
|
let headers;
|
351
355
|
if (request) {
|
352
356
|
|
@@ -356,7 +360,11 @@ class EmailService {
|
|
356
360
|
replyTo = request.attributes.email_replyTo;
|
357
361
|
}
|
358
362
|
|
359
|
-
headers = {
|
363
|
+
headers = {
|
364
|
+
"X-TILEDESK-PROJECT-ID": project._id,
|
365
|
+
"X-TILEDESK-REQUEST-ID": request.request_id,
|
366
|
+
"X-TILEDESK-TICKET-ID":request.ticket_id,
|
367
|
+
};
|
360
368
|
|
361
369
|
winston.verbose("messageId: " + messageId);
|
362
370
|
winston.verbose("replyTo: " + replyTo);
|
@@ -488,7 +496,11 @@ class EmailService {
|
|
488
496
|
|
489
497
|
let messageId = message._id + "@" + MESSAGE_ID_DOMAIN;
|
490
498
|
|
491
|
-
let replyTo
|
499
|
+
let replyTo;
|
500
|
+
if (this.replyEnabled) {
|
501
|
+
replyTo = message.request.request_id + this.inboundDomainDomainWithAt;
|
502
|
+
}
|
503
|
+
|
492
504
|
let headers;
|
493
505
|
if (message.request) {
|
494
506
|
|
@@ -629,7 +641,11 @@ class EmailService {
|
|
629
641
|
|
630
642
|
let messageId = "notification-pooled" + new Date().getTime() + "@" + MESSAGE_ID_DOMAIN;
|
631
643
|
|
632
|
-
let replyTo
|
644
|
+
let replyTo;
|
645
|
+
if (this.replyEnabled) {
|
646
|
+
replyTo = request.request_id + this.inboundDomainDomainWithAt;
|
647
|
+
}
|
648
|
+
|
633
649
|
let headers;
|
634
650
|
if (request) {
|
635
651
|
|
@@ -765,7 +781,11 @@ class EmailService {
|
|
765
781
|
|
766
782
|
let messageId = message._id + "@" + MESSAGE_ID_DOMAIN;
|
767
783
|
|
768
|
-
let replyTo
|
784
|
+
let replyTo;
|
785
|
+
if (this.replyEnabled) {
|
786
|
+
replyTo = message.request.request_id + this.inboundDomainDomainWithAt;
|
787
|
+
}
|
788
|
+
|
769
789
|
let headers;
|
770
790
|
if (message.request) {
|
771
791
|
|
@@ -904,7 +924,11 @@ class EmailService {
|
|
904
924
|
|
905
925
|
let messageId = message._id + "@" + MESSAGE_ID_DOMAIN;
|
906
926
|
|
907
|
-
let replyTo
|
927
|
+
let replyTo;
|
928
|
+
if (this.replyEnabled) {
|
929
|
+
replyTo = message.request.request_id + this.inboundDomainDomainWithAt;
|
930
|
+
}
|
931
|
+
|
908
932
|
let headers;
|
909
933
|
if (message.request) {
|
910
934
|
|
@@ -1015,6 +1039,8 @@ class EmailService {
|
|
1015
1039
|
}
|
1016
1040
|
|
1017
1041
|
winston.debug("msgText: " + msgText);
|
1042
|
+
winston.debug("baseScope: " + JSON.stringify(baseScope));
|
1043
|
+
|
1018
1044
|
|
1019
1045
|
var replacements = {
|
1020
1046
|
message: message,
|
@@ -1033,7 +1059,11 @@ class EmailService {
|
|
1033
1059
|
|
1034
1060
|
let messageId = message._id + "@" + MESSAGE_ID_DOMAIN;
|
1035
1061
|
|
1036
|
-
let replyTo
|
1062
|
+
let replyTo;
|
1063
|
+
if (this.replyEnabled) {
|
1064
|
+
replyTo = message.request.request_id + this.inboundDomainDomainWithAt;
|
1065
|
+
}
|
1066
|
+
|
1037
1067
|
let headers;
|
1038
1068
|
if (message.request) {
|
1039
1069
|
|
@@ -1187,7 +1217,7 @@ class EmailService {
|
|
1187
1217
|
|
1188
1218
|
var that = this;
|
1189
1219
|
|
1190
|
-
var html = await this.readTemplate('resetPassword.html'
|
1220
|
+
var html = await this.readTemplate('resetPassword.html');
|
1191
1221
|
|
1192
1222
|
|
1193
1223
|
var envTemplate = process.env.EMAIL_RESET_PASSWORD_HTML_TEMPLATE;
|
@@ -1269,7 +1299,7 @@ class EmailService {
|
|
1269
1299
|
|
1270
1300
|
var that = this;
|
1271
1301
|
|
1272
|
-
var html = await this.readTemplateFile('
|
1302
|
+
var html = await this.readTemplateFile('beenInvitedExistingUser.html');
|
1273
1303
|
|
1274
1304
|
var envTemplate = process.env.EMAIL_EXUSER_INVITED_HTML_TEMPLATE;
|
1275
1305
|
winston.debug("envTemplate: " + envTemplate);
|
@@ -1315,7 +1345,7 @@ class EmailService {
|
|
1315
1345
|
|
1316
1346
|
var that = this;
|
1317
1347
|
|
1318
|
-
var html = await this.readTemplateFile('
|
1348
|
+
var html = await this.readTemplateFile('beenInvitedNewUser.html');
|
1319
1349
|
|
1320
1350
|
var envTemplate = process.env.EMAIL_NEWUSER_INVITED_HTML_TEMPLATE;
|
1321
1351
|
winston.debug("envTemplate: " + envTemplate);
|
package/services/faqService.js
CHANGED
@@ -60,15 +60,14 @@ class FaqService {
|
|
60
60
|
{ 'question': 'Hello', 'answer': 'Hello', 'topic': 'greetings' },
|
61
61
|
{ 'question': 'Who are you?', 'answer': 'Hi, I\'m a bot 🤖. You can find more about me [here](https://tiledesk.com/chatbot-for-customer-service).\ntdImage:https://console.tiledesk.com/assets/images/tily-welcomebot.gif\n* See the website https://tiledesk.com/\n* Back to start tdAction:start', 'topic': 'greetings' },
|
62
62
|
{ 'question': '👨🏻🦰 I want an agent', 'answer': 'We are looking for an operator.. '+ActionsConstants.CHAT_ACTION_MESSAGE.AGENT, 'intent_display_name': 'agent_handoff', 'topic': 'internal' },
|
63
|
-
{ 'question': 'Close\
|
63
|
+
{ 'question': 'Close\nResolved', 'answer': ActionsConstants.CHAT_ACTION_MESSAGE.CLOSE, 'topic': 'internal' },
|
64
64
|
{ 'question': '\\start', 'answer': 'Hello 👋. I\'m a bot 🤖.\n\nChoose one of the options below or write a message to reach our staff.\n* Who are you?\n* Where are you?\n* What can you do?\n* 👨🏻🦰 I want an agent', 'intent_display_name': 'start', 'topic': 'internal' },
|
65
|
-
// { 'question': 'Menu', 'answer': 'Choose one of the options below or write a message to reach our staff.\n* Who are you?\n* Where are you?\n* What can you do?\n* 👨🏻🦰 I want an agent','topic': 'internal' },
|
66
65
|
{ 'question': 'defaultFallback', 'answer': 'I can not provide an adequate answer. Write a new question or talk to a human agent.\n* Back to start tdAction:start\n* See the docs https://docs.tiledesk.com/\n* 👨🏻🦰 I want an agent', 'topic': 'internal' }, //TODO se metto spazio n * nn va
|
67
66
|
{ 'question': 'What can you do?', 'answer': 'Using natural language processing, I\'m able to find the best answer for your users. I also support images, videos etc.. Let\'s try:\n* Sample Image\n* Sample Video\n* Sample Action tdAction:action1\n* Sample Frame\n* Back to start tdAction:start', 'topic': 'sample' },
|
68
67
|
{ 'question': 'Sample Image', 'answer': 'tdImage:https://tiledesk.com/tiledesk-logo-x1.png\n* What can you do?\n* Back to start tdAction:start', 'topic': 'sample' },
|
69
68
|
{ 'question': 'Sample Frame', 'answer': 'tdFrame:https://www.emanueleferonato.com/wp-content/uploads/2019/02/runner/\n* What can you do?\n* Back to start tdAction:start', 'topic': 'sample' },
|
70
69
|
{ 'question': 'Sample Video', 'answer': 'tdVideo:https://www.youtube.com/embed/EngW7tLk6R8\n* What can you do?\n* Back to start tdAction:start', 'topic': 'sample' },
|
71
|
-
{ 'question': 'Where are you', 'answer': 'We are here ❤️\ntdFrame:https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d6087916.923447935!2d8.234804542117423!3d41.836572992140624!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x12d4fe82448dd203%3A0xe22cf55c24635e6f!2sItaly!5e0!3m2!1sen!2sit!4v1613657475377!5m2!1sen!2sit\n* Back to start tdAction:start', 'topic': 'sample' },
|
70
|
+
{ 'question': 'Where are you?', 'answer': 'We are here ❤️\ntdFrame:https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d6087916.923447935!2d8.234804542117423!3d41.836572992140624!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x12d4fe82448dd203%3A0xe22cf55c24635e6f!2sItaly!5e0!3m2!1sen!2sit!4v1613657475377!5m2!1sen!2sit\n* Back to start tdAction:start', 'topic': 'sample' },
|
72
71
|
|
73
72
|
// { 'question': 'Sample Webhook', 'answer': 'tdWebhook:https://tiledesk-bot-webhook.tiledesk.repl.co', 'topic': 'sample' },
|
74
73
|
{ 'question': 'Sample Action', 'answer': 'Hello 👋 Would you like to take a closer look at our offer?\n* Yes, please tdAction:yes_action\n* No tdAction:no_action','intent_display_name': 'action1', 'topic': 'sample' },
|
@@ -160,7 +160,6 @@
|
|
160
160
|
<tr style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
|
161
161
|
<td class="content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; margin: 0; padding: 0 0 20px;" valign="top">
|
162
162
|
<a href="{{baseScope.baseUrl}}/#/project/{{request.id_project}}/wsrequest/{{request.request_id}}/messages">Open the dashboard</a>.
|
163
|
-
FAI BOTTONE-> Open chat https://console.tiledesk.com/v2/chat/#/conversation-detail/support-group-5f47e834c85eca0012c97888-04bcc959aa4543bca69c36082c62c88f/Evan/active
|
164
163
|
</td>
|
165
164
|
</tr>
|
166
165
|
|
@@ -182,7 +181,6 @@
|
|
182
181
|
<td class="aligncenter content-block" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 12px; vertical-align: top; color: #999; text-align: center; margin: 0; padding: 0 0 20px;" align="center" valign="top">
|
183
182
|
<span><a href="http://www.tiledesk.com" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 12px; color: #999; text-decoration: underline; margin: 0;" > Tiledesk.com </a></span>
|
184
183
|
<br><span><a href="%unsubscribe_url%" style="font-family: 'Helvetica Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 12px; color: #999; text-decoration: underline; margin: 0;">Unsubscribe</a></span>
|
185
|
-
Change email settings for this project https://support-pre.tiledesk.com/dashboard/#/project/618c050b49a73000358210e4/project-settings/notification
|
186
184
|
</td>
|
187
185
|
</tr>
|
188
186
|
</table>
|
@@ -132,8 +132,7 @@
|
|
132
132
|
{{#ifEquals this.type "url"}}
|
133
133
|
<li><a href="{{this.link}}" class="dynamic_button">{{this.value}}</a></li>
|
134
134
|
{{else}}
|
135
|
-
<li><a href="mailto:{{../message.request.request_id}}@{{baseScope.inboundDomain}}?subject=Re:%20{{../message.request.subject}}&body={{this.value}}" class="dynamic_button">{{this.value}}</a></li>
|
136
|
-
<!-- <li><a href="https://api.tiledesk.com/v2/{{project.id}}/link?secret_token={{tokenQueryString}}" class="dynamic_button">{{this.value}}</a></li> -->
|
135
|
+
<li><a href="mailto:{{../message.request.request_id}}@{{../baseScope.inboundDomain}}?subject=Re:%20{{../message.request.subject}}&body={{this.value}}" class="dynamic_button">{{this.value}}</a></li>
|
137
136
|
{{/ifEquals}}
|
138
137
|
{{/each}}
|
139
138
|
|
@@ -142,14 +141,14 @@
|
|
142
141
|
{{/if}}
|
143
142
|
{{/if}}
|
144
143
|
|
145
|
-
{{#if message.attributes.intent_info}}
|
144
|
+
<!-- {{#if message.attributes.intent_info}}
|
146
145
|
{{#if message.attributes.intent_info.others}}
|
147
146
|
Others:
|
148
147
|
{{#each message.attributes.intent_info.others}}
|
149
148
|
<li><span>{{this.answer}}</span></li>
|
150
149
|
{{/each}}
|
151
150
|
{{/if}}
|
152
|
-
{{/if}}
|
151
|
+
{{/if}} -->
|
153
152
|
|
154
153
|
|
155
154
|
|