1
votes

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

2
First thing is to make sure you followed the Subscribe the App to a Page portion of the guide. - rekamoyka
I did and as I said the GET call send from Facebook to verify the hook works.. - jona jürgen
The webhook can be set up and verified without having done the "Subscribe the App" portion, that's why I mentioned it. If you've already gone through that portion, you'll need to share code so we can see what's going on. - rekamoyka
Is there a resolution of this? I think I am having similar issue. I am using ngrok too so I am not sure if ngrok is related? - Yibin Lin

2 Answers

0
votes

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.

0
votes

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.