Reputation: 391
I have a webapplication with a cms-system. I have created a task that is executed when someone publish a newsarticle on the page. Simple thing. What I would like to do is to publish this newsarticle on our Facebook page AS the page.
There are a lot of old versions of api and stuff out there so I cannot figure out what is the most updated version of doing this.
Can someone please explain the steps I need to perform to auth an application to post to the page, and how to actually post the message?
I do not have any userinput options at this point but the most guides I have found requires user input in some auth dialogs and such. It must be possible to auth the app, and then request a token and post the page right?
Upvotes: 0
Views: 492
Reputation: 10556
Follow step 1 to 4 here: http://developers.facebook.com/docs/authentication/server-side/
Make sure you enter 'manage_pages' and 'publish_stream' permission in step 1. This should give you a valid access token.
With this access token, you call the following api method: (replace xxxxxxx with access_token)
https://graph.facebook.com/me/accounts?access_token=XXXXXXXX
In the output you should see something similar to this:
{
"data": [
{
"name": "My App",
"category": "Application",
"id": "10258853",
"access_token": "yyyyyyyyyyyyyy"
}
]
}
Using the yyyyyyyyyyy access_token you can publish to any wall like you would do as a user.
https://graph.facebook.com/ThePageId/feed/message=MyFirstPost&access_token=yyyyyyyyyyyyyy
I've been asking the same before. See my question here for the code i was using then. I think you should manage with that and my answer above.
I hope i could make at least a few things clear for you. If not, ask me and i'll try to help you out.
Upvotes: 4