Created
December 31, 2010 20:08
-
-
Save stve/761300 to your computer and use it in GitHub Desktop.
Using Ruby to post to a Facebook Page's wall
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| post_data = {} | |
| post_data[:name] = 'Title for my link' | |
| post_data[:link] = 'http://path.to/my/link' | |
| post_data[:caption] = 'A caption' | |
| post_data[:description] = 'A description' | |
| post_data[:picture] = 'http://path.to/myimage.jpg' | |
| post_data[:actions] = { :name => 'My site name', :link => 'http://link.to/my/site'}.to_json | |
| client.post("feed", nil, post_data) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| access_token = 'my_facebook_access_token' | |
| page_id = 'my_facebook_page_id' | |
| client = Mogli::Client.new(access_token) | |
| user = Mogli::User.find("me",client) | |
| page = user.accounts.select { |account| account.id.to_s == page_id }.first | |
| page = Mogli::Page.new(:access_token => page.access_token) | |
| page.client_for_page |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment