I made a facebook fanpage for my rails app, and I would like to be able to post data from the rails app to that facebook fanpage's wall.
After a lot of digging around the web, I've found that I am really confused by a lot of the terminology. Most of the solutions I've found, including the fb_graph gem are asking for an ACCESS_TOKEN, which requries an APP_SECRET and an APP_ID. I can find the page's ID but I don't think I can get an APP_SECRET for just a normal fanpage.
The gem doc says I can just use this snippet to post to a feed:
me = FbGraph::User.me(ACCESS_TOKEN)
me.feed!(
:message => 'Updating via FbGraph',
:picture => 'https://graph.facebook.com/matake/picture',
:link => 'http://github.com/nov/fb_graph',
:name => 'FbGraph',
:description => 'A Ruby wrapper for Facebook Graph API'
)
Which is great, except that I don't know if I can get an ACCESS_TOKEN without the APP_SECRET and APP_ID.
Do I need to create a Facebook App? (which I believe is different from the normal fan page…) I want users to be able to "like" the page so that things i post in my news feed will show up in their news feed as well.
It's only one page, I don't think I need to authenticate users through OAUTH… I don't want them to post on the page's wall, just the page to post on it's own wall. But I want it to be automated.
How can I do this?
Best Answer
Yes, to get an access token, you need client_id and client_secret. Once you got them, this sample app will give you an access token of yourself. (Edit client_id, client_secret and permissions in config/facebook.yml. You'll need "manage_pages" permission at least)
https://github.com/nov/fb_graph_sample
In fb_graph's case, you can post a message as the page itself with this code.
You can store
page.access_token
for future use If you already have the page access token, you can simply call like this.ps.
me.feed!(...)
post as the page owner not as the page itself.