I'm creating a facebook chatbot with Rails using a gem called facebook-messenger
[ https://github.com/jgorset/facebook-messenger ] and the figaro
gem to store my api keys and tokens.
However, I'm not being able to connect the webhook because every time it makes a call to the callback_url
to check for the verify_token
, it gives me the following error on terminal: Facebook::Messenger::Subscriptions::Error (An active access token must be used to query information about the current user.)
and this one on facebook: The URL couldn't be validated. Response does not match challenge, expected value="992096906", received="Error; wrong verif..."
I have checked and my access_token
is right for the fb page I'm trying to connect to and the ngrok tunnel server I'm using for the callback_url
works on the browser (meaning it takes me to the blank page since there is no view for that page and I can access every other page of the app through the ngrok). The verify_token
is also exactly the same in the app (in my application.yml
file)enter image description here and in facebook itself.
I have also added the submissions for pages_messaging
. I'm wondering whether I should have some code in the bot.rb
file which is the end point of my callback_url
? If so, what should it look like? [I've seen some online but they're for PHP or JS and I'm already using the mount Facebook::Messenger::Server, at: 'bot'
on my routes.rb
file]
SOS
Screenshot of error in facebook trying to connect the webhook