Posting To Your Facebook Feed as Page, not User

author: Anna date: January 25, 2011

You want to post to your Facebook page’s feed, from an app, and have it appear as the page owner/admin, not as an individual, right? It used to be one way, now it’s another.

1- Get permissions with “manage feed” between the app, the user, and the page. Let’s call this access_token1.

2- Using that access token, query the graph “/accounts” connection, and match on page_id. Once you get that, grab the access token, yes, it’s another one. Let’s call that access_token2.

3- Post to the feed using the 2nd access token, only. Don’t need to pass actor_id or anything.

Code sample, which starts with the original access-token. This token used the permissions “manage_pages”

$facebook = initFacebook();

   $accounts = $facebook->api('/accounts?access_token='.$access_token1);
   foreach($accounts as $account){
       if($account['id'] == $your_page_id){
               $access_token2 = $account['access_token'];
   $args['access_token'] = $access_token2;
   $args['name'] = 'test post';
   $args['description'] = 'Test Description';
   $responseId = $facebook->api($your_page_id.'/feed', 'post', $args);

No error handling, but you get the idea.

You used to use “actor_id”, then there was some rule about not posting “relevant content,” and perhaps this is the latest effort to control that. I also saw a bad link in the documentation to an accounts page without access_tokens, which was very misleading. Please comment if you have any contribution, improvements, etc.

Helpful links:
- Buzogány László ‘s comment on the API Reference page, very useful code sample
- Stefan & my thread on this issue long, and wandering, but we got there eventually.
- the FBJS stream.publish page
- the stream attachments documentation
- engelsols’ comment in the Forum on this thread
- the API documentation here – – isn’t wrong per se, now that I understand what they’re talking about. It’s just vague, and doesn’t include code samples.

cateogories: Uncategorized

  • Eric

    Thanks for posting this! It helped get me on the right track, even though for whatever reason the /accounts API call wasn’t working for me. I had to visit the full Graph API url in the browser to get the list of pages, but I was so excited to get the page access_token I didn’t think too much about why!

  • Dihaz

    I am getting this error :(
    GraphMethodException: Unsupported get request.

  • banane

    Glad it worked! Note: you have to use the first access_token to get the second (accounts) access_token.

  • banane

    try printing out your request, and copy and paste that into a browser url, and you’ll get a more explicit response (or use catch-FacebookApiException $e) and print out the $e. Also, see note below- you need an access_token to ge the second access_token.

  • Ben S.

    Thank, you, thank you, thank you.

Want your Facebook fans to engage and share your brand?

We are specialists in virality. We look at how people share and why people share on Facebook. Learn more about creating your own viral Facebook app today.