infobip.examples.NumberContextNotifyExample Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of infobip-api-java-client Show documentation
Show all versions of infobip-api-java-client Show documentation
API client in Java for Infobip's API (http://dev.infobip.com/).
package infobip.examples;
import infobip.api.client.NumberContextNotify;
import infobip.api.config.BasicAuthConfiguration;
import infobip.api.model.nc.notify.NumberContextRequest;
import infobip.api.model.nc.notify.NumberContextResponse;
import infobip.api.model.nc.notify.NumberContextResponseDetails;
import java.util.Collections;
/**
* Created by milosmilakovic on 9/24/15.
*/
public class NumberContextNotifyExample extends Example {
public static void main(String[] args) {
NumberContextNotify client = new NumberContextNotify(new BasicAuthConfiguration(USERNAME, PASSWORD));
NumberContextRequest requestBody = new NumberContextRequest();
requestBody.setTo(Collections.singletonList("41793026731"));
requestBody.setNotifyUrl(NOTIFY_URL);
NumberContextResponse response = client.execute(requestBody);
NumberContextResponseDetails sentRequestInfo = response.getResults().get(0);
System.out.println("Message ID: " + sentRequestInfo.getMessageId());
System.out.println("Phone number:: " + sentRequestInfo.getTo());
System.out.println("Message status: " + sentRequestInfo.getStatus().getName());
}
}