Facebook Realtime Update API for page feed
Digital Marketing
Facebook Marketing API
2 years ago
5
Star Rating
1
Rating
_x000D_
_x000D_
I have gone through Realtime Update API documentation provided by Facebook & got successfully subscribed to the "page" object with the field as "feed", below is subscription url check which I used
URL:- https://graph.facebook.com//subscriptions?access_token=
which gave me the following response
RESPONSE:-
{
"data": [
{
"object": "page",
"callback_url": ,
"fields":
[
"feed"
],
"active": true
}
]
}.
This response clearly states that App is subscribed for feeds on the pages.
But my problem is that I am unable to receive any RealTime Update on the .
Below is the CALLBACK_URL php file code
);
$method = $_SERVER['REQUEST_METHOD'];
if(!empty($method))
{
if (!empty($_GET) && strcmp($method, 'GET') == 0 && strcmp($_GET['hub_mode'], 'subscribe') == 0 && $_GET['hub_verify_token'] == VERIFY_TOKEN)
{
echo $_GET['hub_challenge'];
}
else if (strcmp($method, 'POST') == 0)
{
file_put_contents(, "inside post method");
if (isset( $_SERVER['HTTP_X_HUB_SIGNATURE'] ) )
{
file_put_contents(, "inside post method");
$post_body = file_get_contents("php://input");
$object = json_decode($post_body);
file_put_contents(, json_encode($object));
if ($_SERVER['HTTP_X_HUB_SIGNATURE'] == "sha1=" . hash_hmac('sha1', $post_body, VERIFY_TOKEN))
{
//REST OF THE CODE TO SAVE IN DB
}
}
}
}
else
{
echo "Invalid Request, might be for testing purpose";
}
?>
Facebook is not sending any POST request to my CALLBACK_URL. Please let me know if I am missing anything
Posted on 16 Aug 2022, this text provides information on Facebook Marketing API related to Digital Marketing. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.
Take Quiz To Earn Credits!
Turn Your Knowledge into Earnings.