Skip to content

Commit

Permalink
fix verify token
Browse files Browse the repository at this point in the history
  • Loading branch information
maximilianodelgado committed Sep 26, 2020
1 parent 8156647 commit 4f2686b
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions routes/bot.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,7 @@ module.exports = (app) => {
app.get(encodeURI(`${context}/webhook/`), (req, res) => {
const { verifyToken } = paramsConfig;

const mode = req.query['hub.mode '];
const token = req.query['hub.verify_token'];
const challenge = req.query['hub.challenge'];

if (mode === 'subscribe' && token === verifyToken) {
if (req.query['hub.verify_token'] === verifyToken) {
setTimeout(() => {
functions
.doSubscribeRequest()
Expand All @@ -123,7 +119,7 @@ module.exports = (app) => {
prefix: '[subscribe] RESPONSE',
message: `Subscription result: ${response.success}`
});
res.status(200).send(challenge);
res.status(200).send(req.query['hub.challenge']);
})
.catch((error) => {
signale.error({
Expand Down

0 comments on commit 4f2686b

Please sign in to comment.