This code was developed as part of a coding challenge that took place at the GDG Utah meeting on February 7, 2013. We were asked to complete a series of tasks utilizing the Twilio API and upload our code to GitHub. The code has since been modified to easily deploy to heroku.
- Python 2.? (not really sure - developed with 2.7.3)
- twilio-python (Official Twilio SDK for Python)
- bottle (simple micro-framework for small web applications)
- A Twilio account.
- A web accessible server capable of running python scripts.
- Code has been refactored for easy deployment to heroku.
- Configure variables in server.py according to your setup
- webserver information (host, port, dns)
- Twilio information (account, token, phone number)
- Configure your Twilio SMS Request URL to point to your webserver at http://www.example.com/smsReceived.
- Upload
server.pyto a webserver and run it, making sure it's publicly accessible. - Point your browser to your webserver to send an SMS message.
- Something like http://www.example.com/
- Create a new heroku app.
- Copy
set_configs_sample.shtoset_configs.sh - Modify the variables in
set_configs.shto match your setup
- HOST should likely be 0.0.0.0
- DNS should be the domain for your new heroku app
- The rest should match your Twilio account information
-
Run
set_configs.shto set your heroku app's environment variables$ ./set_configs.sh
-
Push your app to heroku
$ git push heroku master
-
Configure your Twilio SMS Request URL to point to your app
- Something like http://xxxxxxx-xxxxxxx-####.herokuapp.com/smsReceived
- Point your browser to your app to send an SMS message.
- Something like http://xxxxxxx-xxxxxxx-####.herokuapp.com/
- Create a new Google App Engine app
- Copy the following module dependencies in to the
modules/directory
-
These should take the structure:
modules/ --httplib2/ --(all the stuff in the httplib2 module) --twilio/ --(all the stuff in the twilio module) --bottle.py --six.py
- Update
app.yamlwith the name of your Google App Engine app - Configure variables in server.py according to your setup
- webserver information (host, port, dns) is not needed
- Twilio information (account, token, phone number) is needed
-
Configure your Twilio SMS Request URL to point to your Google App Engine domain at http://appname.appspot.com/smsReceived.
-
Deploy your app to Google App Engine
appcfg.py update appname/
-
Point your browser to your app to send an SMS message.
- Something like http://xxxxxxxx.appspot.com/