Infobip OneAPI Client

API client in Java for Infobip's OneAPI (https://developer.infobip.com/api).

Лицензия

Лицензия

Категории

Категории

Java Языки программирования
Группа

Группа

org.infobip.oneapi
Идентификатор

Идентификатор

oneapi-java
Последняя версия

Последняя версия

0.0.1
Дата

Дата

Тип

Тип

zip
Описание

Описание

Infobip OneAPI Client
API client in Java for Infobip's OneAPI (https://developer.infobip.com/api).
Ссылка на сайт

Ссылка на сайт

https://developer.infobip.com/libraries
Система контроля версий

Система контроля версий

https://github.com/infobip/oneapi-java.git

Скачать oneapi-java

Зависимости

compile (7)

Идентификатор библиотеки Тип Версия
commons-codec : commons-codec jar 1.6
org.slf4j : slf4j-api jar 1.7.7
org.slf4j : slf4j-log4j12 jar 1.7.5
com.fasterxml.jackson.core : jackson-databind jar 2.4.0
com.fasterxml.jackson.core : jackson-annotations jar 2.4.0
com.fasterxml.jackson.core : jackson-core jar 2.4.0
com.ning : async-http-client jar 1.8.12

test (1)

Идентификатор библиотеки Тип Версия
junit : junit jar 4.11

Модули Проекта

Данный проект не имеет модулей.

OneApi Java client

Basic messaging example

First initialize the messaging client using your username and password:

Configuration configuration = new Configuration(USERNAME, PASSWORD);
SMSClient smsClient = new SMSClient(configuration);

An exception will be thrown if your username and/or password are incorrect.

Prepare the message:

SMSRequest smsRequest = new SMSRequest(SENDER, MESSAGE, DESTINATION);

Send the message:

// Store request id because we can later query for the delivery status with it:
SendMessageResult sendMessageResult = smsClient.getSMSMessagingClient().sendSMS(smsRequest);

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

DeliveryInfoList deliveryInfoList = smsClient.getSMSMessagingClient().queryDeliveryStatus(SENDER, sendMessageResult.getClientCorrelator());
String deliveryStatus = deliveryInfoList.getDeliveryInfo().get(0).getDeliveryStatus();

Possible statuses are: DeliveredToTerminal, DeliveryUncertain, DeliveryImpossible, MessageWaiting and DeliveredToNetwork.

Messaging with notification push example

Same as with the standard messaging example, but when preparing your message:

SMSRequest smsRequest = new SMSRequest(SENDER, MESSAGE, DESTINATION);
// The url where the delivery notification will MESSAGE pushed:
smsRequest.setNotifyURL(NOTIFY_URL);

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

DeliveryInfoNotification deliveryInfoNotification = smsClient.getSMSMessagingClient().convertJsonToDeliveryInfoNotification(JSON);

Sending message with language specific characters example

If you want to send message with special characters, this is how you prepare your message:

SMSRequest smsRequest = new SMSRequest(SENDER, MESSAGE, DESTINATION);
// Create Language object with specific language code, use single shift table and use locking shift table for specific language as parameters
Language language = new Language(LanguageCode.TR, true, false);
// Set language
smsRequest.setLanguage(language);

Currently supported languages (with their language codes) are: Spanish - "SP", Portuguese - "PT", Turkish - "TR".

Number Context example

Initialize and login the data connection client:

Configuration configuration = new Configuration(USERNAME, PASSWORD);
SMSClient smsClient = new SMSClient(configuration);

Retrieve the roaming status (Number Context):

Roaming roaming = smsClient.getHLRClient().queryHLR(DESTINATION);

Number Context with notification push example

Similar to the previous example, but this time you must set the notification url where the result will be pushed:

smsClient.getHLRClient().queryHLR(DESTINATION, NOTIFY_URL);

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

RoamingNotification roamingNotification = smsClient.getHLRClient().convertJsonToHLRNotificationExample(JSON);

Retrieve inbound messages example

With the existing sms client (see the basic messaging example to see how to start it):

InboundSMSMessageList inboundSMSMessageList =  smsClient.getSMSMessagingClient().getInboundMessages();

Inbound message push example

The subscription to recive inbound messages can be set up on our site. When the inbound message notification is pushed to your server as a HTTP POST request, you must process the body of the message with the following code:

InboundSMSMessageList inboundSMSMessageList = smsClient.getSMSMessagingClient().convertJsonToInboundSMSMessageNotificationExample(JSON);

License

This library is licensed under the Apache License, Version 2.0

org.infobip.oneapi

Infobip

Infobip Ltd.

Версии библиотеки

Версия
0.0.1