webhooks - How to add heroku callback URL to Facebook dashboard? -


i confused how messenger set-up in facebook dashboard. have set-up node.js app on heroku communicate facebook api , tried connect following callback url:

https://ancient-dawn-xxxxx.herokuapp.com/webhook/

however getting following error:

the url couldn't validated. callback verification failed following errors: http status code = 403; http message = forbidden

my app's app.js file includes following code:

var express = require("express"); var request = require("request"); var bodyparser = require("body-parser");  var app = express(); app.use(bodyparser.urlencoded({extended: false})); app.use(bodyparser.json()); app.listen((process.env.port || 5000));  // server index page app.get("/", function (req, res) {   res.send("deployed!"); });  // facebook webhook // used verification app.get("/webhook/", function (req, res) {   if (req.query["hub.verify_token"] === "process.env.verification_token") {     console.log("verified webhook");     res.status(200).send(req.query["hub.challenge"]);   } else {     console.error("verification failed. tokens not match.");     res.sendstatus(403);   } }); 

when try access url https://murmuring-temple-xxxxx.herokuapp.com/webhook/ receive forbidden response.

what missing?

you comparing req.query["hub.verify_token"] string "process.env.verification_token" rather value process.env.verification_token.

also, make sure value of process.env.verification_token matches verification token provided when set webhook.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -