Alex Rivera | Logout

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

Asked 2011-09-09T22:06:50.547
15

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 to a user's feed - the subscription topic should be 'user' and the subscription field should be 'feed'

My understanding of this is that I need to post to the graph API to subscribe as such:

curl -d \
"object=user&fields=feed&callback_url=$CALLBACKURL&verify_token=$SECRET" \
"https://graph.facebook.com/$PAGEID/subscriptions?access_token=$OAUTHTOKEN"

(This is a bash script.) Here $CALLBACKURL is set up correctly following their example code. (At least I think it's correct -- I can successfully add subscriptions with it.) The $OAUTHTOKEN is the one for my Facebook App.
And the $PAGEID is the facebook object id of the page I'd like to get realtime updates for.

When I do this, the call appears to work -- no error message. My callback gets called. But I certainly don't get notified when something happens on the page's feed.

So what's missing? Does the page need to install the app whose oauth token I'm using? Or do I somehow need to get an oauth token for the page itself by logging in as the page?

Edit
Report

1 Answer

17

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 f

answered 2011-09-12T07:13:34.787

Your Answer