Facebook Messenger API: Trouble setting up a webhook

前端 未结 6 576
说谎
说谎 2020-12-31 03:25

I am trying to set up a web hook for the new Facebook Messenger bot platform on my PHP webserver and am receiving this error:

The URL couldn\'t be val

6条回答
  •  礼貌的吻别
    2020-12-31 04:11

    @shane

    webhook: function(req, res) {
    
       if (req.query['hub.verify_token'] === 'tokentoken') {
          res.send(req.query['hub.challenge']);
       } else {
          res.send('Error, wrong validation token');    
       }
    }
    

    Note sure what exactly you're doing. but this is what I did and it's working.

    I've tested using ngrok server as I don't have a domain name and the callback URL is https://werwrwetwtw.ngrok.io/webhook

    Hope this helps!

提交回复
热议问题