Matt's Life Bytes

Tag: code 20

Google Voice: {“ok”:false,”data”:{“code”:20}} and (500) Server Error

by Matthew Sullivan on Dec.29, 2009, under Google Voice Coding

So I’ve been coding away on Google Voice Easy SMS lately (a program to send free text messages via Google Voice). I’ve found out something the hard way, hopefully know someone else won’t have to!

When my app would try to send a message to Google, for some people Google would reply with:
{“ok”:false,”data”:{“code”:20}}

or…

{ok:false,data:{code:20}}

or…

(500) Server Error

So what was the problem? Read on. It gets technical from here, just FYI…


My app does this to SMS someone:

POST https://www.google.com/voice/sms/send/

auth=GOOGLE_AUTH_STRING&phoneNumber=PHONE_NUMBER_TO_SMS&text=MY MESSAGE&_rnr_se=GOOGLE_KEY

Google wants phoneNumber, text, and _rnr_se to be URL encoded. For instance ‘text=my message’ becomes ‘text=my%20message’. Most programming languages have some library or class already built to do the job automatically. If you want or need more details on that, just e-mail me.

My problem was that I was not URL encoding the value of _rnr_se and that causes Google to spew either one of the two errors mentioned above. In my defense, I thought the value of _rnr_se was always alphanumeric and therefore didn’t need URL encoding. It took me about 10 hours to figure out the problem; hopefully anyone else with that issue finds this post first!

4 Comments :, , , more...

Looking for something?

Use the form below to search the site: