An example of how to use Twilio SMS to distribute your mobile app.
Python
Switch branches/tags
Nothing to show

README.md

Mobile App Distribution with SMS

An example Flask application demonstrating how to invite users to download your mobile application using Twilio SMS.

Built for Rob's talk on mobile app distribution originally given at USV, June 2012.

Build Status

Summary

This is a quick Flask app I put together to demonstrate a common Twilio use case - using SMS to invite users to download your mobile application. A powerful implementation that require little time and is supercheap, leveraging Twilio SMS on your webpage is an easy way for you to bridge the distance between your users' keyboards and their phones and get them in their phone's App Store to install your app right away.

It works like this:

  1. A user inputs his/her phone number in a simple web form.
  2. Using Twilio SMS, you send him/her an invitation link to install your app.
  3. When the user clicks on the link in the text message, he/she is redirected to the native App Store for his/her phone.
  4. Your user installs the app - with crazy conversion rates!

For more information on how to use Twilio to drive users to your mobile app, check out my talk on the subject or a little whitepaper we whipped up on the Twilio website.

The app used in this example is for my favorite mobile game, Plants vs. Zombies.

Features

This example app comes loaded with the kind of tasty goodness you expect from Twilio, including:

  • Production Ready Form - ready-to-use Python web form with basic phone number validation.
  • Invitation Link - Code to redirect your users to their native app stores.
  • Easy Deployment - Use Heroku to see this use case in action in seven commands.
  • Full Test Suite - Seriously. It's good for you.

Usage

Once you deploy this app, you get a simple web form that asks you to put in your phone number:

Invitation web form

Then presto, the user receives a text message with a magical link!

Message the user receives

Then - holy biscuits! - regardless of what type of phone they are using, they get redirected right to their native app store to install!

Holy crap I'm in the app store

Or just text anything to (646) 666-9422 on both an iOS and an Android device to see it without installing anything at all.

Installation

Step-by-step on how to deploy and develop this app.

Deploy

  1. Grab latest source
git clone git://github.com/RobSpectre/Mobile-App-Distribution-with-SMS.git 
  1. Install dependencies
make init
  1. Navigate to folder and create new Heroku Cedar app
heroku create --stack cedar
  1. Deploy to Heroku
git push heroku master
  1. Scale your dynos
heroku scale web=1
  1. Configure Heroku to use your Twilio credentials.
python configure.py --account_sid ACxxxxxx --auth_token yyyyyyy
  1. Open the app in your browser and get an invite!
heroku open

Development

Be sure to follow the configuration steps above and use this step-by-step guide to tweak to your heart's content.

  1. Install the dependencies.
make init
  1. Launch local development webserver
foreman start
  1. Open browser to http://localhost:5000.

  2. Tweak away on app.py.

Testing

This example app comes with a full testing suite with the same kind of form validation that you would want to use in production. To run the tests, simply use nose with this shortcut command:

make test

Anatomy

This app does have a little more complexity than our usual examples in an effort to be production-ready. Here's a quick rundown of all the important files:

  • local_settings.py - Contains all the configuration options for the app, including Twilio credentials and the URIs you want to which you wish to direct your mobile users.
  • app.py - The meat of the app. Contains all the logic for rendering the form, sending the invites, and redirecting mobile users.
  • forms.py - The Form along with some basic validators that make it suitable for production use.
  • tests - Test suite testing the web, Twilio and form validation functionality of this example.
  • templates - The gorgeous interface I surreptitiously from Andres.
  • static - Location of the styles for above.

Meta

githalytics.com alpha