Posting to Facebook fan page wall as an admin using Facebook API

I know, I know. This is a blog about Open Technologies and Open Web and I am writing about Facebook. Shame on me :)
It’s a little bit tricky and I’ve lost 3 hours to resolve it and that’s the reason to post it here

Here is the solution.:

1. If you are reading this, probably you have Application setup-ed already in Facebook;
2. Add your application to your Page;
3. Run this link in your Browser. Please replace ~URL~ with your connect URL (Facebook Application dialog) and ~APPID~ with your application ID,offline_access,manage_pages

4. This URL will return to you a URL parameter access_token.
5. Save the token somewhere;
6. Load This URL. Replace ~TOKEN~ with the token received from Facebook at point 4.;

7. As a result you will get the json with all your pages and all access tokens. Save them somewhere;

         "name": "Electronic Frontier Bulgaria",
         "category": "Websites",
         "id": "29469045921",
         "access_token": "some secret string."

8. Use FB js SDK to update your page. Replace ~PAGE_AUTH~ with access_token from the previous point. (some secret string)

var wallPost = {
    access_token: "~PAGE_AUTH~",
    message: ' is the best :)'

FB.api('/me/feed', 'post', wallPost, function(response) {
    if (!response || response.error) {
        alert('Error occurred');
    } else {

9. Check the page to see the result;
10. Bye me a beer or hire me :)

If you have any questions, please let me know!






13 responses to “Posting to Facebook fan page wall as an admin using Facebook API”

  1. Annalivia Avatar

    Matt Barton has posted some sample code here to automate this using the Facebook PHP SDK – it might help

  2. Abe Avatar

    can you explain what you mean by, “connect URL (Facebook Application dialog) ” in step 3? I am having trouble getting past this point…

  3. Abe Avatar

    Nevermind, I figured that part out. Is there a way to do steps 6/7 in code?

  4. ahmad Avatar

    good article. i have been searching for a solution since 4 hours

  5. Mr.Mike Avatar

    This is the best explanation I’ve found so far and got me up and running in minutes. Thanks, Bogo!

  6. Martin Avatar

    thx for sharing this, – short and effective !!!! ;)

  7. Vini Avatar

    Thank you for sharing this information since Facebook API is really vague. It worked for my application for around a week, and suddenly it stopped working 2 days ago. Every time i try to publish on my page’s wall, it posts that on my own wall. I don’t know, does it have to do with the access token?

    Plz let me kno

  8. Marco Avatar


    I’ve followed all the steps and now my APP is posting on my PAGE WALL.


    If I check the post it says something like “2 hours ago via APP_NAME”

    So the post has been posted VIA THE APP and NOT AS if I manually use the form …

    So am I doing wrong?

    Can you help me, please?



    1. Bogo Avatar

      Have no idea. this tutorial is almost 1 y old and Facebook may change something again to their API

  9. Sokool84 Avatar

    You are My Master :)) Thank You for Solution.

  10. soundhar Avatar

    Hey using this code can i post to the facebook page without app details? I want to post to facebook page from php like admin post

  11. Joseph Avatar

    How to post to my page as the page, not me?

  12. Indrajeet Avatar

    Thanks alot…..It worked out fine.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: