Skip to content

Instantly share code, notes, and snippets.

@jamesladd
Created September 7, 2011 00:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamesladd/1199405 to your computer and use it in GitHub Desktop.
Save jamesladd/1199405 to your computer and use it in GitHub Desktop.
Writing to facebook users wall server side ....
require 'rubygems'
require 'koala'
#
# initialize a Graph API connection
@oauth = Koala::Facebook::OAuth.new(app_id, code, "https://www.facebook.com/connect/login_success.html")
@url_for_oauth_code = @oauth.url_for_oauth_code(:permissions => "publish_stream")
puts @url_for_oauth_code.inspect
# Goto the URL printed above in your browser - it should print 'success' and in the
# url will be the access code. Paste that in below as "access_code"
@access_code = "<paste data from above here>"
# first, initialize a Graph API with your token
puts @graph = Koala::Facebook::GraphAPI.new(@access_code)
@friends = @graph.get_connections("me", "friends")
puts @friends.inspect
@friend = @friends[0]
puts "Writing public data ..."
#now try writing to friends wall
puts @friend['id']
puts @graph.put_wall_post("I can't believe its not butter.", {}, @friend['id'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment