This repository contains the server-side web application required to run the Twilio Programmable Voice iOS SDK Quickstart and Android SDK Quickstart mobile sample apps, written in Python.
Looking for the Quickstart mobile app?
Download the client-side Quickstart Applications in Swift and iOS here:
Download the client-side Quickstart Application for Android here:
- A Twilio Acccount. Don't have one? Sign up for free!
- Follow the iOS full quickstart tutorial here or Android full quickstart tutorial here.
This web application needs to be accessbile on the public internet in order to receive webhook requests from Twilio. Ngrok is a great options for getting this done quickly.
Deploy locally using Python and Ngrok
For this option, you'll need to have the following tools installed on your development machine:
Once you've got those, run the following command to install the required Python packages from within this project's parnet directory:
pip install -r requirements.txt
Once that's done you can start the server by executing
python server.py
And then, in a separate terminal window, make your server available to the public internet with the following:
ngrok http 5000
You should see a dynamically generated public Ngrok URL in the command window. Ngrok will now tunnel all HTTP traffic directed at this URL to your local machine at port 5000.
There's one more step: Before the application server will work with your Twilio account, you'll need to open the file server.py
in your favorite text editor and replace ACCOUNT_SID
, API_KEY
, API_KEY_SECRET
, PUSH_CREDENTIAL_SID
and APP_SID
with values from your Twilio account (Don't know what those values are? We cover this in detail in the Programmable Voice iOS SDK Quickstart and Progammable Voice Android SDK Quickstart.
Deploy to the cloud using Heroku
Don't want to run the application server locally? You can also deploy it to the cloud using Heroku. Note: For this option, you'll want to gather your Twilio Account SID, API Key, API Key Secret, Push Credential SID and TwiML App SID before beginning the installation. (Don't know what these are? Read through the Programmable Voice iOS SDK Quickstart or Programmable Voice Android SDK Quickstart for all the information.
If you don't already have one, visit Heroku and create a free account. Once that's done, click the button below to automatically set up this app, and enter the Twilio account information you gathered above when you're prompted.
Test your app by opening the /accessToken
endpoint in your browser (use the publicly accessible domain on Heroku or Ngrok, whichever you chose above). You should see a long string. This is an Access Token. You can examine its contents by pasting it into a JWT tool like jwt.io.
Read through the instructions in the iOS Getting Started or Android Getting Started guides. Still having trouble? Email us and we'll give you a hand.
MIT