SMS Fu – Quickly & Easily Send Text Messages

Having had to develop apps that relied on the ability to send text messages to members, I thought that it would be a good idea to turn some of that functionality into a plugin that would be easy to use. SMS Fu gives you the ability to be able to send text messages from your Rails app in less than five minutes. There’s no third-party gateway needed, as the phone number is converted into an e-mail address, which makes it deliverable to any phone.

Installation

git clone git://github.com/brendanlim/sms-fu.git vendor/plugins/sms_fu

Usage

Supported Carriers: Alltel, Ameritech, AT&T, BellSouth Mobility, BlueSkyFrog, Boost Mobile, Cellular South, Fido, Metro PCS, PSC Wireless, Qwest, Southern Link, Sprint, Suncom, T-Mobile (US/UK/Germany), Virgin Mobile, Verizon Wireless, Vodafone (UK,Italy,Japan)

To use SMS Fu, all you have to do is include SMS Fu in one of your controllers.

class ExampleController < ApplicationController   include SMSFu end

After this, go to /config/sms_fu.yml to change the default reply-to address with your own.

Phone numbers must not include any non-numeric characters, with the exception of ‘+’ for International numbers. The three required parameters are the phone number, carrier, and the message itself. To find out just what you need to pass for the carrier, check the yaml file. The one line below will deliver a nice ‘Hello World!’ straight to your phone.

deliver_sms("5555555555","AT&T","Hello World!")

Since most non smart-phones only support up to 128 characters, you’re allowed to specify a limit to truncate the message delivered.

deliver_sms("5555555555","AT&T","Really long message ...", :limit => 128)

If you feel like rolling your own mailer, and not using SMS Fu to handle this, you can retrieve the the converted e-mail address for the phone number and carrier supplied.

get_sms_address("5555555555","AT&T")

That’s all there is to it! If you want to add your own carriers, just edit sms_fu.yml.