@tiledesk/tiledesk-whatsapp-connector 0.1.44 → 0.1.45
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/index.js +39 -1
- package/package.json +1 -1
- package/template/detail.html +7 -7
package/index.js
CHANGED
|
@@ -408,6 +408,7 @@ router.post('/tiledesk', async (req, res) => {
|
|
|
408
408
|
winston.verbose("(wab) Message received from Tiledesk")
|
|
409
409
|
|
|
410
410
|
var tiledeskChannelMessage = req.body.payload;
|
|
411
|
+
//winston.verbose("(wab) tiledeskChannelMessage: ", tiledeskChannelMessage)
|
|
411
412
|
var projectId = req.body.payload.id_project;
|
|
412
413
|
|
|
413
414
|
// get settings from mongo
|
|
@@ -440,15 +441,52 @@ router.post('/tiledesk', async (req, res) => {
|
|
|
440
441
|
}
|
|
441
442
|
|
|
442
443
|
let recipient_id = tiledeskChannelMessage.recipient;
|
|
444
|
+
let sender = tiledeskChannelMessage.sender;
|
|
443
445
|
let whatsapp_receiver = recipient_id.substring(recipient_id.lastIndexOf("-") + 1);
|
|
444
446
|
let phone_number_id = recipient_id.substring(recipient_id.lastIndexOf("wab-") + 4, recipient_id.lastIndexOf("-"));
|
|
445
447
|
|
|
448
|
+
/*
|
|
449
|
+
if (settings.expired &&
|
|
450
|
+
settings.expired === true) {
|
|
451
|
+
winston.info("settings expired: " + settings.expired);
|
|
452
|
+
return res.status(200).send({ success: 'false', message: "plan expired"})
|
|
453
|
+
|
|
454
|
+
*/
|
|
455
|
+
|
|
456
|
+
// Return an info message option
|
|
457
|
+
if (settings.expired &&
|
|
458
|
+
settings.expired === true) {
|
|
459
|
+
|
|
460
|
+
winston.verbose("settings expired: " + settings.expired);
|
|
461
|
+
let tiledeskJsonMessage = {
|
|
462
|
+
text: 'Expired. Upgrade Plan.',
|
|
463
|
+
sender: sender,
|
|
464
|
+
senderFullname: "System",
|
|
465
|
+
attributes: {
|
|
466
|
+
subtype: 'info'
|
|
467
|
+
},
|
|
468
|
+
channel: { name: 'whatsapp'}
|
|
469
|
+
}
|
|
470
|
+
let message_info = {
|
|
471
|
+
channel: "whatsapp",
|
|
472
|
+
whatsapp: {
|
|
473
|
+
from: whatsapp_receiver,
|
|
474
|
+
phone_number_id: phone_number_id
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
const tdChannel = new TiledeskChannel({ settings: settings, API_URL: API_URL })
|
|
479
|
+
const response = await tdChannel.send(tiledeskJsonMessage, message_info, settings.department_id);
|
|
480
|
+
winston.verbose("(wab) Expiration message sent to Tiledesk")
|
|
481
|
+
return res.sendStatus(200);
|
|
482
|
+
}
|
|
483
|
+
|
|
446
484
|
winston.debug("(wab) text: " + text);
|
|
447
485
|
winston.debug("(wab) attributes: " + attributes)
|
|
448
486
|
winston.debug("(wab) tiledesk sender_id: " + sender_id);
|
|
449
487
|
winston.debug("(wab) recipient_id: " + recipient_id);
|
|
450
488
|
winston.debug("(wab) whatsapp_receiver: " + whatsapp_receiver);
|
|
451
|
-
winston.debug("(wab) phone_number_id: " + phone_number_id)
|
|
489
|
+
winston.debug("(wab) phone_number_id: " + phone_number_id);
|
|
452
490
|
|
|
453
491
|
const messageHandler = new MessageHandler({ tiledeskChannelMessage: tiledeskChannelMessage });
|
|
454
492
|
const tlr = new TiledeskWhatsappTranslator();
|
package/package.json
CHANGED
package/template/detail.html
CHANGED
|
@@ -215,31 +215,31 @@
|
|
|
215
215
|
|
|
216
216
|
<div style="width: 100%; display: flex; flex-direction: row; justify-content: space-between; margin-bottom: 15px;">
|
|
217
217
|
<div>
|
|
218
|
-
<p style="margin-bottom: 0px">Added possibility to select a department for Whatsapp conversations.</p>
|
|
219
218
|
<p style="margin-bottom: 0px">Bug fixes and minor improvements</p>
|
|
220
219
|
<!--<p>Bug fixes and performance improvements</p>-->
|
|
221
220
|
</div>
|
|
222
|
-
<p style="font-size: 12px; color: #676767; margin-bottom: 0px;">Version <b>0.1.
|
|
221
|
+
<p style="font-size: 12px; color: #676767; margin-bottom: 0px;">Version <b>0.1.45</b></p>
|
|
223
222
|
</div>
|
|
224
223
|
|
|
225
224
|
<div style="width: 100%; display: flex; flex-direction: row; justify-content: space-between; margin-bottom: 15px;">
|
|
226
225
|
<div>
|
|
227
|
-
<p style="margin-bottom: 0px">
|
|
228
|
-
<p style="margin-bottom: 0px">
|
|
226
|
+
<p style="margin-bottom: 0px">Added possibility to select a department for Whatsapp conversations.</p>
|
|
227
|
+
<p style="margin-bottom: 0px">Bug fixes and minor improvements</p>
|
|
229
228
|
<!--<p>Bug fixes and performance improvements</p>-->
|
|
230
229
|
</div>
|
|
231
|
-
<p style="font-size: 12px; color: #676767; margin-bottom: 0px;">Version <b>0.1.
|
|
230
|
+
<p style="font-size: 12px; color: #676767; margin-bottom: 0px;">Version <b>0.1.34</b></p>
|
|
232
231
|
</div>
|
|
233
232
|
|
|
234
233
|
<div style="width: 100%; display: flex; flex-direction: row; justify-content: space-between; margin-bottom: 15px;">
|
|
235
234
|
<div>
|
|
236
|
-
<p style="margin-bottom: 0px">
|
|
235
|
+
<p style="margin-bottom: 0px">Bug Fixes</p>
|
|
237
236
|
<p style="margin-bottom: 0px">Minor improvements</p>
|
|
238
237
|
<!--<p>Bug fixes and performance improvements</p>-->
|
|
239
238
|
</div>
|
|
240
|
-
<p style="font-size: 12px; color: #676767; margin-bottom: 0px;">Version <b>0.1.
|
|
239
|
+
<p style="font-size: 12px; color: #676767; margin-bottom: 0px;">Version <b>0.1.31</b></p>
|
|
241
240
|
</div>
|
|
242
241
|
|
|
242
|
+
|
|
243
243
|
<hr style="margin-top: 50px; margin-bottom: 20px">
|
|
244
244
|
|
|
245
245
|
</body>
|