SlideShare a Scribd company logo
Mobilize  Your Rails Application Brendan Lim e-mail:  [email_address]   twitter:  @brendanlim
 
Why care about  mobile There’s an estimated 2.9 billion mobile users Over 255 million mobile users in the U.S.  In developing nations, a mobile phone is sometimes their only way to connect to the Internet
Some  mobile  stats (in billions of course)
So, how do we take advantage of this?
Make your application accessible by the majority of   web enabled   mobile  devices devices devices
Keep your users engaged through  SMS ,  MMS   and  E-Mail E-Mail
Many  Mobile  Devices Can Access the Real Web From Flickr User Carlos Magaña
One Web Making the same information and services available to all users regardless of the device used Making the same information and services available to all users regardless of the device used
Max resolution? JavaScript? Flash? Connection speed? Processor speed? Problems with  one web
Mobile Fu  Plugin Can detect if a user is on a mobile device Ability to add custom styling based on the device’s user agent Gives you some tools to make the concept of  one web  easier to achieve
How does one master  mobile  fu?
Not   Like This ...
Maybe   Like This ...
class ApplicationController < ActionController::Base  has_mobile_fu end end
demo. presentlyapp.com iPhone Safari
respond_to  do | format | format.html format.mobile end views/ layouts application.html.erb application.mobile.erb sessions new.html.erb new.mobile.erb
<%= mobile_xhtml_doctype %> <html> <head> ... </head> <body> ... </body> </html> </html> ../layouts/ application.mobile.erb http://mobiforge.com/designing/story/comparison-xhtml-mobile-profile-and-xhtml-basic
<?xml version=&quot;1.0&quot; charset=&quot;UTF-8&quot; ?> <!DOCTYPE html PUBLIC &quot;-//WAPFORUM//DTD XHTML Mobile 1.0//EN&quot; &quot; http://www.wapforum.org/DTD/xhtml-mobile10.dtd &quot;> <html> <head> ... </head> <body> ... </body> </html> </html> ../layouts/ application.mobile.erb http://mobiforge.com/designing/story/comparison-xhtml-mobile-profile-and-xhtml-basic
Is the user using a specific device? is_device?( ‘blackberry’ ) Is the user using a mobile device? is_mobile_device? Is the request format currently :mobile ? in_mobile_view?
iPhone   foo_ mobilewebkit .css  <%= stylesheet_link_tag 'foo' %> Android   foo_ mobilewebkit .css  BlackBerry   foo_ blackberry .css  Win Mobile   foo_ mobileexplorer .css  etc...
 
What about leveraging other  mobile   technologies ?
SMS Short Message Service Short Message Service
Keep Users Informed with  SMS Text messages are read by about 94% of their recipients. Supported by almost all mobile phones out there Good for quick notifications Generally limited to 160 characters Relatively easy to leverage
What tools can we use to send  SMS  messages from our Rails application?
Clickatell  Gem Paid solution Uses Clickatell’s API Currently $0.043 per text message sent within the U.S. No need to know the recipient’s carrier
api  =  Clickatell::API.authenticate(' your_api_id ',  ' your_username ', ' your_password ') api.send_message(' 5558675309 ', ' Hello from clickatell ') require 'clickatell'
SMS Fu  Plugin Doesn’t cost the sender anything Leverages ActionMailer to send a  text message You need to know the recipient’s carrier Not as many supported carriers as Clickatell
Wait, it’s free? So how does it work?
Number:  555-867-5309 5558675309 @ vtext.com Carrier:  Verizon
deliver_sms(‘ 5558675309 ’,‘ verizon ’, ‘ hello! ’) class AwesomeController < ApplicationController  has_sms_fu end end
Some  SMS  Fu Carriers Alltell, Ameritech, AT&T, Bell South Mobility, BlueSkyFrog, Boost Mobile, Cellular South, Kajeet, Metro PCS, Powertel, PSC Wireless, Qwest, Southern Link, Spring, Rodgers, Suncom, T-Mobile, Virgin Mobile, Verizon Wireless ,  E-Plus, O2, Orange,  Telconica, Vodafone ...
What if I want to add a new carrier called  Ruby Mobile ?
carriers: ... ruby_mobile:  name: Ruby Mobile  value: @txt.rubymobile.com  Add the following to   .../config/sms_fu.yml deliver_sms(‘ 5558675309 ’,’ ruby_mobile ’, ‘ hello! ’)
Remind Your Users That They May Get Charged from flickr user ‘bowbrick’
MMS Multimedia Message Service Multimedia Message Service
MMS Can send photo, video, audio or other attachments Most commonly used for photos Attachment size limitation generally dependent on device Multipart MIME
The Problem with Receiving  MMS Crap Crap Crap Cat
Well, how can I receive  SMS  or  MMS  from my Rails app ?
Short Codes Special numbers that are, you guessed it, short, that can be used to receive SMS or MMS messages from mobile phones. Special numbers that are, you guessed it, short, that can be used to receive SMS or MMS messages from mobile phones.
 
Short Codes Also referred to as short numbers MMS support added in this year Crazy Expensive Monthly fees up to $1000/mo Setup fees close to $5000 Many companies share short codes
Receiving  SMS  or  MMS  as an e-mail is another solution and its free and relatively simple
MMS2R  Gem Removes carrier advertising Eliminates carrier default text Decodes and extracts intended files from the multipart MIME e-mail Most major carriers are supported
Retrieve only the intended attachment mms.default_media Retrieve all media files from the MMS mms.media Retrieve only the intended message mms.body Create a new MMS2R object from a TMail object mms =   MMS2R::Media.new(email)
require ‘ mms2r ’ class   MailReceiver  <  ActionMailer::Base def   receive (email) begin # load the TMail object into an MMS2R::Media object mms =  MMS2R::Media .new(email) # grab a user on record by the e-mail it was sent from user =  User .find_by_email(mms.from) # store the body of the mms into a new BlogPost blog_post =  BlogPost .create(: body  => mms.body, : user  => user,  : title  => mms.subject) # grab the attachment from the mms message media = mms.default_media # store the attachment from mms into a BlogPhoto BlogPhoto .create(: uploaded_data  => media, : blog_post  => blog_post) if media.content_type.include?(‘ image ’) ensure # cleans up temporary files used for text and attachments mms.purge end end end
require ‘ mms2r ’ class   MailReceiver  <  ActionMailer::Base def   receive (email) begin # load the TMail object into an MMS2R::Media object mms =  MMS2R::Media . new (email) # grab a user on record by the e-mail it was sent from user =  User .find_by_email(mms.from) # store the body of the mms into a new BlogPost blog_post =  BlogPost .create(: body  => mms.body, : user  => user,  : title  => mms.subject) # grab the attachment from the mms message media = mms.default_media # store the attachment from mms into a BlogPhoto BlogPhoto .create(: uploaded_data  => media, : blog_post  => blog_post) if media.content_type.include?(‘ image ’) ensure # cleans up temporary files used for text and attachments mms.purge end end end
require ‘ mms2r ’ class   MailReceiver  <  ActionMailer::Base def   receive (email) begin # load the TMail object into an MMS2R::Media object mms =  MMS2R::Media .new(email) # grab a user on record by the e-mail it was sent from user =  User .find_by_email( mms.from ) # store the body of the mms into a new BlogPost blog_post =  BlogPost .create(: body  => mms.body, : user  => user,  : title  => mms.subject) # grab the attachment from the mms message media = mms.default_media # store the attachment from mms into a BlogPhoto BlogPhoto .create(: uploaded_data  => media, : blog_post  => blog_post) if media.content_type.include?(‘ image ’) ensure # cleans up temporary files used for text and attachments mms.purge end end end
require ‘ mms2r ’ class   MailReceiver  <  ActionMailer::Base def   receive (email) begin # load the TMail object into an MMS2R::Media object mms =  MMS2R::Media .new(email) # grab a user on record by the e-mail it was sent from user =  User .find_by_email(mms.from) # store the body of the mms into a new BlogPost blog_post =  BlogPost .create(: body  =>  mms.body ,  : user  => user, : title  =>  mms.subject ) # grab the attachment from the mms message media = mms.default_media # store the attachment from mms into a BlogPhoto BlogPhoto .create(: uploaded_data  => media, : blog_post  => blog_post) if media.content_type.include?(‘ image ’) ensure # cleans up temporary files used for text and attachments mms.purge end end end
require ‘ mms2r ’ class   MailReceiver  <  ActionMailer::Base def   receive (email) begin # load the TMail object into an MMS2R::Media object mms =  MMS2R::Media .new(email) # grab a user on record by the e-mail it was sent from user =  User .find_by_email(mms.from) # store the body of the mms into a new BlogPost blog_post =  BlogPost .create(: body  => mms.body, : user  => user,  : title  => mms.subject) # grab the attachment from the mms message media = mms. default_media # store the attachment from mms into a BlogPhoto BlogPhoto .create(: uploaded_data  => media, : blog_post  => blog_post) if media.content_type.include?(‘ image ’) ensure # cleans up temporary files used for text and attachments mms.purge end end end
require ‘ mms2r ’ class   MailReceiver  <  ActionMailer::Base def   receive (email) begin # load the TMail object into an MMS2R::Media object mms =  MMS2R::Media .new(email) # grab a user on record by the e-mail it was sent from user =  User .find_by_email(mms.from) # store the body of the mms into a new BlogPost blog_post =  BlogPost .create(: body  => mms.body, : user  => user,  : title  => mms.subject) # grab the attachment from the mms message media = mms.default_media # store the attachment from mms into a BlogPhoto BlogPhoto .create(: uploaded_data  =>  media , : blog_post  => blog_post) if  media . content_type .include?(‘ image ’) ensure # cleans up temporary files used for text and attachments mms.purge end end end
require ‘ mms2r ’ class   MailReceiver  <  ActionMailer::Base def   receive (email) begin # load the TMail object into an MMS2R::Media object mms =  MMS2R::Media .new(email) # grab a user on record by the e-mail it was sent from user =  User .find_by_email(mms.from) # store the body of the mms into a new BlogPost blog_post =  BlogPost .create(: body  => mms.body, : user  => user,  : title  => mms.subject) # grab the attachment from the mms message media = mms.default_media # store the attachment from mms into a BlogPhoto BlogPhoto .create(: uploaded_data  => media, : blog_post  => blog_post) if media.content_type.include?(‘ image ’) ensure # cleans up temporary files used for text and attachments mms. purge end end end
Adding new templates for carriers is easy --- ignore:    image / gif:     -  top.gif    -  bottom.gif    -  middle_img.gif    text / html:      -   /< html > \s +< head > \s +< meta http - equiv = \&quot;Content-Type \&quot; content=\&quot;text\/html; charset=iso-8859-1\&quot;>\s+<title>MMS Email<\/title>/im transform:     text / plain:     -   -   / Note:\s{1,2}. *? \s + message:\s{1,2}(. + )$ / m      -  &quot;\1&quot; conf/mms.myhelio.com.yml
Mobilizing  your Rails app is simple and easy
Mobile Fu http://github.com/brendanlim/mobile-fu/ Clickatell http://clickatell.rubyforge.org/ SMS Fu http://github.com/brendanlim/sms-fu/ MMS2R http://github.com/monde/mms2r/
Questions!

More Related Content

Viewers also liked (20)

PPS
Woman De John Lennon
MISANTLA
 
PPS
24 Tirthankaras
Heena Modi
 
PPTX
ICC/Decision Services...Beyond Customer Service...What Mystery Shopping Can D...
Twig Lane Group, LLC
 
PDF
Developing a Collective Curriculum to make Civil Society Data Literate
Pim Bellinga
 
PPT
The gorgeous pearl
Heena Modi
 
PPS
Father
Heena Modi
 
PPTX
Ph.D. Registeration seminar
Haitham El-Ghareeb
 
PPT
Buffalo Social Media Summit Presentation
Chris Treadaway
 
PPT
Biggie in her new home
Heena Modi
 
PPT
Some highlights from my stay in gambia
Heena Modi
 
PPS
Heart diseases
Heena Modi
 
PPT
Poonam and jaimin’s wedding day
Heena Modi
 
PPT
Fear Factor with Outsourcing
Benaud Jacob
 
PPT
Spc. La Llegenda De Sant Jordi
MOBRADO
 
PPT
Linked In Presentation
Benaud Jacob
 
PPT
Phrases By Gabriel GarcíA MáRquez
Heena Modi
 
PPT
Power Video
MH Rubin
 
PPT
Wordprobs3
Heena Modi
 
PPT
Kansas sights
lorie.schaller
 
PPS
Indian Art
Heena Modi
 
Woman De John Lennon
MISANTLA
 
24 Tirthankaras
Heena Modi
 
ICC/Decision Services...Beyond Customer Service...What Mystery Shopping Can D...
Twig Lane Group, LLC
 
Developing a Collective Curriculum to make Civil Society Data Literate
Pim Bellinga
 
The gorgeous pearl
Heena Modi
 
Father
Heena Modi
 
Ph.D. Registeration seminar
Haitham El-Ghareeb
 
Buffalo Social Media Summit Presentation
Chris Treadaway
 
Biggie in her new home
Heena Modi
 
Some highlights from my stay in gambia
Heena Modi
 
Heart diseases
Heena Modi
 
Poonam and jaimin’s wedding day
Heena Modi
 
Fear Factor with Outsourcing
Benaud Jacob
 
Spc. La Llegenda De Sant Jordi
MOBRADO
 
Linked In Presentation
Benaud Jacob
 
Phrases By Gabriel GarcíA MáRquez
Heena Modi
 
Power Video
MH Rubin
 
Wordprobs3
Heena Modi
 
Kansas sights
lorie.schaller
 
Indian Art
Heena Modi
 

Similar to Mobilizing Your Rails Application - LA Ruby Conference 2009 (20)

KEY
Mobilizing Your Rails Application - Rails Underground, London, UK
Brendan Lim
 
PPTX
Action Mailer
SHC
 
PDF
Rails 3 Beginner to Builder 2011 Week 6
Richard Schneeman
 
KEY
Email Interfaces for your Ruby Applications
David Eisinger
 
KEY
Itch Scratching
RubyX
 
PPT
Email Contacts For Invitation
Richard Huang
 
PPT
MMS Parser
mamahow
 
PDF
Asynchronous sms messaging with Ruby
Vangelis Typaldos
 
KEY
Sending Email with Rails
James Gray
 
PDF
Rails Awesome Email
imedo.de
 
PPTX
Exchange Server 2013 Architecture Deep Dive, Part 2
Microsoft TechNet - Belgium and Luxembourg
 
PPTX
Mobile Art && Code - Camura
Marty McGuire
 
PDF
When To Use Ruby On Rails
dosire
 
PDF
GUADEC2007: A Modest Email Client
djcb
 
PDF
Contributing to OSS in a commercial non-OSS environment
Funambol
 
PDF
My First Ruby
Murray Steele
 
PDF
Massive emailing with Linux, Postfix and Ruby on Rails
ibelmonte
 
PDF
Integrating Flex And Rails With Ruby Amf
railsconf
 
PDF
Flex With Rubyamf
Tony Hillerson
 
PDF
Hard-Won Lessons In Responsive Email Design - SmashingConf Oxford 2014
Fabio Carneiro
 
Mobilizing Your Rails Application - Rails Underground, London, UK
Brendan Lim
 
Action Mailer
SHC
 
Rails 3 Beginner to Builder 2011 Week 6
Richard Schneeman
 
Email Interfaces for your Ruby Applications
David Eisinger
 
Itch Scratching
RubyX
 
Email Contacts For Invitation
Richard Huang
 
MMS Parser
mamahow
 
Asynchronous sms messaging with Ruby
Vangelis Typaldos
 
Sending Email with Rails
James Gray
 
Rails Awesome Email
imedo.de
 
Exchange Server 2013 Architecture Deep Dive, Part 2
Microsoft TechNet - Belgium and Luxembourg
 
Mobile Art && Code - Camura
Marty McGuire
 
When To Use Ruby On Rails
dosire
 
GUADEC2007: A Modest Email Client
djcb
 
Contributing to OSS in a commercial non-OSS environment
Funambol
 
My First Ruby
Murray Steele
 
Massive emailing with Linux, Postfix and Ruby on Rails
ibelmonte
 
Integrating Flex And Rails With Ruby Amf
railsconf
 
Flex With Rubyamf
Tony Hillerson
 
Hard-Won Lessons In Responsive Email Design - SmashingConf Oxford 2014
Fabio Carneiro
 
Ad

More from Brendan Lim (6)

PDF
Developing Cocoa Applications with macRuby
Brendan Lim
 
KEY
Introduction to Palm's Mojo SDK
Brendan Lim
 
PDF
Building Native Apps With Titanium Mobile
Brendan Lim
 
PDF
Im Mobile Who's Coming With Me
Brendan Lim
 
ZIP
MacRuby to The Max
Brendan Lim
 
KEY
The Lure Of Ubiquitous Mobile
Brendan Lim
 
Developing Cocoa Applications with macRuby
Brendan Lim
 
Introduction to Palm's Mojo SDK
Brendan Lim
 
Building Native Apps With Titanium Mobile
Brendan Lim
 
Im Mobile Who's Coming With Me
Brendan Lim
 
MacRuby to The Max
Brendan Lim
 
The Lure Of Ubiquitous Mobile
Brendan Lim
 
Ad

Recently uploaded (20)

PDF
Windsurf Meetup Ottawa 2025-07-12 - Planning Mode at Reliza.pdf
Pavel Shukhman
 
PDF
SWEBOK Guide and Software Services Engineering Education
Hironori Washizaki
 
PDF
NewMind AI - Journal 100 Insights After The 100th Issue
NewMind AI
 
PDF
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
PDF
Human-centred design in online workplace learning and relationship to engagem...
Tracy Tang
 
PDF
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
PDF
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PPT
Interview paper part 3, It is based on Interview Prep
SoumyadeepGhosh39
 
PPTX
Top iOS App Development Company in the USA for Innovative Apps
SynapseIndia
 
PDF
Why Orbit Edge Tech is a Top Next JS Development Company in 2025
mahendraalaska08
 
PDF
Persuasive AI: risks and opportunities in the age of digital debate
Speck&Tech
 
PDF
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
PPTX
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
PDF
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
PDF
TrustArc Webinar - Data Privacy Trends 2025: Mid-Year Insights & Program Stra...
TrustArc
 
PDF
Blockchain Transactions Explained For Everyone
CIFDAQ
 
PDF
Predicting the unpredictable: re-engineering recommendation algorithms for fr...
Speck&Tech
 
PDF
The Builder’s Playbook - 2025 State of AI Report.pdf
jeroen339954
 
PDF
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
PDF
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
Windsurf Meetup Ottawa 2025-07-12 - Planning Mode at Reliza.pdf
Pavel Shukhman
 
SWEBOK Guide and Software Services Engineering Education
Hironori Washizaki
 
NewMind AI - Journal 100 Insights After The 100th Issue
NewMind AI
 
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
Human-centred design in online workplace learning and relationship to engagem...
Tracy Tang
 
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
Interview paper part 3, It is based on Interview Prep
SoumyadeepGhosh39
 
Top iOS App Development Company in the USA for Innovative Apps
SynapseIndia
 
Why Orbit Edge Tech is a Top Next JS Development Company in 2025
mahendraalaska08
 
Persuasive AI: risks and opportunities in the age of digital debate
Speck&Tech
 
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
TrustArc Webinar - Data Privacy Trends 2025: Mid-Year Insights & Program Stra...
TrustArc
 
Blockchain Transactions Explained For Everyone
CIFDAQ
 
Predicting the unpredictable: re-engineering recommendation algorithms for fr...
Speck&Tech
 
The Builder’s Playbook - 2025 State of AI Report.pdf
jeroen339954
 
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 

Mobilizing Your Rails Application - LA Ruby Conference 2009

  • 1. Mobilize Your Rails Application Brendan Lim e-mail: [email_address] twitter: @brendanlim
  • 2.  
  • 3. Why care about mobile There’s an estimated 2.9 billion mobile users Over 255 million mobile users in the U.S. In developing nations, a mobile phone is sometimes their only way to connect to the Internet
  • 4. Some mobile stats (in billions of course)
  • 5. So, how do we take advantage of this?
  • 6. Make your application accessible by the majority of web enabled mobile devices devices devices
  • 7. Keep your users engaged through SMS , MMS and E-Mail E-Mail
  • 8. Many Mobile Devices Can Access the Real Web From Flickr User Carlos Magaña
  • 9. One Web Making the same information and services available to all users regardless of the device used Making the same information and services available to all users regardless of the device used
  • 10. Max resolution? JavaScript? Flash? Connection speed? Processor speed? Problems with one web
  • 11. Mobile Fu Plugin Can detect if a user is on a mobile device Ability to add custom styling based on the device’s user agent Gives you some tools to make the concept of one web easier to achieve
  • 12. How does one master mobile fu?
  • 13. Not Like This ...
  • 14. Maybe Like This ...
  • 15. class ApplicationController < ActionController::Base has_mobile_fu end end
  • 17. respond_to do | format | format.html format.mobile end views/ layouts application.html.erb application.mobile.erb sessions new.html.erb new.mobile.erb
  • 18. <%= mobile_xhtml_doctype %> <html> <head> ... </head> <body> ... </body> </html> </html> ../layouts/ application.mobile.erb http://mobiforge.com/designing/story/comparison-xhtml-mobile-profile-and-xhtml-basic
  • 19. <?xml version=&quot;1.0&quot; charset=&quot;UTF-8&quot; ?> <!DOCTYPE html PUBLIC &quot;-//WAPFORUM//DTD XHTML Mobile 1.0//EN&quot; &quot; http://www.wapforum.org/DTD/xhtml-mobile10.dtd &quot;> <html> <head> ... </head> <body> ... </body> </html> </html> ../layouts/ application.mobile.erb http://mobiforge.com/designing/story/comparison-xhtml-mobile-profile-and-xhtml-basic
  • 20. Is the user using a specific device? is_device?( ‘blackberry’ ) Is the user using a mobile device? is_mobile_device? Is the request format currently :mobile ? in_mobile_view?
  • 21. iPhone foo_ mobilewebkit .css <%= stylesheet_link_tag 'foo' %> Android foo_ mobilewebkit .css BlackBerry foo_ blackberry .css Win Mobile foo_ mobileexplorer .css etc...
  • 22.  
  • 23. What about leveraging other mobile technologies ?
  • 24. SMS Short Message Service Short Message Service
  • 25. Keep Users Informed with SMS Text messages are read by about 94% of their recipients. Supported by almost all mobile phones out there Good for quick notifications Generally limited to 160 characters Relatively easy to leverage
  • 26. What tools can we use to send SMS messages from our Rails application?
  • 27. Clickatell Gem Paid solution Uses Clickatell’s API Currently $0.043 per text message sent within the U.S. No need to know the recipient’s carrier
  • 28. api = Clickatell::API.authenticate(' your_api_id ', ' your_username ', ' your_password ') api.send_message(' 5558675309 ', ' Hello from clickatell ') require 'clickatell'
  • 29. SMS Fu Plugin Doesn’t cost the sender anything Leverages ActionMailer to send a text message You need to know the recipient’s carrier Not as many supported carriers as Clickatell
  • 30. Wait, it’s free? So how does it work?
  • 31. Number: 555-867-5309 5558675309 @ vtext.com Carrier: Verizon
  • 32. deliver_sms(‘ 5558675309 ’,‘ verizon ’, ‘ hello! ’) class AwesomeController < ApplicationController has_sms_fu end end
  • 33. Some SMS Fu Carriers Alltell, Ameritech, AT&T, Bell South Mobility, BlueSkyFrog, Boost Mobile, Cellular South, Kajeet, Metro PCS, Powertel, PSC Wireless, Qwest, Southern Link, Spring, Rodgers, Suncom, T-Mobile, Virgin Mobile, Verizon Wireless , E-Plus, O2, Orange, Telconica, Vodafone ...
  • 34. What if I want to add a new carrier called Ruby Mobile ?
  • 35. carriers: ... ruby_mobile: name: Ruby Mobile value: @txt.rubymobile.com Add the following to .../config/sms_fu.yml deliver_sms(‘ 5558675309 ’,’ ruby_mobile ’, ‘ hello! ’)
  • 36. Remind Your Users That They May Get Charged from flickr user ‘bowbrick’
  • 37. MMS Multimedia Message Service Multimedia Message Service
  • 38. MMS Can send photo, video, audio or other attachments Most commonly used for photos Attachment size limitation generally dependent on device Multipart MIME
  • 39. The Problem with Receiving MMS Crap Crap Crap Cat
  • 40. Well, how can I receive SMS or MMS from my Rails app ?
  • 41. Short Codes Special numbers that are, you guessed it, short, that can be used to receive SMS or MMS messages from mobile phones. Special numbers that are, you guessed it, short, that can be used to receive SMS or MMS messages from mobile phones.
  • 42.  
  • 43. Short Codes Also referred to as short numbers MMS support added in this year Crazy Expensive Monthly fees up to $1000/mo Setup fees close to $5000 Many companies share short codes
  • 44. Receiving SMS or MMS as an e-mail is another solution and its free and relatively simple
  • 45. MMS2R Gem Removes carrier advertising Eliminates carrier default text Decodes and extracts intended files from the multipart MIME e-mail Most major carriers are supported
  • 46. Retrieve only the intended attachment mms.default_media Retrieve all media files from the MMS mms.media Retrieve only the intended message mms.body Create a new MMS2R object from a TMail object mms = MMS2R::Media.new(email)
  • 47. require ‘ mms2r ’ class MailReceiver < ActionMailer::Base def receive (email) begin # load the TMail object into an MMS2R::Media object mms = MMS2R::Media .new(email) # grab a user on record by the e-mail it was sent from user = User .find_by_email(mms.from) # store the body of the mms into a new BlogPost blog_post = BlogPost .create(: body => mms.body, : user => user, : title => mms.subject) # grab the attachment from the mms message media = mms.default_media # store the attachment from mms into a BlogPhoto BlogPhoto .create(: uploaded_data => media, : blog_post => blog_post) if media.content_type.include?(‘ image ’) ensure # cleans up temporary files used for text and attachments mms.purge end end end
  • 48. require ‘ mms2r ’ class MailReceiver < ActionMailer::Base def receive (email) begin # load the TMail object into an MMS2R::Media object mms = MMS2R::Media . new (email) # grab a user on record by the e-mail it was sent from user = User .find_by_email(mms.from) # store the body of the mms into a new BlogPost blog_post = BlogPost .create(: body => mms.body, : user => user, : title => mms.subject) # grab the attachment from the mms message media = mms.default_media # store the attachment from mms into a BlogPhoto BlogPhoto .create(: uploaded_data => media, : blog_post => blog_post) if media.content_type.include?(‘ image ’) ensure # cleans up temporary files used for text and attachments mms.purge end end end
  • 49. require ‘ mms2r ’ class MailReceiver < ActionMailer::Base def receive (email) begin # load the TMail object into an MMS2R::Media object mms = MMS2R::Media .new(email) # grab a user on record by the e-mail it was sent from user = User .find_by_email( mms.from ) # store the body of the mms into a new BlogPost blog_post = BlogPost .create(: body => mms.body, : user => user, : title => mms.subject) # grab the attachment from the mms message media = mms.default_media # store the attachment from mms into a BlogPhoto BlogPhoto .create(: uploaded_data => media, : blog_post => blog_post) if media.content_type.include?(‘ image ’) ensure # cleans up temporary files used for text and attachments mms.purge end end end
  • 50. require ‘ mms2r ’ class MailReceiver < ActionMailer::Base def receive (email) begin # load the TMail object into an MMS2R::Media object mms = MMS2R::Media .new(email) # grab a user on record by the e-mail it was sent from user = User .find_by_email(mms.from) # store the body of the mms into a new BlogPost blog_post = BlogPost .create(: body => mms.body , : user => user, : title => mms.subject ) # grab the attachment from the mms message media = mms.default_media # store the attachment from mms into a BlogPhoto BlogPhoto .create(: uploaded_data => media, : blog_post => blog_post) if media.content_type.include?(‘ image ’) ensure # cleans up temporary files used for text and attachments mms.purge end end end
  • 51. require ‘ mms2r ’ class MailReceiver < ActionMailer::Base def receive (email) begin # load the TMail object into an MMS2R::Media object mms = MMS2R::Media .new(email) # grab a user on record by the e-mail it was sent from user = User .find_by_email(mms.from) # store the body of the mms into a new BlogPost blog_post = BlogPost .create(: body => mms.body, : user => user, : title => mms.subject) # grab the attachment from the mms message media = mms. default_media # store the attachment from mms into a BlogPhoto BlogPhoto .create(: uploaded_data => media, : blog_post => blog_post) if media.content_type.include?(‘ image ’) ensure # cleans up temporary files used for text and attachments mms.purge end end end
  • 52. require ‘ mms2r ’ class MailReceiver < ActionMailer::Base def receive (email) begin # load the TMail object into an MMS2R::Media object mms = MMS2R::Media .new(email) # grab a user on record by the e-mail it was sent from user = User .find_by_email(mms.from) # store the body of the mms into a new BlogPost blog_post = BlogPost .create(: body => mms.body, : user => user, : title => mms.subject) # grab the attachment from the mms message media = mms.default_media # store the attachment from mms into a BlogPhoto BlogPhoto .create(: uploaded_data => media , : blog_post => blog_post) if media . content_type .include?(‘ image ’) ensure # cleans up temporary files used for text and attachments mms.purge end end end
  • 53. require ‘ mms2r ’ class MailReceiver < ActionMailer::Base def receive (email) begin # load the TMail object into an MMS2R::Media object mms = MMS2R::Media .new(email) # grab a user on record by the e-mail it was sent from user = User .find_by_email(mms.from) # store the body of the mms into a new BlogPost blog_post = BlogPost .create(: body => mms.body, : user => user, : title => mms.subject) # grab the attachment from the mms message media = mms.default_media # store the attachment from mms into a BlogPhoto BlogPhoto .create(: uploaded_data => media, : blog_post => blog_post) if media.content_type.include?(‘ image ’) ensure # cleans up temporary files used for text and attachments mms. purge end end end
  • 54. Adding new templates for carriers is easy --- ignore:    image / gif:    - top.gif    - bottom.gif    - middle_img.gif    text / html:     - /< html > \s +< head > \s +< meta http - equiv = \&quot;Content-Type \&quot; content=\&quot;text\/html; charset=iso-8859-1\&quot;>\s+<title>MMS Email<\/title>/im transform:    text / plain:    - - / Note:\s{1,2}. *? \s + message:\s{1,2}(. + )$ / m      - &quot;\1&quot; conf/mms.myhelio.com.yml
  • 55. Mobilizing your Rails app is simple and easy
  • 56. Mobile Fu http://github.com/brendanlim/mobile-fu/ Clickatell http://clickatell.rubyforge.org/ SMS Fu http://github.com/brendanlim/sms-fu/ MMS2R http://github.com/monde/mms2r/