The information on how to directly interact with Google Voice in your own program is available all over the web, though not always in a form that is directly consumable to managed developers. Most of the information targets developers that are creating scripts for their server. The best information source that I cam across was documentation on a FireFox add-in for Google Voice. It listed all of the URLs and messages that must be sent to invoke the Google Voice functionality. You can find it here http://posttopic.com/topic/google-voice-add-on-development
Retrieving information from Google Voice is easy. Log into your google voice account (so that you are authenticated) and then open the URL https://www.google.com/voice/inbox/recent/inbox/. You will get back a cryptic looking text file, but if you look closly at the text file you see that it contains information that is recognizable; it has the contents of your inbox. The information for the other folders and Google Voice data can be retrieved in a similar manner. A program only needs to parse this data and present it to the user in an acceptable form.
The more interesting functionality is sending an SMS or initiating a call. To send an SMS information must be posted to the address http://google.com/voice/sms/send/. The information that must be posted includes the following fields:
| id |
leave blank |
| phoneNumber |
the number to which the SMS is to be sent |
| text |
the message, URL encoded |
| _rnr_se |
I don't know what this is, I only know what goes here |
The last field demands further explanation. A string value goes here. I believe the string value to be specific to user IDs. As far as I can tell this string value will remain the same across sessions for a specific user ID. To get the value that must be used with your ID navigate to http://google.com/voice/m and log into your account. After you are logged in view the source code of the page and search for "_rnr_se". You will find a hiddden field of this name containing the text value to be used for your id.
If you were to wrap up all of this information into a POST request to the Google voice server it is going to fail with error code 407. That means you are authorized to get to the page. You need to pass your Google Voice user ID and password with the POST request. Chances are your request will fail again. It took me a while to figure out what was going on. But the Google Voice service will send a session Cookie after you are logged in and this cookie must be passed back in ever request.
Once I figured out the cookie was needed I put together a quick .Net program and ran it on a phone that only has a WIFI connection. It was able to successfully send SMS messages. Sorry, I can't share the source code because I hard coded some of the information in my program. But the above should be well more than enough information for some one to write their own Google Voice application.
Tags: