Click to Call Spring
An example application implementing Click to Call using Twilio.
Run the application
Clone the repository and
The application uses Gradle to manage dependencies.
Edit the sample configuration file
.env.exampleand edit it to match your configuration.
Once you have edited the
.env.examplefile, if you are using a unix operating system, just use the
sourcecommand to load the variables into your environment:
$ source .env.example
If you are using a different operating system, make sure that all the variables from the .env.example file are loaded into your environment.
You can find your
TWILIO_AUTH_TOKENunder your Twilio Account Settings. You can buy Twilio phone numbers at Twilio numbers
TWILIO_NUMBERshould be set to the phone number you purchased above.
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 right here. Once you have a number you need to configure it so that it works with your application. Open the number management page and open the 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
Run the application using Gradle. The
--debugoption is helpful to view full request and response logs.
$ ./gradlew bootRun --debug
This will run the application on port 8080.
Expose the application to the wider Internet using ngrok
$ ngrok 8080
Configure your Twilio's number voice URL to match your ngrok URL. Also, be sure to set the Webhook method to
GETin your Twilio Console. It should look something like this:
Next, open the following url in your browser:
This application uses this Twilio helper library.
Run the tests
Run at the top-level directory.
$ ./gradlew test