Skip to content

ArkeselDev/arkesel-java-library

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Arkesel SMS Java Library


This is the official supported Java library for the Arkesel API. Please reach out to e-mail [email protected] with any issues that need attention.

##Documentation

General documentation can be found here: https://developers.arkesel.com/

Usage

Setup API key, SenderID and Sandox

//For Both Messaging and Phone Verification
SMS sms = SMS.getInstance();
        
//For Messaging
Messaging messaging = SMS.getMessagingInstance();

//For Phone Verification
PhoneVerification phoneVerification = SMS.getPhoneVerificationInstance();
Parameters Type Default Required Description
apiKey String null true Get your API key from here
senderID String null true Any words at most 11 characters
sandbox boolean false false For testing

Send Quick or Single Message

//Using SMS instance
HttpResponse<String> response = sms.messagingInstance.sendSingleSMS();

//Using Messaging instance
HttpResponse<String> response = messaging.sendSingleSMS();
Parameters Type Default Required Description
message String null true Content to be sent
recipient String null true Contact to receive the message
callbackURL String null false When the message is delivered successful this url will be triggered
scheduledDate String null false Must be in a date time format

For more information visit the docs here, here

Example

//Using SMS instance
HttpResponse<String> response = sms.messagingInstance.sendSingleSMS("Hi snad", "0544919953");

//Using Messaging instance
HttpResponse<String> response = messaging.sendSingleSMS("Hi snad", "233544919953");

NB: Both 0544919953 and 233544919953 are valid number format, you can decide to either include or omit the country code.

Send Bulk Message

//Using SMS instance
HttpResponse<String> response = sms.messagingInstance.sendBulkSMS();

//Using Messaging instance
HttpResponse<String> response = messaging.sendBulkSMS();
Parameters Type Default Required Description
message String null true Content to be sent
recipient List<String> null true Contacts to receive the message
callbackURL String null false When the message is delivered successful this url will be triggered
scheduledDate String null false Must be in a date time format

For more information visit the docs here, here

Example

//Using SMS instance
HttpResponse<String> response = sms.messagingInstance.sendSingleSMS("Hi snad", Arrays.asList("0544919953", "233544919953"));

//Using Messaging instance
HttpResponse<String> response = messaging.sendSingleSMS("Hi snad", Arrays.asList("0544919953", "233544919953"));

Send Message to Group

//Using SMS instance
HttpResponse<String> response = sms.messagingInstance.sendSMSToGroup();

//Using Messaging instance
HttpResponse<String> response = messaging.sendSMSToGroup();
Parameters Type Default Required Description
message String null true Content to be sent
groupName String null true Contact Group to receive the message

For more information visit the docs here, here

Example

//Using SMS instance
HttpResponse<String> response = sms.messagingInstance.sendSMSToGroup("Hi snad","Arkesel");

//Using Messaging instance
HttpResponse<String> response = messaging.sendSMSToGroup("Hi snad","Arkesel");

Send Messages using MessageObject

//Using SMS instance
HttpResponse<String> response = sms.messagingInstance.sendSMS();

//Using Messaging instance
HttpResponse<String> response = messaging.sendSMS();
Parameters Type Default Required
messageObject MessageObject null true

MessageObject Parameters

Parameters Type Default Required Description
message String null true Content to be sent
recipient List<String> null true Contacts to receive the message
callbackURL String null false When the message is delivered successful this url will be triggered
scheduledDate String null false Must be in a date time format

Example

//initiate MessageObject
MessageObject messageObject = new MessageObject("Hi snad", Arrays.asList("0544919953", "233544919953"));

//Using SMS instance
HttpResponse<String> response = sms.messagingInstance.sendSMS(messageObject);

//Using Messaging instance
HttpResponse<String> response = messaging.sendSMS(messageObject);

Create Group

//Using SMS instance
HttpResponse<String> response = sms.messagingInstance.createGroup();

//Using Messaging instance
HttpResponse<String> response = messaging.createGroup();
Parameters Type Default Required
groupName String null true

For more information visit the docs here, here

Example

//Using SMS instance
HttpResponse<String> response = sms.messagingInstance.createGroup("Arkesel");

//Using Messaging instance
HttpResponse<String> response = messaging.createGroup("Arkesel");

Add Contacts

//Using SMS instance
HttpResponse<String> response = sms.messagingInstance.addContacts();

//Using Messaging instance
HttpResponse<String> response = messaging.addContacts();
Parameters Type Default Required Description
groupName String null true Name of the group you will like to add these contacts
contacts List<ContactObject> null true Contacts that will be added to the group

For more information visit the docs here, here

ContactObject Parameters

Parameters Type Default Required
phoneNumber String null true
firstname String null false
lastname String null false
company String null false
email String null false
username String null false

Example

ContactObject contactObject1 = new ContactObject("0544919953");
ContactObject contactObject2 = new ContactObject("233544919953");

List<ContactObject> contacts = new ArrayList<>(){
    {
        add(contactObject1);
        add(contactObject2);
    }
};
//Using SMS instance
HttpResponse<String> response = sms.messagingInstance.addContacts("Arkesel",contacts);

//Using Messaging instance
HttpResponse<String> response = messaging.addContacts("Arkesel",contacts);

SMS Balance

//Using SMS instance
HttpResponse<String> response = sms.messagingInstance.getSMSBalance();

//Using Messaging instance
HttpResponse<String> response = messaging.getSMSBalance();

For more information visit the docs here, here

Send OTP Code

//Using SMS instance
HttpResponse<String> response = sms.phoneVerificationInstance.sendOTPCode();

//Using Phone Verification instance
HttpResponse<String> response = phoneVerification.sendOTPCode();
Parameters Type Default Required Description
length int null true Number of characters in the generated code
type enum OTPType null true ALPHANUMERIC / NUMERIC
expiry int null false How long the code will be valid for minutes
message String null false Content of your message should go here. Include the slot %otp_code% where the generated code should be inserted in the message. %expiry% can also be included to show the expiry time
number String null false Contacts to receive the code
medium enum OTPMedium null false SMS / VOICE

For more information visit the docs here, here

Example

//Using SMS instance
HttpResponse<String> response = sms.phoneVerificationInstance.sendOTPCode(6, OTPType.NUMERIC, 2,"Code: %otp_code%","0544919953", OTPMedium.SMS);

//Using Phone Verification instance
HttpResponse<String> response = phoneVerification.sendOTPCode(6, OTPType.ALPHANUMERIC, 2,"Code: %otp_code%","0544919953. Code will expire in %expiry% minutes", OTPMedium.VOICE);

Verify OTP Code

//Using SMS instance
HttpResponse<String> response = sms.phoneVerificationInstance.verifyOTPCode();

//Using Phone Verification instance
HttpResponse<String> response = phoneVerification.verifyOTPCode();
Parameters Type Default Required
number String null true
code String null true

For more information visit the docs here, here

Example

//Using SMS instance
HttpResponse<String> response = sms.phoneVerificationInstance.verifyOTPCode("0544919953", "16279");

//Using Phone Verification instance
HttpResponse<String> response = phoneVerification.verifyOTPCode("0544919953", "16279");

Releases

No releases published

Packages

No packages published

Languages