Skip to content

Latest commit

 

History

History
101 lines (67 loc) · 4.03 KB

README.md

File metadata and controls

101 lines (67 loc) · 4.03 KB
Twilio

Click to Call Servlets

Java Servlet CI

An example application implementing Click to Call using Twilio.

Read the full tutorial here!

Set up

Requirements

Twilio Account Settings

This application should give you a ready-made starting point for writing your own appointment reminder application. Before we begin, we need to collect all the config values we need to run the application:

Config Value Description
Account Sid Your primary Twilio account identifier - find this in the Console.
Auth Token Used to authenticate - just like the above, you'll find this here.
Phone number A Twilio phone number in E.164 format - you can get one here

Local development

  1. Clone the repository and cd into it.

  2. The application uses Maven to manage dependencies.

  3. Set your environment variables

    cp .env.example .env

    See Twilio Account Settings to locate the necessary environment variables.

  4. Configure Twilio to call your webhooks.

    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 trigger phone calls. You can buy a number 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.

    Remember that the number where you change the voice webhooks must be the same one you set on the TWILIO_NUMBER environment variable.

    Learn how to configure a Twilio phone number for Programmable Voice

  5. Run the application using Maven.

    mvn compile && mvn jetty:run

    This will run the embedded Jetty application server that uses port 8080. You can change this value on the app's main file

  6. Expose the application to the wider Internet using ngrok

    ngrok 8080

    Once you have started ngrok, update your Twilio's number voice URL setting to use your ngrok hostname, so it will look something like this:

    http://<your-ngrok-subdomain>.ngrok.io/connect
    

Dependencies

This application uses this Twilio helper library.

Run the tests

  1. Run at the top-level directory.

    mvn compile test

Meta

  • No warranty expressed or implied. Software is as is. Diggity.
  • MIT License
  • Lovingly crafted by Twilio Developer Education.