Main menu

Send SMS Messages from Raspberry Pi

The back story to this article is pretty simple. I have a Raspberry Pi, what is a raspberry pi, it is one of those super small ARM computers that cost about $35 (more information on the raspberry pi can be found at raspberrypi.org). I use the Raspberry Pi to run Nagios and monitor my servers (a tutorial on that will be coming later). I wanted to be able to have my Raspberry Pi send me an SMS message should specific alert happen on my servers, but I really did not want to pay a SMS gateway for this luxury (email works find I would just prefer SMS). So I started looking for a solution. The following is how to text from computer allowing you to send a text message.

Step4: Create an Application Specific password.
Navigate to https://accounts.google.com/b/0/IssuedAuthSubTokens scroll to the bottom and in the name field put “Raspberry Pi” (or whatever other name you want to identify the device). Click on Generate password.

You will then be given a one-time use password.

Step5: Log into your Pi and open the terminal or SSH using Putty
Next cd to your home directory in my case its /home/pi

cd /home/pi

Step6: Clone the git repository.
First run the following command to prevent SSL errors:

export GIT_SSL_NO_VERIFY=1

Next run the following command to clone the git repository:

git clone https://github.com/korylprince/pygvoicelib.git

Step7: Authorize your Raspberry Pi with Google.
cd to the newly created folder pygvoicelib
run the following command:

python get_auth.py

You will be prompted for your Gmail account and your Application password you got in step 4. After entering the information you will see a number of variables show up in the terminal. Make note of the following variables you will need them in the next step:
username
apppass
auth_token
rnr_se

Step8: Create a script to send a text message.
Run the following command (you can use nano if you wish):

Ensure you are signed up completely for a United states google voice account. I have gotten feedback that it doesn’t work outside the US and possibly Canada. It is not Pi specific i also got it running on my CentOS server.

I have gotten feed back that it only works in the US and possibly in canada. A work around might be to setup a US Googlevoice for your cellphone and install the Googlevoice app then you would be able to get it.

I am trying to use this setup, but get a HTTP 404 error. After investigating further, i camme across Google site ,which said ClientLogin has been deprecated and that is the reason why I am getting 404 error. Did you update your code/steps to support OAuth as mentioned below:

Important: ClientLogin has been officially deprecated since April 20, 2012 and is now no longer available. Requests to ClientLogin will fail with a HTTP 404 response. We encourage you to migrate to OAuth 2.0 as soon as possible.