How to subscribe to real-time updates for a Facebook page's wall

后端 未结 6 1930
遇见更好的自我
遇见更好的自我 2020-11-30 23:04

Facebook\'s real-time updates docs now say that you can get the feed for a page:

You can subscribe to the page\'s feed in the same way you subscribe t

6条回答
  •  春和景丽
    2020-12-01 00:04

    I do not know if this can help you but I'll tell you where I am for real-time update page feed:

    (permissions : manage_page,offline_access,read_stream)

    1. your application must be linked to the page (then install the application but not required to have a tab ex. create tab https://graph.facebook.com/PAGE_ID/tabs?app_id=APP_ID&method=POST&access_token=PAGE_ACCESS_TOKEN and delete tab TAB_ID=PAGE_ID.'/tabs/app_'.APP_ID; https://graph.facebook.com/TAB_ID?method=DELETE&access_token=PAGE_ACCESS_TOKEN)

      
      function page_access_token($page_id,$access_token){
      $page_token_url="https://graph.facebook.com/" . $page_id . "?fields=access_token&" . $access_token; $response = file_get_contents($page_token_url); $resp_obj = json_decode($response,true); $page_access_token = $resp_obj['access_token']; return $page_access_token; }

      function page_tabs_create($page_id,$app_id,$page_access_token){

      $page_settings_url = "https://graph.facebook.com/" . $page_id . "/tabs?app_id=".$app_id."&method=POST&access_token=" . $page_access_token; $response = file_get_contents($page_settings_url); $resp_obj = json_decode($response,true); return $resp_obj; }

      function page_tabs_delete($tab_id,$page_access_token){

      $page_settings_url = "https://graph.facebook.com/".$tab_id."?method=DELETE&access_token=" . $page_access_token; $response = file_get_contents($page_settings_url); $resp_obj = json_decode($response,true);

      return $resp_obj; }

    2. Subscription: to subscribe must be like a "user" and therefore object = user fields = feed but you have to add new fields because otherwise it receives the comments and likes the wall so you must add "status" in order to receive the articles posted (my problem is to get other content such as links I have managed to add "link" as fields but I am not receiving notifications when a link is posted)

      $param = array ('access_token' => $ access_token, 'object' => 'user', 'fields' => 'feed, status, link' 'callback_url' => 'http:// ******** fbcallback.php' 'verify_token' =>'***********', 'include_values' => 'true');

      POST https://graph.facebook.com/APP_ID/subscriptions

    my English is not very good but I hope it will help you, on my side I'm still looking for really all updates to the wall (links, video ...)

提交回复
热议问题