![Build Status](https://travis-ci.org/zensend/zensend_java_api.svg?branch=master)
Installation
The library is distributed via Maven io.zensend::zensend
Examples
Create an instance of the client
Client client = new Client("YOUR-API-KEY");
Sending SMS
To send an SMS, you must specify the originator, body and numbers:
Message message = new Message();
message.originator = "orig";
message.body = "message body";
message.numbers = new String[]{"447777777777", "448888888888"};
SmsResult smsResult = client.sendSms(message);
System.out.println(
smsResult.txGuid + ":" +
smsResult.numbers + ":" +
smsResult.smsParts + ":" +
smsResult.encoding + ":" +
smsResult.costInPence + ":" +
smsResult.newBalanceInPence
);
You can also specify the following optional params:
Message message = new Message();
message.originator = "orig";
message.body = "message body";
message.numbers = new String[]{"447777777777", "448888888888"};
message.originatorType = Message.OriginatorType.ALPHA;
message.timeToLiveInMinutes = 100;
message.smsEncoding = Message.SmsEncoding.GSM;
SmsResult smsResult = client.sendSms(message);
System.out.println(
smsResult.txGuid + ":" +
smsResult.numbers + ":" +
smsResult.smsParts + ":" +
smsResult.encoding + ":" +
smsResult.costInPence + ":" +
smsResult.newBalanceInPence
);
Checking your balance
This will return your current balance:
BigDecimal balance = client.checkBalance();
System.out.println(balance);
Listing prices
This will return a HashMap with all our prices by country code:
HashMap<String, BigDecimal> prices = client.getPrices();
System.out.println(prices);
Operator Lookup
This allows you to lookup the operator of a given MSISDN
OperatorLookupResult opLookup = client.lookupOperator("447777777777");
System.out.println(
opLookup.mcc + ":" +
opLookup.mnc + ":" +
opLookup.operator + ":" +
opLookup.costInPence + ":" +
opLookup.newBalanceInPence
);
Release
mvn release:clean release:prepare
mvn release:perform -P release-profile
mvn deploy -P release-profile