I try to setup a webhook for the facebook messenger api and try to forward to my localhost node.js server via ngrok. The GET request from facebook for checking the server ist working perfect. But when I send a message to my site via the messenger I dont get any response to my webhook. It works ok when I curl the ngrok address. Any suggestions ?
Thanks
I was having similar issue -
My current (semi-working) workaround is to unsubscribe my test page from the Facebook app configuration page (in the app settings page -> Messenger in the left panel -> Webhooks section), and then re-subscribe my test Facebook page. I will immediately receive Http POST message after I type something to my test page in the messenger.
Of course that can only help testing. It doesn't help in the production environment.
As long as the Facebook app you are using for the Messenger integration is in an unpublished state, i.e has not undergone a review process, only messages by admins, developers and testers are relayed through the webhook.
Check if the user you are using has the correct permission on the app.
On some occasions Facebook also stops forwarding messages, e.g if your webhook endpoint is returning errors repeatedly. Check your alert dashboard in the developers.facebook.com platform.
The solution is to unsubscribe and then subscribe a page again.
Further hints:
Depending on the framework you are using on the receiving end it might reject messages with an x-forwarded-for header in the request (Symfony 2 in my case).
Use the -host-header=rewrite option with ngrok to rewrite the request header if you run into issues like that.
Related
I have created a webhook to receive feed updates. I want to be notified when a post is liked or commented on or shared. I have set the endpoints up in a script on my server, i have also set up the webhook in the developers console. When i send a test event from the dev console in the webhook section my endpoint receives and processes it fine. When i set my app to live, nothing seems to be sent to the webhook from my page when i like or comment or post. I have followed all the instructions exactly. I have subscribed my page to the app and checked that it is subscribed, and also i have set my app to live. Yet there are still no webhook events received... Any one got any idea what im missing??
you have to get this permission pages_manage_metadata to get the feed activity on your webhook
I'm trying to integrate facebook with my application.
I set up a server, webhook subscription went well (subscribed to fields: feed, conversation and messages), callback url is fine, test messages from app dashboard are coming to my server.
Then I have added my fb page to my fb app via graph api explorer and want to test creating posts. I created a post in two ways: via graph api explorer and via fb page. Anyway, no info is coming to my server.
I tested it while app is in development mode and in live mode.
What is wrong with my thinking? Any and all information will be appreciated.
=================================================================
CLOSING
My bad. I didn't noticed that facebook needs to review my app in order to start working
I have an application that uses the Facebook messenger api to send and receive messages through a Facebook page. This works great. Now I need to be able to have a user in my application link their page so that messages sent to their page will send webhooks to our endpoint, and also give us the ability to send messages through that page using an auth_token.
Is there any way to do this via api, or will each user have to manually create a Facebook app, generate an auth_token for their page, and set the webhooks url to our endpoint? I've read about messenger account linking but I don't think it's quite what I need, as I'm not just looking to request additional profile information.
After looking a bit deeper, I found that in order to do this you must perform an OAuth flow to get an auth_token for the user, then use the graph api to get an auth_token for the desired user's page. Then with the page auth_token you can make a POST request to the subscribed_apps endpoint, which will then add the page to the app's webhook events.
I am not able to make webhooks new page subscription its giving me an error in the callback url saying "(The URL couldn't be validated. Response does not match challenge, expected value = '736926330', received=')", i am not having a domain name as same as my app name.
You need a server the supports https and script code running on it to authenticate the subscription.
Facebook Messenger Platform Developers Complete Guide
I'm trying to implement Facebook's RTU functionality to subscribe to page's conversations. So far I've gotten through all the steps - creating an app, subscribing to a page's conversations, connecting the page to my web-app. RTUs work on my local, but not on my Heroku app.
Here's a link to the facebook bugs page:
https://developers.facebook.com/bugs/822517191155290/
Here's how far I've got:
When I enable the Facebook App to send POST requests to:
https://..../fb_callback (https), we don't see anything in the logs.
On the other hand, when I enable the app to send POST requests to:
http://...com/fb_callback
I see that the request comes in and then there's a 301 redirect.
My guess is that the 301 redirect is to https... but I'm not sure of this.
What I can't figure out is why I can't see the POST requests to our log when they're sent to https.
Thanks for your help.