Secret Stanta Bot with Twilio

I've been meaning to run a secret santa gift exchange with my wife and my parents when we go to Florida to see them for Christmas. Unfortunately, it's difficult to do a Secret Santa when you're not all physically near one another. This seemed like a good opportunity for a simple SMS script using Twilio's APIs. The nice (and difficult to debug) thing about this process is that there's no way for the person running the Secret Santa to know who chose whomThis isn't technically true. In the Twilio user interface, you can look up the contents of your sent SMS messages in the ‘Programmable SMS Logs.’ Fortunately, you can quickly skim these logs to make sure all the messages were delivered without seeing what message was sent..

require 'twilio-ruby'

account_sid = 'ACCOUNT_SID'
auth_token = 'AUTH_TOKEN'
client =, auth_token)

from = '+3135551234' # Your Twilio number

# Just store your player names and phone numbers in here.
# It can handle as many or as few as you need.
players = {
    'Bob':      '+16125551231',
    'Jane':     '+17635551232',
    'Andrew':   '+16125551233',
    'Erica':    '+16125551234'

order = players.keys.shuffle

order.each_with_index do |person, i|
    receiver = order[i+1]
    receiver = order[0] if receiver.nil?
        from: from,
        to: players[person],
        body: "Hello #{person}, this is your Secret 
            Santa announcement. You'll be giving to 
            #{receiver} this year. Merry Christmas!"