Created
January 18, 2012 20:50
-
-
Save manlycode/1635511 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
class SendTextController < ApplicationController | |
def index | |
end | |
def send_text_message | |
number_to_send_to = params[:number_to_send_to] | |
twilio_sid = "abc123" | |
twilio_token = "foobar" | |
twilio_phone_number = "6165555555" | |
@twilio_client = Twilio::REST::Client.new twilio_sid, twilio_token | |
@twilio_client.account.sms.messages.create( | |
:from => "+1#{twilio_phone_number}", | |
:to => number_to_send_to, | |
:body => "This is an message. It gets sent to #{number_to_send_to}" | |
) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Just ran across this old comment. The Ruby client is not (currently) thread-safe so it's probably better to keep it request scoped.