Infobip API Java client


You have installed Java (minimal required version is Java 7).


It is recommended that you use a dependency management system to get started with using Infobip Java API client in your project. You can choose between Maven and Gradle. Depending on your choice find the appropriate configuration below.

Maven configuration

For using the API client in your maven project add the following snippet to the \ section of your pom.xml file:


Gradle configuration

For adding the API client to your gradle project add the following line to the dependencies section of your build.gradle file:

compile "com.infobip:infobip-api-java-client:2.1.0"

Manual dependency management

If you choose not to use any tool for dependency management you can still use the Infobip API client. A .jar with the API client and all of its dependencies can be found at maven central repository.
From the list there click on jar-with-dependencies.jar link to download the .jar file that you can manually integrate into your project.

Running examples

First, setup your username and password in infobip.examples.Example. Then, you can run provided examples in infobip.examples package

Basic messaging example

First, initialize the messaging client using your username and password:

SendSingleTextualSms client = new SendSingleTextualSms(new BasicAuthConfiguration(USERNAME, PASSWORD));

Prepare the message:

SMSTextualRequest requestBody = new SMSTextualRequest();
requestBody.setTo(Arrays.asList("xxxxxxxx", "yyyyyyyy"));
requestBody.setText("This is an example message");

Send the message:

SMSResponse response = client.execute(requestBody);

Later you can query for the delivery status of the message:

 GetSentSmsDeliveryReports client = new GetSentSmsDeliveryReports(new BasicAuthConfiguration(USERNAME, PASSWORD));
 SMSReportResponse response = client.execute(BULK_ID, MESSAGE_ID, LIMIT);

Messaging with delivery report push to notification URL example

Similar to standard messaging example, but when preparing your message, use SMSAdvancedTextualRequest:

SendMultipleTextualSmsAdvanced client = new SendMultipleTextualSmsAdvanced(new BasicAuthConfiguration(USERNAME, PASSWORD));

Destination destination = new Destination();

Message message = new Message();

SMSAdvancedTextualRequest requestBody = new SMSAdvancedTextualRequest();

SMSResponse response = client.execute(requestBody);

When the delivery notification is pushed to your server as a HTTP POST request, you can process the body of the message with the following code:

SMSReportResponse smsReportResponse = gson.fromJson(requestBody, SMSReportResponse.class);


This library is licensed under the Apache License, Version 2.0