@tiledesk/tiledesk-server 2.13.33 → 2.13.34
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 +4 -0
- package/package.json +2 -2
- package/routes/logs.js +22 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,10 @@
|
|
|
5
5
|
🚀 IN PRODUCTION 🚀
|
|
6
6
|
(https://www.npmjs.com/package/@tiledesk/tiledesk-server/v/2.3.77)
|
|
7
7
|
|
|
8
|
+
# 2.13.34
|
|
9
|
+
- Updated whatsapp-connector to 1.0.14
|
|
10
|
+
- Added /logs/whatsapp/:phone_number endpoint to logs route
|
|
11
|
+
|
|
8
12
|
# 2.13.33
|
|
9
13
|
- Fix bug on create chatbot from public template
|
|
10
14
|
|
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.13.
|
|
4
|
+
"version": "2.13.34",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"start": "node ./bin/www",
|
|
7
7
|
"pretest": "mongodb-runner start",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"@tiledesk/tiledesk-tybot-connector": "^2.0.36",
|
|
53
53
|
"@tiledesk/tiledesk-voice-twilio-connector": "^0.1.22",
|
|
54
54
|
"@tiledesk/tiledesk-vxml-connector": "^0.1.87",
|
|
55
|
-
"@tiledesk/tiledesk-whatsapp-connector": "1.0.
|
|
55
|
+
"@tiledesk/tiledesk-whatsapp-connector": "1.0.14",
|
|
56
56
|
"@tiledesk/tiledesk-whatsapp-jobworker": "^0.0.13",
|
|
57
57
|
"amqplib": "^0.5.5",
|
|
58
58
|
"app-root-path": "^3.0.0",
|
package/routes/logs.js
CHANGED
|
@@ -43,7 +43,7 @@ router.get('/whatsapp/:transaction_id', async (req, res) => {
|
|
|
43
43
|
let project_id = req.projectid;
|
|
44
44
|
|
|
45
45
|
let transaction_id = req.params.transaction_id;
|
|
46
|
-
winston.info("Get logs for whatsapp transaction_id " + transaction_id)
|
|
46
|
+
winston.info("Get logs for whatsapp transaction_id " + transaction_id);
|
|
47
47
|
|
|
48
48
|
MessageLog.find({ id_project: project_id, transaction_id: transaction_id }).lean().exec((err, logs) => {
|
|
49
49
|
if (err) {
|
|
@@ -61,6 +61,27 @@ router.get('/whatsapp/:transaction_id', async (req, res) => {
|
|
|
61
61
|
|
|
62
62
|
})
|
|
63
63
|
|
|
64
|
+
router.get('/whatsapp/user/:phone_number', async (req, res) => {
|
|
65
|
+
|
|
66
|
+
const { id_project, phone_number } = req.query;
|
|
67
|
+
|
|
68
|
+
let query = { id_project: id_project, "json_message.to": phone_number };
|
|
69
|
+
|
|
70
|
+
MessageLog.find(query).lean().exec((err, logs) => {
|
|
71
|
+
if (err) {
|
|
72
|
+
winston.error("Error find logs for phone_number " + phone_number);
|
|
73
|
+
return res.status(400).send({ success: false, message: "Unable to find logs for phone_number " + phone_number })
|
|
74
|
+
}
|
|
75
|
+
winston.verbose("Logs found: ", logs);
|
|
76
|
+
|
|
77
|
+
let clearLogs = logs.map(({ _id, __v, ...keepAttrs }) => keepAttrs)
|
|
78
|
+
winston.verbose("clearLogs: ", clearLogs)
|
|
79
|
+
|
|
80
|
+
res.status(200).send(clearLogs);
|
|
81
|
+
})
|
|
82
|
+
|
|
83
|
+
})
|
|
84
|
+
|
|
64
85
|
router.post('/whatsapp', async (req, res) => {
|
|
65
86
|
|
|
66
87
|
winston.info("save following log: ", req.body);
|