More details are here: smscentral.vn. Java 7 or higher is required.
Set of classes in com.minhhop.sms
package is
an object oriented API of SMSCentral:
public class Main {
public static void main(String[] args) throws IOException {
SMS sms = new SMSCentral("<email>", "<password>", "<token>");
Iterator<Campaign> iterable = sms.campaigns().iterate("1").iterator();
while (iterable.hasNext()) {
System.out.println(new Campaign.Smart(iterable.next()).name());
}
}
}
- Add the following snippet to any project's pom that depends on your project
<repository>
<id>smscentral-mvn-repo</id>
<url>https://raw.github.com/minhhoptech/smscentral/mvn-repo/</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
- The dependency you need is
<dependency>
<groupId>com.minhhop.sms</groupId>
<artifactId>smscentral</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
JsonObject object = Json.createObjectBuilder().add("sender_id", "SMSCENTRAL")
.add("type", 1)
.add("name", "Campaign for 20012015")
.add("messages",
Json.createArrayBuilder().add(
Json.createObjectBuilder()
.add("content", "The tin dung HSBC cua quy khac vua thuc hien giao dich nhu sau: XXXXX3952-VND 17300041 on 03/01/2016")
.add("receiver", Json.createArrayBuilder().add("0908008726")
)
)
).build();
SMS sms = new SMSCentral("<email>", "<password>", "<token>");
Campaign.Smart campaign = new Campaign.Smart(sms.campaigns().create(object));
SMS sms = new SMSCentral("<email>", "<password>", "<token>");
List<Campaign.Message> messages = new ArrayList<Campaign.Message>();
messages.add(new Campaign.Message("0908008726", "The tin dung HSBC cua quy khac vua thuc hien giao dich nhu sau: XXXXX3952-VND 17300041 on 03/01/2016"));
Campaign campaign = sms.campaigns().sendCSKH("senderId", messages);
SMS sms = new SMSCentral("<email>", "<password>", "<token>");
List<Campaign.Message> messages = new ArrayList<Campaign.Message>();
messages.add(new Campaign.Message("0908008726", "The tin dung HSBC cua quy khac vua thuc hien giao dich nhu sau: XXXXX3952-VND 17300041 on 03/01/2016"));
Date schedule = DateUtils.addDays(new Date(), 5);
Campaign campaign = sms.campaigns().sendCSKH("senderId", messages, schedule);
SMS sms = new SMSCentral("<email>", "<password>", "<token>");
List<Campaign.Message> messages = new ArrayList<Campaign.Message>();
messages.add(new Campaign.Message("0908008726", "The tin dung HSBC cua quy khac vua thuc hien giao dich nhu sau: XXXXX3952-VND 17300041 on 03/01/2016"));
Date schedule = DateUtils.addDays(new Date(), 5);
Campaign campaign = sms.campaigns().sendQC("senderId", messages, schedule);
Note: SMS QC have to send to SMS Central API on 2 days before of task schedule date.
SMS sms = new SMSCentral("<email>", "<password>", "<token>");
Campaign.Smart campaign = new Campaign.Smart(sms.campaigns().get("1452853698794FvGTW5"));
System.out.println(campaign.json());
SMS sms = new SMSCentral("<email>", "<password>", "<token>");
Iterator<Campaign> iterable = sms.campaigns().iterate("1").iterator();
while (iterable.hasNext()) {
System.out.println(new Campaign.Smart(iterable.next()).name());
}
SMSCentral SDK needs a Java Virtual Machine of at least version 1.7 (Java SE 7.0). If you want to build the jar from source, you will also need Maven.
If you have any questions about the framework, or something doesn't work as expected, please submit an issue here.