Created
August 16, 2012 02:00
-
-
Save pushmatrix/3365613 to your computer and use it in GitHub Desktop.
A fun sinatra app with twilio
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
require 'sinatra' | |
require 'twilio-ruby' | |
@account_sid = # PUT IN YOUR ACCOUNT ID | |
@auth_token = # PUT IN YOUR AUTH TOKEN | |
@client = Twilio::REST::Client.new(@account_sid, @auth_token) | |
ACCOUNT = @client.account | |
get '/script' do | |
Twilio::TwiML::Response.new { |r| | |
r.Say 'Hey there! Why don"t you say a cool story bro.' | |
r.Record :action => '/handle_recording', :transcribe => true, :transcribeCallback => '/transcribe' | |
}.text | |
end | |
get '/transcriptions' do | |
@transcription = ACCOUNT.transcriptions.list.map(&:transcription_text).join('<br/>') | |
end | |
post '/transcribe' do | |
puts "TRANSCRIPTION" | |
puts params | |
end | |
post '/handle_recording' do | |
puts "GOGOOGO" | |
puts params | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Run it with
ruby filename.rb