Ben
Ben

Reputation: 69

How to post status updates to Facebook fan page via API?

I have spent the last few days going through Facebook docs and dozens of blogs/websites and I still cant figure out how to post a status update (to a fan page that I manage) via the Facebook API (programatically)?

This is normally a couple lines of code (with every other API in the world). I am just dumbfounded at the complexity and obscurity with Facebook.

Any pointers?

I don't want to build a UI or deal with sessions or use their "SDK", etc etc...I just want to do a RESTful HTTP POST/s (via PHP CURL).

Thanks in advance.

(BTW, I created an app (so I have an AppID and an AppSecret))

Upvotes: 0

Views: 3922

Answers (1)

C Abernathy
C Abernathy

Reputation: 5513

First step (which you have done) is to get the user access token with the publish_stream, manage_pages permissions. Call this USER_ACCESS_TOKEN.

Step 2, get the page access token and use that to publish to the page wall. Getting page access_token:

  1. Call to URL /me/accounts with the USER_ACCESS_TOKEN
  2. The result should include your fanpage and corresponding page token. Get that token, call this PAGE_ACCESS_TOKEN
  3. Then to post to the page wall, call /PAGE_ID/feed with your parameters and use the PAGE_ACCESS_TOKEN

For more details, see https://developers.facebook.com/docs/reference/api/page/ (look for Page Access Tokens and feed sections)

Upvotes: 4

Related Questions