Webhook to get Facebook Page Feeds

  Kiến thức lập trình

I am stuck with the Webhook endpoint where i receive the Facebook feeds

I need to create an API to get the Facebook feeds(commonts,like, etc) which are Made on My Facebook Page.

By Following the steps i have created a facebook App with the developer account. With Webhook added

Webhook Added

After that i went to the settings page.

Since i want the feeds, i have select the Page from the dropdown and clicked subscribe. The i need to enter the Callback URL.

From My API side i have created a .Net Core Application(5… not latest). Then create a Get and Post Method called Webhook. Since i need an https:// connection i have installed ngRok and setup the test API. And the GET method will return the Challange

       [HttpGet("webhook")]
        public async Task<IActionResult> Receive([FromQuery(Name = "hub.mode")] string hubMode,
                                       [FromQuery(Name = "hub.challenge")] int hubChallenge,
                                       [FromQuery(Name = "hub.verify_token")] string hubVerifyToken)
        {
            return Ok(hubChallenge); // this is working... no issue here
        }

Back to the Facebook side
I have added the callback URL after clicking subscribe and got Challenge key in my API Get method. Once its done I need to select the fields i need to subscribe i.e.; feed in order to get the Facebook page response.

Feeds

Then i need to setup permission so, i have subscribed to permission dropdown. Added the callback URL, get the Challenge key and subscription is complete. After that subscribed to pages_manage_metadata , pages_show_list and pages_manage_engagement(although document didn’t mention pages_manage_engagement).

After that Went to facebook graph explorer and done the subscription to feed using the page access token
https://graph.facebook.com/{page-id}/subscribed_apps?subscribed_fields=feed&access_token={page-access-token}

subscribe to page

This is also done and its says true

I check with the GET method to see whether it is complete and its says feed is in subscribed list
Subscribed fields

But after this everything stops 🙁

When i click the test button its not sending any feed to my Post method in my API.

So i used the graph explore API to comment the Post and post is done , but no webhook response
tried comment manually but no response.

So i thought maybe some issue with my API Post endpoint i have created. So i tested with Postman and the request is going through.

I changed by computer to my laptop with different network(you need to try everything possible), still no response.

So Just for the testing i subscribed to the Messaging option in facebook, just to check whether its an issue with the Page. The thing is i got a response to my Post method, so the messaging webhook is sending to the POST method. That means my API end point is correct.

So i thought something to do with by permission, so i enabled all permissions related to the page and tried, but no response.

I changes my facebook account to some other account, not working.

Then i tried with an account with facebook business enabled, no luck

I have tried changing the Permissions in the page, still no luck.

I tryed the gemini,chatgpt 3.5 and 4 … no luck.
asked in the facebook community…that place is kinda dead.

The main issue is i am not even getting any response when i click the Test button. Most of the online issues, they atleast get a hit from test.

So next thing to do is review the app and then test. but when i am in the review page , they are saying we need to test the app well before we go to review. So i an not sure what to do now.

Am i missing something? Any help would be valuable.

I dont know whether its a facebook bug or not. Because some document say

you need if the Page has not disabled the App platform in its App Settings.
But in that page there is a turn on button, but it will change its status once we click it, but it will go back to the original state when we refresh the page.
App Settings page

If anyone faced this issue and manage to solve this please help. i have been on this for quiet a while and i don’t know what to do next.

Thankyou

New contributor

xCy is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

LEAVE A COMMENT