Photo-1 Photo-2 Photo-3 Photo-4 Photo-5 Photo-6

@brentmc79

@brentmc79

Full-time web developer. Part-time smart ass.

I'm Brent Collier.

After a year and a half as an engineer on Twitter's Trust & Safety team, I'm looking for my next gig. Contact me if you know of something interesting.

#

A little Fone-Fu...

Posted on 03/01/2008

I ran across this post last night in which the writer was commenting on my friend Brendan's text messaging plugin, sms-fu.  He evidently had a problem with the typical plugin install method, so his workaround was basically to just move Brendan's code into his app. I was a little curious about this, so I thougt I'd give it a try...

First I created a new app to test with...

$ rails -d mysql smsapp

Then I installed sms-fu...

$ script/plugin install http://sms-fu.googlecode.com/svn/trunk/sms_fu

I generated a controller, model, and view...

$ script/generate scaffold sms number:string carrier:string message:string

Then all I had to do was update the create method in the controller like this..

def create
      sms = Sms.new(params[:sms])
      deliver_sms sms.number, sms.carrier, sms.message
      respond_to do |format|
        if sms.save
          flash[:notice] = 'Sms was successfully created.'
        end
      end
    end
    

That was pretty much all I needed, except for one more thing.  I need to actually be able to send the message, so I decided to use Gmail via the action_mailer_tls plugin that I found here on Daniel Fischer's blog.

Once I had the mail server setup, I fired up Mongrel, hit localhost:3000/sms/new, entered my info and viola!  Next thing I know my phone is beeping and my Verizon bill just got 5 cents bigger...