views:

1906

answers:

3

Q.: What web app architecture works well receiving/sending SMS text messages? By "architecture, I mean specific architecture, not generally, such as MVC.

Background: I'm building a web app that receives queries from/sends answers to cell phones. The app design (and business model) expects to communicate with cell devices via SMS text messages. IOW: There is no MVC web page "view". The cell phone screen is effectively the "view".

+2  A: 

This depends on how you will be receiving and sending the SMS messages.

There is a specific Short message protocol (SMPP - http://en.wikipedia.org/wiki/SMPP). For that you will need an SMPP server.

If you are using a one of the various SMS over HTTP providers (such as Clickatell - http://www.clickatell.com), then a web framework such as RoR is fine as both the sending and receiving of SMS messages are actually web requests. In this case your system view is the HTTP response to the gateway, not the cellphone screen. There are actually quite a few steps involved: Cellphone -> Cellular Network -> Gateway -> Your Service and the reply: Cellphone <- Cellular Network <- Gateway <- Your Service

Andrew
+3  A: 

I would question whether this is really a web application. If the view layer is SMS, you don't have to use the internet as a transport, you could use hardware to connect to the cell phone network.

If you are thinking of using a commercial http/sms gateway, there is a good article on using the Ruby Clicktell gem from a Rails application. Seems like a good route to try.

MattMcKnight
+1  A: 

I've made one of these before using rails. I created a budget tracker I could send commands to with my cell phone. I used it to create a list of items i needed to buy/take care of on the upcoming paycheck. When the check came in, I would send commands to mark each item off the list. I included commands to query a list as well. The commands looked something like "lc mar4" to create the fourth paycheck in march's budget list. Once a list was created, I could send commands without specifying the list and I made the script just apply the command to the last list if no list was specified and crunch down the other arguments. "la court 50 p" would add too the mar4 list an item named "court" with a value of 50 and a tag "p" which I called pending. When I took care of court that friday, I could send "lu court 50 d" which would update the court item with the same value with the tag "d" for done. I had a command called "lp" which would print the current list. "lp d" would print all the "d" tagged items on the current list. "lsum p" would print all the pending items on the current list.

I made an empty rails app. Made my database schema and my models but had no controllers. I had a script in scripts that included a pop/ssl library i found somewhere to download email from a gmail account i had setup for this. From then on it was pretty easy, just check the new messages for each message make sure it came from my cell phone and parse the message and optionally send back a response. (I had programmed that email address into my cellphone, and sent text commands to that email address). I added a cron job and set it to run every minute.

I don't know what that architecture is, but its basically a service that queries a 3rd party and does different things dependent on the response. If you did true SMS with shortcodes, I'll let you know now that I think there is a sizeable investment necessary to do those for real. Might be easier to start develop with email text messaging through sms gateways.

I'm not saying this is the best way to do it by far, It would have been cooler to have had the messages "pushed" to me instead of checking every minute, but hey I just wanted to balance my budget with my phone.