Use Twilio to track the effectiveness of your different marketing campaigns. Learn how call tracking helps organizations in these Twilio customer stories.
This project is configured to use a TwiML App, which allows us to easily set the voice URLs for all Twilio phone numbers we purchase in this app.
Create a new TwiML app at https://www.twilio.com/user/account/apps/add and use
its Sid as the TWIML_APPLICATION_SID environment variable wherever you run
this app.
You can learn more about TwiML apps here: https://www.twilio.com/help/faq/twilio-client/how-do-i-create-a-twiml-app
This project was built using Java Servlets.
- Clone this repository and
cdinto its directory:
git clone git@github.com:TwilioDevEd/call-tracking-servlets.git
- Create the database.
$ createdb call-tracking-servlets
The application uses PostgreSQL as the persistence layer. If you don't have it already, you should install it. The easiest way is by using Postgres.app.
- Edit the sample configuration file
.environmentto match your database and Twilio's configuration:
export DB_USERNAME=your_db_username export DB_PASSWORD=your_db_password export JDBC_URL=jdbc:postgresql://localhost:5432/call-tracking-servlets export TWILIO_ACCOUNT_SID=your_account_sid export TWILIO_AUTH_TOKEN=your_account_token export TWILIO_APP_SID=your_app_sid ```
Once you have edited the .environment file, if you are using a UNIX operating system,
just use the source command to load the variables into your environment:
$ source .environmentIf you are using a different operating system, make sure that all the
variables from the .environment file are loaded into your environment.
- Execute the migrations.
$ ./gradlew flywayMigrate- Run the application.
$ ./gradlew jettyRun-
Check it out at http://localhost:8080
That's it!
Additionally, in order to let Twilio Phone numbers use the callback endpoint we exposed, our development server will need to be publicly accessible. We recommend using ngrok to solve this problem.
- No warranty expressed or implied. Software is as is. Diggity.
- MIT License
- Lovingly crafted by Twilio Developer Education.