@tiledesk/tiledesk-whatsapp-connector 1.0.4 → 1.0.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/index.js +7 -8
- package/package.json +1 -1
- package/tiledesk/TiledeskBotTester.js +4 -2
package/index.js
CHANGED
|
@@ -1283,21 +1283,20 @@ router.get("/webhook/:project_id", async (req, res) => {
|
|
|
1283
1283
|
winston.verbose("(wab) Verify the webhook... ");
|
|
1284
1284
|
winston.debug("(wab) req.query: " + req.query);
|
|
1285
1285
|
|
|
1286
|
+
let id_project = req.params.project_id;
|
|
1287
|
+
|
|
1286
1288
|
// Parse params from the webhook verification request
|
|
1287
1289
|
let mode = req.query["hub.mode"];
|
|
1288
1290
|
let token = req.query["hub.verify_token"];
|
|
1289
1291
|
let challenge = req.query["hub.challenge"];
|
|
1290
1292
|
|
|
1291
|
-
|
|
1293
|
+
let settings = await utils.getSettingsByProjectId(id_project);
|
|
1294
|
+
if (!settings) {
|
|
1295
|
+
settings = await utils.getSettings(projectId, null);
|
|
1296
|
+
}
|
|
1292
1297
|
|
|
1293
|
-
|
|
1298
|
+
let VERIFY_TOKEN = settings.verify_token;
|
|
1294
1299
|
|
|
1295
|
-
// if (!settings || !settings.verify_token) {
|
|
1296
|
-
// winston.error("(wab) No settings found! Unable to verify token.");
|
|
1297
|
-
// res.sendStatus(403);
|
|
1298
|
-
// } else {
|
|
1299
|
-
//let VERIFY_TOKEN = settings.verify_token;
|
|
1300
|
-
let VERIFY_TOKEN = "tiledesk-verify-token"
|
|
1301
1300
|
// Check if a token and mode were sent
|
|
1302
1301
|
if (mode && token) {
|
|
1303
1302
|
// Check the mode and token sent are correct
|
package/package.json
CHANGED
|
@@ -83,8 +83,10 @@ class TiledeskBotTester {
|
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
let
|
|
87
|
-
|
|
86
|
+
let settings = await utils.getSettingsByProjectId(this.project_id);
|
|
87
|
+
if (!settings) {
|
|
88
|
+
settings = await utils.getSettings(this.project_id, null);
|
|
89
|
+
}
|
|
88
90
|
|
|
89
91
|
if (!settings) {
|
|
90
92
|
winston.verbose("No settings found. Exit..");
|