开发者

Rails: Posting to a Facebook user's wall

We've been getting users to connect their Facebook accounts to our site for a couple of weeks now, and I've been given the task of finding a way to post messages (i.e. advertisements) to their wall.

Essentially, there would be a cron job that would run at a specified time every day, which would post to a user's wall using our app secret and their oauth2_token (which we store).

I've done some searching, and I came across this post: http://ckdake.com/content/2010/posting-to-facebook-开发者_如何学Cfrom-a-ruby-on-rails-app.html

That seems to require me to re-authorize the users, though. I'm currently using just the OAuth2 gem to do all my Facebook connecting, and I store the user's token with their user profile. I'd rather not set up a brand new model, just for the purposes of storing duplicate information.

So, has anyone done anything like this? If so, could you point me in the right direction? Thanks


I made a gem "fb_graph" for that :)

You can post like this.

me = FbGraph::User.me(ACCESS_TOKEN)
me.feed!(
  :message => 'Updating via FbGraph',
)

What you need is only the user's access token which should be stored in your DB already.

See more samples here.

http://github.com/nov/fb_graph

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜