I looked at the Realtime Update API documentation provided by Facebook and successfully subscribed to the page with the field as "feed" , below - the subscribed URL, check that I used
URL: - https://graph.facebook.com/ / subscriptions? access_token =
who gave me the following answer
ANSWER: -
{ "data": [ { "object": "page", "callback_url": <CALLBACK_URL>, "fields": [ "feed" ], "active": true } ] }.
This answer clearly states that the application is subscribed to channels on the pages.
But my problem is that I cannot get RealTime's update.
Below is the PHP file code CALLBACK_URL
<?php define('VERIFY_TOKEN', <APPSECRET_KEY>); $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(<FILE_PATH1>, "inside post method"); if (isset( $_SERVER['HTTP_X_HUB_SIGNATURE'] ) ) { file_put_contents(<FILE_PATH2>, "inside post method"); $post_body = file_get_contents("php://input"); $object = json_decode($post_body); file_put_contents(<FILE_PATH3>, json_encode($object)); if ($_SERVER['HTTP_X_HUB_SIGNATURE'] == "sha1=" . hash_hmac('sha1', $post_body, VERIFY_TOKEN)) {
Facebook is not sending a POST request to my CALLBACK_URL. Please let me know if I missed something.
source share