Skip to content

Instantly share code, notes, and snippets.

@pushmatrix
Created August 16, 2012 02:00
Show Gist options
  • Save pushmatrix/3365613 to your computer and use it in GitHub Desktop.
Save pushmatrix/3365613 to your computer and use it in GitHub Desktop.
A fun sinatra app with twilio
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
@pushmatrix
Copy link
Author

Run it with ruby filename.rb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment