How to Use Twilio to Send an SMS

I wrote about liking Twilio's UI not too long ago. Unfortunately the actual usability of their API isn't quite as sharp.

Signing up was straightforward enough, but beyond that things got incredibly murky. All I want is to be able to send an SMS from my app; I don't really care about anything else. 

The examples provided for ruby don't detail this, but fortunately I stumbled around long enough to figure it out.

First, you need to register the phone number you will be sending the SMSes to (this limitation is only for the developer trial period, I believe). Under "My Outgoing CallerID Numbers" section click the "Add Caller ID" button. This will prompt you for a phone number. Enter yours, and it will present you with a PIN and call the number entered. Pick up the call when it rings and enter the PIN when prompted.

Next grab the helper library over here. I did this in Ruby, so just extract the zip and get 'twiliolib.rb' from the 'lib' folder. For a simple test I wrote the following script:
require 'twiliolib.rb'

# your Twilio authentication credentials
ACCOUNT_SID = 'xxx' # these are on your account page
ACCOUNT_TOKEN = 'xxx'
 
# version of the Twilio REST API to use
API_VERSION = '2010-04-01'

account = Twilio::RestAccount.new(ACCOUNT_SID, ACCOUNT_TOKEN)

d = {
    'From' => '415-599-2671',
    'To' => '480-555-1234', # this is the number you registered
    'Body' => 'This is an SMS Test',
}

resp = account.request("/#{API_VERSION}/Accounts/#{ACCOUNT_SID}/SMS/Messages",
    'POST', d)
    
resp.error! unless resp.kind_of? Net::HTTPSuccess
puts "code: %s\nbody: %s" % [resp.code, resp.body]
The key here is that the 'From' number is the Sandbox Phone Number listed on your account dashboard, and the 'To' number is the one you registered up above. Any other numbers will not work. Don't forget to put in your ACCOUNT_SID and ACCOUNT_TOKEN too, those are also on the dashboard.

Fire up your console and run the script. If you see a bunch of XML and a 'code: 201' returned, you should be receiving and SMS shortly. If you see a '400 "Bad Request" (Net::HTTPServerException)' error, then double check that the From and To numbers are right.

This information is buried and I was very close to just throwing my hands up and looking elsewhere. If you are writing an application, these details are critical.

Yeah this is what I wanted to see at espn.com

MacBook Pro Likes & Dislikes

About a month ago I picked up the basic 13" MacBook Pro. My primary intent was that I needed a non-Windows portable for rails development1. Overall, I really like it, and these are just my thoughts about it. First the bad things:

Bad
  • The Resolution. The iPhone 4's resolution is more than half of the laptop's 1280x800 pixels. Apple has always had crappy resolutions on their notebooks (unless you're shelling out more than $2k).
  • The keyboard is weird. No right-control, no forward delete, no page-up, page-down, home, or end. There are workarounds, but I miss those guys. This is also keeping me from getting the bluetooth keyboard; same layout.
  • Slooooow hard drive. On the 13" it was either a 5400rpm one or an expensive solid state. And the store didn't have and SSD ones on hand.
Good
  • The trackpad. I've never been a huge fan of trackpads, but I'm really digging this one. I don't know if it's because this trackpad is huge, or the multi-touch capabilities (or both), but I only miss a mouse when needing finer cursor management.
  • The battery. It lasts between 6-8 hours, easy. How do you not like that? Some people whine about the lack of an interchangable battery, but I don't care about that.
  • Construction. I think the quality of the build is just ridiculous. The iMac is good, but this feels better. I get a feeling that Apple cares a little more about their line of notebooks than their desktops. It's also pretty light, to the point that I wonder if the MacBook Air would be worth it.

  1. One thing I've noticed is that running Lightroom and Photoshop is just ridiculously slow on both this and my iMac, but programming is pleasurable. Isn't that backwards? Macs are for creative fluff and PCs are for coding...

Nice Idea via Neven Mrgan

From Shawn Blanc's terrific interview with him:

We love a good visual metaphor — Coda’s taped pages in the Sites view — but it has to make sense, and it can’t be realistic at the expense of usability, or to the point of sickening cuteness.

MSDN's Header Graphic

I've been to MSDN a few times since they redesigned it, and didn't notice the title graphic until now. I like that they're embracing the Crazy Ballmer dance now.

Good Copy - FogCreek

Was perusing the listings at StackOverflow's careers page, and saw FogCreek's posting. FogCreek has always sounded like a pretty great place to work, but that last benefit is definitely the best one.

Good UI - More Wufoo

There's lots to love about Wufoo's UI. Their writing style is laid back, but still designed well; it just makes their app feel 'fun'.

   
Click here to download:
Good_UI_-_More_Wufoo.zip (50 KB)

Nice UI: Dash of Milk's Signup

Via ember. The de factor way of doing things is usually vertical. Logo, above a text blurb, above a form. I like how this is more horizontal.

UI That Needs Work

Costco's photo uploader, while efficient is... confused.

I'm guessing the UI is supposed to feel like your OS's... but it's obviously a crappy Java based guess at the Windows file dialog. And I'm uploading from a mac, so it feels even weirder.

All that work

I'm using the awesome Paperclip plugin in my rails app. One of the great selling points for it is that it will automatically resize images and create thumbnails for them. To do this, it needs the ImageMagick library installed.

No worries, I headed over to their site and saw that the "best" way to install it is via mac ports, a package manager similar to Debian's apt, but for OS X. 

So I headed over there, and downloaded the 100k installer for that. Only to see that it needed XCode as a dependency, roughly a 1 GB install.

sigh

So, I broke out the system DVD and installed XCode. And then mac ports. And then ImageMagick. Just so that I could resize an image programatically. 

About

These are my mostly unfiltered thoughts.