Login

A little Fone-Fu...


Posted: Mar 01, 2008 Tagged:

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... 

 
Fork me on GitHub