All Downloads are FREE. Search and download functionalities are using the official Maven repository.

infobip.examples.NumberContextNotifyExample Maven / Gradle / Ivy

There is a newer version: 4.4.0
Show newest version
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("------------------------------------------------");
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy