Skip to content

Instantly share code, notes, and snippets.

@dpick
Created April 19, 2012 02:22
Show Gist options
  • Save dpick/2417934 to your computer and use it in GitHub Desktop.
Save dpick/2417934 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'twitter'
require 'twilio-ruby'
last_tweet = Twitter.user_timeline("gglasstheatre").first.text
about_cascabel = last_tweet.include?("#Cascabel")
match = last_tweet.match(/(\d{3}-\d{3}-\d{4})/)
phone_number = match[0].gsub(/-/, '') if match
account_sid = ''
auth_token = ''
twilio_client = Twilio::REST::Client.new account_sid, auth_token
if about_cascabel && phone_number
puts "texting with number"
twilio_client.account.sms.messages.create(
:from => '',
:to => '',
:body => "call #{phone_number} to get your tickets to Cascabel"
)
else
puts "Tweet wasn't about tickets"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment