Mass Texting (SMS) Messaging Via Google Voice And Python

Get the files from Gist:

https://gist.github.com/motiondesignstudio/8589412

How to install.

Using the commandline type the following commands.

Install Python

sudo aptitude install python3.1

cd /tmp

Install Mercurial Source Code Manager

sudo aptitude install mercurial

Download The Python Google Voice Source

hg clone https://code.google.com/r/bwpayne-pygooglevoice-auth-fix/ pygooglevoice/
cd pygooglevoice
hg pull
hg update

Build And Install Python Google Voice

python setup.py install

Test Python Google Voice

$ gvoice -e yourname@gmail.com
Password:
gvoice> call
Outgoing number: 18004664411
Forwarding number: 19175555555
Calling…

You need two files for this to work in the same directory. The Python code and a list of phone numbers example “phone_numbers.txt”. This file is included in the download.

Create a file named “google_voice_sms.py” and store the code from below in it making it executable by doing the following.

chmod a+x google_voice_sms.py

Example Usage:  ./google_voice_sms.py mygmailaccount@gmail.com mypassword phone_numbers.txt “Test SMS”

#!/usr/bin/env python

import sys

from googlevoice import Voice
from googlevoice.util import input

sys.dont_write_bytecode = True
username=str(sys.argv[1]).strip()
password=str(sys.argv[2]).strip()
phone_numbers=str(sys.argv[3]).strip()
the_message=str(sys.argv[4]).strip()

print “user name:” , username
print “password:” , password
print “phone_numbers:” , phone_numbers
print “the_message:” , the_message

voice = Voice()
voice.login(username, password)

def send_mass_text():
with open(phone_numbers, ‘r’) as inF:
for this_phone_number in inF:
voice.send_sms(this_phone_number, the_message)

send_mass_text ()

This entry was posted in Computer programming, Linux, Python and tagged , , , , , , , . Bookmark the permalink.

3 Responses to Mass Texting (SMS) Messaging Via Google Voice And Python

  1. Np says:

    Google rate limits

  2. Pingback: Auto Texter – send random SMS using Python and Google Voice API – spilt

  3. Thanks for the sweet post! it Helped me out a lot!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s