I'm creating a chatbot with the Facebook Messenger developer platform.
My problem comes as I'm trying to set up the Webhook using a ngrok tunnel as callback_url and using the figaro gem to add my access_token and verify_token to my app.
Somehow, the test never passes and I don't know why.
My ngrok site works perfectly in the browser. Yet I think the problem stems from the fact that the Webhook isn't receiving the information it wants, aka the access_token & verify_token from how I understand it.
I have tried redirecting the ngrok tunnel to a page that returns the environment variables of both (ENV["ACCESS_TOKEN"] & ENV["VERIFY_TOKEN"]) yet this doesn't work. So I'm just not sure what the API is expecting and why it's not getting it.
Thanks for the help!!!!!
It's actually simple so let me explain.
Say you expose these two functions as endpoints.
verify_webhook() has a string called fb_app_token, this is just a string of any value, I used a GUID value here.
also, the handle_webhook() is the actual callbackurl function you will also expose.
Notice the HTTP methods despite the same endpoint naming convention.
Facebook will send a GET request to the same CallbackUrl you provided. So when you go to your developer account you will have these two options
Facebook will send the VerifyToken value before any request in a GET request to your callbackurl. If they match, facebook affirms it has hit the right endpoint and it can now send the actual POST request to your callbackurl.
Too much mention of the word callbackurl :).
That should make you verify/register your callbackurl with FB.