Java Helper

The Plivo Java helper simplifies the process of making Plivo API calls and generating Plivo XML. Please note that this is the legacy version.

If you are looking for the latest version, you can get it here.

Prerequisites

  • Java 1.6 or higher.

Installation

Jar with all dependencies

Click here to download the Jar file with all dependencies.

Jar without any dependency

Install the following jar if you have issues with conflicting jars in your project: See the pom.xml file for the list of dependencies you will need to include.

Click here to download the Jar file with all dependencies.

Manual Installation

Install the helper manually from Github by following the manual installation steps listed there.

Using the library

Initializing the PlivoRestAPI class

You can use PlivoRestAPI to initialize a REST class that can make API requests to Plivo.

1
2
3
String api_key = "Your Auth_ID";
String api_token = "Your Auth_Token";
PlivoRestAPI api = new PlivoRestAPI(api_key, api_token, "v1");

Send an SMS

The snippet below shows how you can send an SMS.

1
2
3
4
5
6
7
Map<String, String> params = new Map<String, String> ();

params.put("src","1111111111");
params.put("dst","2222222222");
params.put("text","Hello, how are you?");

PlivoMessage message = api.sendMessage(params);

Check out Message API documentation for more details.

Make an Outbound Phone Call

You can make outbound phone calls to landlines, mobiles, and SIP endpoints (e.g., softphones), in any of our 200+ coverage countries

1
2
3
4
5
6
7
8
Map<String, String> params = new Map<String, String> ();

params.put("src","1111111111");
params.put("dst","2222222222");
params.put("answer_url", "https://s3.amazonaws.com/static.plivo.com/answer.xml");
params.put("answer_method","GET");

PlivoCall call = api.makeCall(params);

Check out Call API documentation for more details.

Examples

Take a look at the Java examples on GitHub.

Reporting Issues

Please report issues or submit patches using the Github Issue Tracker or Customer Support.

License

The Plivo Java Helper Library is written by the Plivo Team and is distributed under the MIT License.