Create a Call Centre with Twilio + Java Spring boot

Nuwantha Fernando
4 min readAug 14, 2020

Every company or the organization are pretend on the clients. So the client satisfaction is very important. Therefore, maintaining a call center is necessary. But because of the cost, which takes to establish a physical call center is high, Most of the people are not establish a call center for there businesses. So to fulfill this requirement, Jeff Lawson and his colleges have introduced Twilio in 2008.

Twilio is a cloud communications platform as a service company based in San Francisco, California. Twilio allows software developers to programmatically make and receive phone calls, send and receive text messages, and perform other communication functions using its web service APIs.

From this tutorial, we are going to set up a simple call center application from ready maid project which was implemented by me using Twilio and Java Spring Boot. In here what I am doing is guide you to change configurations of the application, So you can run your application.

Below is a screenshot of a completed project. This tutorial will direct you to build up an operational client application. So you can customize your web page as your requirements.

So Let’s Start..

Before starting the tutorial you should have to make sure your machine is fulfilling the following requirements.

  • Java 11
  • Ngrok (ngrok secure introspectable tunnels to localhost webhook development tool and debugging tool.)
  • A Twilio Account Signed Up (Twilio is a cloud communications platform as a service company based in San Francisco, California. Twilio allows software developers to programmatically make and receive phone calls, send and receive text messages, and perform other communication functions using its web service APIs.)

Here is the project repository stored in GitHub. Clone the project into your local machine. And open it up with your favorite IDE. For this tutorial, I have used IntelliJ IDEA.

Before starting the configurations you should have some basic idea regarding the following properties.

twilio.account_sid

Your primary Twilio account identifier — find this in the console here.

Account SID

twilio.twiml.app.sid

The TwiML application with a voice URL configured to access your server running this app — create one in the console here. Also, you will need to configure the Voice “REQUEST URL” on the TwiML app once you’ve got your server up and running.

twilio.trial_number

A Twilio phone number in E.164 format — you can get one here

twilio.api.key / twilio.api.secret

Your REST API Key information needed to create an Access Token — create one here.

Let’s start the configurations.

Edit application.properties file

When after you find all the required properties. Open up the application.properties file from the project folder. And fill up the values with the found properties. Please refer following example code.

Run application locally

Then open the cmd or terminal and go to the root directory (where the application.properties file available) then run mvn spring-boot:run command.

Then navigate to http://localhost:8080 — Here you can see the application is working fine.

Bridge the URL

You should have to run it with ngork to locally check it. So that, Open the terminal and run ngrok http 8080 command. So the terminal will display ngrok forwarded URL. Copy it and navigate to it from the browser. Refer following screenshot.

ngrok session status

Twilio application configurations

This is the final step. All the application side changes are almost over. Now you should have to set up the Twilio configurations. Go to the TWIML application and click on the application you created. And update the voice URL with ngrok forwaded URL + /call/voice and keep the method type as default (HTTP Post). Ex: https://71da93bcb0b9.ngrok.io/call/voice

And finally, update the phone voice URL so you are ok to test the application. To update the phone voice URL navigate to the phone numbers. Click on a phone number and then update the voice URL with ngrok forwaded URL + /call/direct-client and keep the method type as default (HTTP Post). Ex: https://71da93bcb0b9.ngrok.io/call/direct-client. Below is a screenshot for your reference.

Hopefully, Now your application is running without issue. If you faced any issue post those in the comment section.

--

--

Nuwantha Fernando

BSc (Hons) in Computer Science and Software Engineering | Software Engineer at Treinetic (pvt) Ltd