Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

36 lines (30 sloc) 0.885 kb
require 'sinatra'
require 'yaml'
require 'twilio'
# You need to replace the entries in config.yml
# with your own twilio information like so:
#
# caller_id = your twilio phone number
# twilio_sid = your twilio sid, keep this private
# twilio_tkn = your twilio token, keep this private
#
# You can access these later with config['param']
# where param is replaced by an option in the yaml
# file.
config = YAML.load_file('./config/config.yml')
CALLER_ID = config['caller_id']
get '/' do
haml :index
end
post '/sms' do
Twilio.connect(config['twilio_sid'], config['twilio_tkn'])
number = params[:number]
message = params[:msg]
# If you're using a twilio demo number you'll need
# to include your twilio PIN as the first argument
# here:
#
# Twilio::Sms.message(PIN, CALLER_ID, number, message)
Twilio::Sms.message(CALLER_ID, number, message)
redirect '/'
end
Jump to Line
Something went wrong with that request. Please try again.