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.
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:
- A user inputs his/her phone number in a simple web form.
- Using Twilio SMS, you send him/her an invitation link to install your app.
- When the user clicks on the link in the text message, he/she is redirected to the native App Store for his/her phone.
- Your user installs the app - with crazy conversion rates!
The app used in this example is for my favorite mobile game, Plants vs. Zombies.
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.
Once you deploy this app, you get a simple web form that asks you to put in your phone number:
Then presto, the user receives a text message with a magical link!
Then - holy biscuits! - regardless of what type of phone they are using, they get redirected right to their native app store to install!
Or just text anything to (646) 666-9422 on both an iOS and an Android device to see it without installing anything at all.
Step-by-step on how to deploy and develop this app.
- Grab latest source
git clone git://github.com/RobSpectre/Mobile-App-Distribution-with-SMS.git
- Install dependencies
- Navigate to folder and create new Heroku Cedar app
heroku create --stack cedar
- Deploy to Heroku
git push heroku master
- Scale your dynos
heroku scale web=1
- Configure Heroku to use your Twilio credentials.
python configure.py --account_sid ACxxxxxx --auth_token yyyyyyy
- Open the app in your browser and get an invite!
Be sure to follow the configuration steps above and use this step-by-step guide to tweak to your heart's content.
- Install the dependencies.
- Launch local development webserver
Open browser to http://localhost:5000.
Tweak away on
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
nose with this shortcut command:
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.
- No warranty expressed or implied. Software is as is. Diggity.
- MIT License
- Lovingly crafted by Twilio New York