Skip to content

Instantly share code, notes, and snippets.

@eugeneiiim
Created November 29, 2012 09:59
Show Gist options
  • Save eugeneiiim/4167922 to your computer and use it in GitHub Desktop.
Save eugeneiiim/4167922 to your computer and use it in GitHub Desktop.
Posting a new message to Flowdock from Ruby via REST
def flowdock_message(msg)
url = URI.parse("https://#{FLOWDOCK[:token]}:DUMMY@api.flowdock.com/flows/#{FLOWDOCK[:org]}/#{FLOWDOCK[:flow]}/messages")
req = Net::HTTP::Post.new(url.path)
req.basic_auth FLOWDOCK[:token], 'DUMMY'
req.set_form_data({ :event => 'message', :content => msg })
res = Net::HTTP.new(url.host, url.port)
res.use_ssl = true
res.start {|http| http.request(req) }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment