Take the 2-minute tour ×

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-from-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

share|improve this question
Ouch, your question makes me cry. But -- when you authenticate, did you ask permission to post on their wall? You'll need to do that. –  Jesse Wolgamott Jun 9 '11 at 15:16
Yeah, we have publish permissions. And honestly, I'm not crazy about the plan, either. Just following orders, and what-not. –  Kevin Whitaker Jun 9 '11 at 15:27

1 Answer 1

up vote 7 down vote accepted

I made a gem "fb_graph" for that :)

You can post like this.

me = FbGraph::User.me(ACCESS_TOKEN)
  :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.


share|improve this answer

Your Answer


