An electronic intern for PhillyASAP using Twilio's voice API. A Work in progress, more details soon!
Imagine an electronic intern that has a computer. In this case, the intern's computer is a Flask app on Heroku. The intern makes a REST API request to the computer for each phone call that he or she wants to make.
Yes, I know it doesn't make sense that the computer has its own computer but let's roll with it.
- Copy the
.setenv.templatefile to.setenv. - Fill in the values provided:
INTERN_ACCT: your Twilio AccountSIDINTERN_TOKEN: your Twilio TokenINTERN_FROM: The phone number your calls will come from without delimitersINTERN_URL: The URL that the server-side app is running from, for example,http://[your Heroku app name].herokuapp.comPHILLYASAP_FORWARD_NO: PhillyASAP's phone number to forward calls to from within the app http:// [your Heroku app name].herokuapp.com/introPHILLYASAP_TEST_ENV: Eitherprodor something else. If it's prod it'll assume that the app to test is at theINTERN_URLendpoint. If it's something else, it'll test atlocalhost:8000MP3_URL: The URL of the audio file to play for the intro. Must be accessible on the internet. AWS' S3 is a good choice.CALL_DELAY: Time between calls by the intern (in seconds)
Make sure you have Python, and pip installed.
- Install the Python requirements:
pip install -r requirements.txt. (You'll probably want to do this in a virtualenv) - Install MongoDB and make sure it's running
- Do this:
python run.py - Set
INTERN_URLtohttp://localhost:8000 - You're ready to run the intern
Start the intern with:
python run.py [numbers_to_call.csv]
Your CSV file should have the phone numbers to call. You may want to put your call lists in the /call_lists folder because that seems like it would make sense. The intern doesn't need headers!
-
Create a new app on Heroku
-
Push the code to Heroku:
git push heroku master -
Set the env vars that you'll need on Heroku with:
heroku config:set PHILLYASAP_FORWARD_NO=XXXX -
Install the free MongoHQ add-on:
heroku addons:add mongohqheroku config:set MP3_URL=XXXX -
Try http:// [your Heroku app name].herokuapp.com/intro and confirm that you get XML back
You care about testing, right? Run the tests with:
python tests.py
Remember to set the PHILLYASAP_TEST_ENV