Send SMS messages via Google Voice using Ruby.
Install with:
gem install mechanize nokogiriSet the following environment variables before running:
| Variable | Description |
|---|---|
GV_USERNAME |
Your Gmail address (e.g. user@gmail.com) |
GV_PASSWORD |
Your Google account password |
GV_NUMBER |
Recipient phone number (e.g. 123-555-1212) |
GV_TEXT |
Message to send (defaults to Hello from Google Voice!) |
GV_USERNAME=user@gmail.com \
GV_PASSWORD=secret \
GV_NUMBER=123-555-1212 \
GV_TEXT="Your message here" \
ruby google_voice.rbOr use the class directly in your own code:
require_relative 'google_voice'
client = GoogleVoiceSMS.new('user@gmail.com', 'password')
client.send('123-555-1212', 'Hello!')This script relies on Google's ClientLogin API and the legacy Google Voice web interface, both of which have been deprecated. It may not work with current Google accounts. For a supported solution, consider the Google Voice API or a third-party SMS provider such as Twilio.