Last active
December 15, 2015 18:09
-
-
Save aspencer8111/5301947 to your computer and use it in GitHub Desktop.
A quick ruby script to send text msgs to my friends - uses twilio
This file contains hidden or 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
require 'rubygems' | |
require 'twilio-ruby' | |
account_sid = "<<>>" | |
auth_token = "<<>>" | |
client = Twilio::REST::Client.new account_sid, auth_token | |
from = "+<<>>" # Your Twilio number | |
# "Kile" => "+<<>>", | |
# "Cassie" => "+<<>>" | |
friends = { | |
"Alex" => "+<<>>", | |
"Brent" => "+<<>>", | |
"Keri" => "+<<>>", | |
"Karen" => "+<<>>" | |
} | |
puts "Who would you like to send a message to? Options are: Keri, Kile, Cassie, Brent, Karen, Alex, or ALL" | |
to = gets.chomp | |
puts "What would you like the message to be?" | |
message = gets.chomp | |
number = friends[to] | |
if to == "ALL" | |
friends.each do |friend| | |
client.account.sms.messages.create( | |
:from => from, | |
:to => friend[1], | |
:body => "#{message} - This is an automated text from a script written by Alex S. Twilio API :-)") | |
puts "Message has been sent to #{friend[0]}" | |
end | |
else | |
client.account.sms.messages.create( | |
:from => from, | |
:to => friends[to], | |
:body => "#{message} - This is an automated text from a script written by Alex S. Twilio API :-)") | |
puts "Message has been sent" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment