Skip to content

Instantly share code, notes, and snippets.

@xmjw
Last active August 29, 2015 13:58
Show Gist options
  • Save xmjw/9951471 to your computer and use it in GitHub Desktop.
Save xmjw/9951471 to your computer and use it in GitHub Desktop.
Makers Twilio Stuff
require 'twilio-ruby'
client = Twilio::REST::Client.new "Your twilio SID", "Tour twilio Token"
#Send SMS...
client.account.messages.create(to: "+44 your number", from: "+44a twilio number", body: "the contents of your message")
#Make a call...
client.account.calls.create(to: "+44 your number", from: "+44a twilio number", url: "http://blahblah.ngrok.com/cheese")
require 'sinatra'
post '/cheese' do
content_type 'text/xml'
"<Response>
<Say>Some crazy cheese joke. Now we'll play some music...</Say>
<Play>http://cdn.wawra.co/sw.mp3</Play>
</Response>"
end
post '/message' do
content_type 'text/xml'
"<Response>
<Message>This is your reply message!</Message>
</Response>"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment