Created
January 21, 2015 23:49
-
-
Save jarodreyes/0b21c3cb2a284dcbb196 to your computer and use it in GitHub Desktop.
This file contains 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
before do | |
@twilio_number = ENV['TWILIO_NUMBER'] | |
@points_number = ENV['POINTS_NUMBER'] | |
@client = Twilio::REST::Client.new ENV['TWILIO_ACCOUNT_SID'], ENV['TWILIO_AUTH_TOKEN'] | |
puts "num: #{@twilio_number}" | |
end | |
route :get, :post, '/points' do | |
puts 'points/' | |
@phone_number = Sanitize.clean(params[:From]) | |
@msg = "Travel Deal Alert: JFK-LAX: $32 One-way. 2475 Miles on JetBlue. You're welcome. -TPG" | |
@media = "https://s3-us-west-1.amazonaws.com/jardiohead/branded-tpglg.png" | |
message = @client.account.messages.create( | |
:from => @points_number, | |
:to => @phone_number, | |
:media_url => @media, | |
) | |
puts message.to | |
sleep(20) | |
message2 = @client.account.messages.create( | |
:from => @points_number, | |
:to => @phone_number, | |
:body => @msg, | |
) | |
puts message2.to | |
halt 200 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment