Sending and Recieving GVoice texts from the Command Line (uses node.js)

As many of you might know (or have guessed), I’ve taught myself most of what I know programming-wise.  Which means that if it’s an API or system I’m not familiar with, I’m usually ending up cobbling together or heavily modifying someone else’s work.

Which is why my github repository has ruby, python, bash, some virtual basic, and other stuff all crammed together.

Anyway, I used to use a nice little utility to forward all SMS messages from my phone to Google Talk/Jabber.  And then Google Talk became Hangouts and they broke the bridge.  So I started using Google Voice for text messages a lot more, since I could at least get and send them easily from my PC.

Except… the web interface sucks.  It’s resource heavy and doesn’t update well.

So I started searching for a commandline interface.  The ruby and python ones I found half-worked (at best) or weren’t focused on SMS.  And then I first found GV.  I’d never used node.js before, but GV fit the bill.

Except that it quickly stopped getting SMS properly.  I told the author, but he’s not gotten around to it yet.  So I started poking around with voice.js, which is what GV built off of.   And now I’ve managed to cobble together something that works pretty well for my purposes.

Features:

  • Uses the commandline
  • With the bash wrapper and ppl (optional) I can type sendsms.sh recipient my message goes here.
  • Optional replies within the get-sms script
  • Color-coding of to and from messages
  • Displays thread ID as well as phone number and time-date stamp.

My big TODOs?  Better PPL integration as well as GoogleCL lookup and integration.  And hopefully, since it’s on github, some folks who are better than I will actually be able to make the code cleaner.

Here’s the install instructions (the bash script will probably only work for you if you’re on *nix or OSX, sorry):

  • If you don’t already have node.js, you have to install it.  Sorry, I don’t know enough to translate a node.js program to another language.
  • Install the dependencies:  Once you have it installed, get voice.js by typing npm install voice.js .  While you’re there, also type npm install colors.js.
  • Get an authorization token:  Go to the examples for voice.js in the node modules directory (usually ~/node_modules/voice.js/examples).  Then edit tokens.js with your Google Voice login details. Run tokens.js from the /examples folder ( node ./tokens.js). It will save a tokens.json file in the /examples folder containing authentication tokens. Copy that tokens.js file to ~/node_modules/tokens.js.
  • Download my scripts:  They’re at , or you can directly download from .  Unzip it into ~/node_modules.
  • RTFM.  (It’s short)
  • Run the scripts.  The main one is get-sms.js (or if you want to keep it from being executable, type node ./get-sms.js ).  The default action is to get the last couple of unread text messages.  You can auto-mark messages read, change the number of threads and messages per thread, and even reply to a thread within the script itself with the optional –interactive commandline switch.
  • If you have ppl installed, there’s rudimentary support for using it to send texts.