Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 9th, 2012  |  syntax: None  |  size: 0.63 KB  |  hits: 18  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. require 'sinatra'
  2. require 'flowdock'
  3.  
  4. get '/feedback' do
  5.   # render feedback form
  6.   erb :feedback
  7. end
  8.  
  9.  
  10. post '/feedback' do
  11.   # create a new Flow object with API Token and sender information
  12.   flow = Flowdock::Flow.new(
  13.     :api_token => "<YOUR_API_TOKEN_HERE>",
  14.     :source => "feedback",
  15.     :from => {
  16.       :name => "Website Feedback",
  17.       :address => "feedback@yourdomain.com"
  18.     }
  19.   )
  20.   # send message to the flow
  21.   flow.send_message(:subject => params[:subject],
  22.                     :content => params[:content],
  23.                     :tags => ["feedback"])
  24.   redirect_to '/thanks'
  25. end
  26.  
  27. get '/thanks'
  28.   'Thanks for the feedback!'
  29. end