Install Java, Spring, and the Plivo Java SDK
To get started, install Java 1.8 or higher and Plivo’s Java SDK. You probably already have Java installed. In macOS, Linux, or Windows you can check the version by running the commandjava -version
in a terminal window. If you need to update it, download and install it. You should also download and install IntelliJ IDEA.
Install Spring and the Plivo Java SDK using IntelliJ Idea
-
Use Spring Initializr to create a boilerplate project with Spring Boot framework.
-
Add the Spring Web dependency. Give the project a friendly name, set the Java target as 8, then click Generate to download the boilerplate code and open it in IntelliJ Idea.
-
Install the Plivo Java package by adding the dependency in
pom.xml
Trigger the PHLO
Create and configure a PHLO, then integrate the PHLO into your application workflow by making an API request to trigger the PHLO with the required payload. You can run a PHLO with static payload values by entering specific values in fields likefrom
and to
on the PHLO console.


Note: Here, the demo application name is
PlivoVoiceApplication.java
because the friendly name provided in the Spring Initializr was Plivo Voice
.Static payload
Dynamic payload
- Replace the placeholders
<auth_id>
and<auth_token>
with your authentication credentials, which you can find on the overview page of the Plivo console. - We recommend that you store your credentials in the
auth_id
andauth_token
environment variables to avoid the possibility of accidentally committing them to source control. If you do this, you can initialize the client with no arguments and it will automatically fetch the values from the environment variables. - Replace the placeholder
<phlo_id>
with the PHLO_ID from the PHLO list screen of the Plivo console. - Replace the placeholder
<Caller_ID>
with a phone number you’ve purchased, and<Destination_Number>
with the phone number you’ll be calling. Both phone numbers should be in E.164 format.
Note: If you’re using a free trial account you must verify (sandbox) your destination number, unless you use the phone number you used for signup verification as your destination number. We require this as a security measure to avoid abuse. To sandbox a number in a Plivo trial account, visit Phone Numbers > Sandbox Numbers and click on Add Sandbox Number.