Skip to content

Instantly share code, notes, and snippets.

Created May 26, 2014 23:06
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Post several links to a Facebookpage
#!/usr/bin/env ruby
# foreman run script/social/auto-fbpost.rb data/crawl-data.json
# To get page access token, go to graph explorer, get user token with manage_pages and publish_actions permission,
# then request /{userId}/accounts
require 'koala'
require 'json'
urls = JSON.parse(
# todo: add hashtags
for url in urls[2..100]
text = url['description'] || url['title']
graph.put_object(ENV['FB_PAGE_ID'], 'feed', :message => text, :link => url['url'])
puts "Posted: #{text}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment