Use Twilio to conduct automated phone surveys.
This project is preconfigured to run on Heroku. Deploy it now:
To view your app, click the ... menu in the top right corner and select Open app.
This project is built using the Django web framework. It runs on Python 2.7+ and Python 3.4+.
To run the app locally, first clone this repository and cd
into its directory. Then:
- Create a new virtual environment:
- If using vanilla virtualenv, run
virtualenv venv
and thensource venv/bin/activate
- If using virtualenvwrapper, run
mkvirtualenv automated-surveys
- If using vanilla virtualenv, run
- Install the requirements with
pip install -r requirements.txt
- Start a local PostgreSQL database and create a database called
surveys
- If on a Mac, I recommend
Postgres.app. After install, run
createdb surveys;
- If Postgres is already installed locally, you can just run
createdb surveys
from a terminal
- If on a Mac, I recommend
Postgres.app. After install, run
- Run the migrations with
python manage.py migrate
- Optionally create a superuser so you can access the Django admin:
python manage.py createsuperuser
. - Copy the
.env.example
file to.env
, and edit it to match your database. - Start the development server:
python manage.py runserver
You will also need to configure Twilio to call your application when calls are received
You will need to provision at least one Twilio number with voice capabilities so the application's users can take surveys. You can buy a number right here. Once you have a number you need to configure your number to work with your application. Open the number management page and open a number's configuration by clicking on it.
Next, edit the "Request URL" field under the "Voice" section and point
it towards your ngrok-exposed application /automated-survey/first-survey/
route. Set
the HTTP method to POST. If you are trying the Heroku
application you need to point Twilio to
http://<your-app-name>.herokuapp.com/automated-survey/first-survey/
. See the image
below for an example:
You can then visit the application at http://localhost:8000/.
Mind the trailing slash.
Configure your test database in .env.test
. You can then run the tests locally using py.test
$ py.test --cov=automated_survey