Skip to content

Instantly share code, notes, and snippets.

@jessieay
Created June 29, 2012 04:21
Show Gist options
  • Save jessieay/3015720 to your computer and use it in GitHub Desktop.
Save jessieay/3015720 to your computer and use it in GitHub Desktop.
sends text messages using twilio gem
require 'twilio-ruby'
class Texter
def initialize
@account_sid = 'xxx'
@auth_token = 'xxx'
@client = Twilio::REST::Client.new(@account_sid, @auth_token)
@from = 'xxx'
end
def sendSMS(to , body)
puts to
body_array=body.split('|')
body_array.slice!(5..-1)
body_array.each do |body|
@client.account.sms.messages.create(
:from =>@from,
:to => to,
:body => body
)
end
end
end
myText=Texter.new()
@me = 'xxx'
@ben = 'xxx'
myText.sendSMS(@ben, "testing testing | 123 ")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment