An example application implementing Click to Call using Twilio.
- Java Development Kit version 8
- ngrok
- A Twilio account - sign up
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 |
-
Clone the repository and
cd
into it. -
The application uses Maven to manage dependencies.
-
Set your environment variables
cp .env.example .env
See Twilio Account Settings to locate the necessary environment variables.
-
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
-
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
-
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
This application uses this Twilio helper library.
-
Run at the top-level directory.
mvn compile test
- No warranty expressed or implied. Software is as is. Diggity.
- MIT License
- Lovingly crafted by Twilio Developer Education.