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;
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(TO));
requestBody.setNotifyUrl(NOTIFY_URL);
NumberContextResponse response = client.execute(requestBody);
for (NumberContextResponseDetails sentRequestInfo : response.getResults()) {
System.out.println("Message ID: " + sentRequestInfo.getMessageId());
System.out.println("Phone number:: " + sentRequestInfo.getTo());
System.out.println("Message status: " + sentRequestInfo.getStatus().getName());
System.out.println("------------------------------------------------");
}
}
}