@tiledesk/tiledesk-server 2.2.2 → 2.2.3
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
CHANGED
package/package.json
CHANGED
@@ -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
|
|
@@ -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
|
|