I have a Developer Account, I have a Facebook Fans Page, and I have a Facebook App which link to Facebook Fans Page. I also deploy the backend to heroku successfully. And I also have access token, and Webhooks url and verify token still complete.
Through the curl by cmd, the backend receive message successfully. But through the Facebook Messenger webpage to send message, the backend can't receive any message from any user.
Why???
https://developers.facebook.com/docs/messenger-platform/getting-started/app-setup/
I follow this document, but not working.
Related
I created a Facebook app that has a webhook for Facebook Page messages through FB Messenger. Essentially the purpose is to add a bot to our Facebook Pages. We now want to start creating Messenger bots for other business' pages.
Facebook allows us to have our app webhook subscribe to our own FB Pages, but we can't find any way to add another business' FB Page (screenshot below)
How can we make it so that our app can be installed by other businesses to their FB Pages? (so that the bot will work for their pages).
We put our app through the app review process and it was approved, but I only put in my personal information, not the business' information. Could this be a blocker?
You can subscribe pages to / unsubscribe them from your webhook via the page/subscribed_apps API endpoint.
You need to have a page admin login to your app and grant it permission to manage their pages, then you get a page access token, and with that you make the request to subscribe the page to your webhook.
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 have a Facebook App which is subscribed to more than 20,000 pages. The server isn't able to process hooks from all these Facebook pages, I want to unsubscribe my app from all these Facebook pages. Is there a quicker way to do this. Most of the page access token I have is expired, so I can't loop through all the pages and unsubscribe my app from them.
To unsubscribe your app from a Facebook page, you do not need a token from the page. All you need is your App Access Token. To unsubscribe from the page just make a DELETE http request to:
https://graph.facebook.com/{page_id}/subscribed_apps?access_token={your_access_token}
You can get your App Access Token by sending a GET request to:
https://graph.facebook.com/oauth/access_token
?client_id={app-id}
&client_secret={app-secret}
&grant_type=client_credentials
So just make a DELETE request to each page you want to unsubscribe from.
I am creating an application where I need a user to be able to grant us access to their facebook page so that all incoming messages can flow through our application (as well as outgoing).
I have this all working correctly, but facebook will not approve my app due to the facebook permission pages_messaging and them "not receiving a response from my bot" (I have been denied three straight times). What am I doing wrong here? We are not using bots, do I even need the pages_messaging permission (I am using their webhook to get incoming page messages, and graph api to send outgoing)?
When submitting app, pages_messaging permission says:
Please provide the page that can be used to test this bot. Make sure the bot is properly connected and functional, otherwise your submission may be rejected.
Here is facebook's feedback from my submission (denied multiple times):
Thank you for your submission. We tested the messenger experience on your associated page and received no response from your messenger bot. Please resubmit with the new, improved version of your bot.
You got to create a bot to use the messaging API: https://developers.facebook.com/docs/messenger-platform/implementation
To just read/send messages:
https://developers.facebook.com/docs/graph-api/reference/v2.6/conversation/messages
You can use the /pageID/conversations endpoint to retrieve all conversations your page has had with FB profiles.
Next you can read/post to the /conversationID/messages endpoint to read/respond to a person.
And you can even subscribe to the conversations field for pages with webhooks.
You will need a page admin's page access token that has the read_page_mailboxes permission scope to set up the subscription, and to read/reply to messages.
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.