Skip to content
No description, website, or topics provided.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.settings
bin/com/cecula/messaging/sms
src/com/cecula/messaging/sms
target/classes/com/cecula/messaging/sms
.classpath
.project
.travis.yml
README.md
build.xml
cecula_sms_v1.0.0.jar
pom.xml

README.md

Cecula SMS

A Java Library for Cecula

Build Status


Introduction

Cecula SMS Java Library enables you to quickly integrate and send A2P and P2P Messages from your application.

Library Usage

  • Download the cecula_sms_v1.0.0.jar file
  • Add the jar file to your build path/libraries folder depending on your IDE.

How to Generate an API Key

Your API Key is first generated when you register an app. To register an app, Login to the Developers Dashboard, Navigate to Apps > Add, Type the name of your app and click Submit. The app will be registered and a new API Key will be generated. Copy the API key into your project. Click developer.cecula.com to get started.

Importing Cecula Library

import the library into your Java application using the code below

...
import com.cecula.messaging.sms.CeculaSMS;
...

Sending A2P SMS

To send SMS with alphanumeric identity to single or multiple contacts, use the code below:

    String[] recipients = {"234809xxxxxxx"};
    String sender = "Cecula";
    String message = "Hello world";
    CeculaSMS cSMS = new CeculaSMS(<YOUR_API_KEY>);
    cSMS.sendA2PMessage(sender, message, recipients);

Your response should look like this:

   {
       "status": "sent",
       "reference": "4982953",
       "sentTo": [ "234809xxxxxxx" ],
       "invalid": [],
       "declined": [],
       "declineReason": "",
       "code": "1801"
   }

Sending P2P SMS

To send a message using numberic identity, use the code below:

   String[] recipients = {"2349090000246","2349090000271"};
   String sender = "2348050209037";
   String message = "Hello world";
   CeculaSMS cSMS = new CeculaSMS(<YOUR_API_KEY>);
   cSMS.sendP2PMessage(sender, message, recipients);

Your response should look like this:

    {
        "status": "sent",
        "code": "1801",
        "messageID": "2579",
        "sentTo":[
            {
                "recipient": "2349090000246",
                "id": "5990"
            },
            {
                "recipient": "2349090000271",
                "id": "5991"
            }
        ],
        "declined": []
    }

Checking A2P SMS Balance

To get your A2P SMS Balance, getA2PBalance method is used this way:

    CeculaSMS cSMS = new CeculaSMS(<YOUR_API_KEY>);
    cSMS.getA2PBalance();

You should get a response like this:

    {
        "balance": 234.1
    }

Checking Sync Cloud Balance

To get your Sync Cloud Balance, getSyncCloudBalance method is used this way: This method requires a single parameter - your registered sync cloud identity on the Cecula platform:

   String identity = "2348050209037"
   CeculaSMS cSMS = new CeculaSMS(<YOUR_API_KEY>);
   cSMS.getSyncCloudBalance(identity);

You should get a response like this

    {
        "balance": 9513
    }

Error Responses

In a case where the request fails due to one reason or another you should get an error response from the requested endpoint that looks like this:

        {
            "error": "Message cannot be longer than 10 pages",
            "code": "CE1005"
        }

The table below shows a list of error codes and their descriptions:

Error Code Description
CE1001 Missing Fields
CE1002 Empty Fields
CE1003 Origin cannot be longer than 11 characters
CE1004 A2P Message origin must be alphabets only or alphanumeric
CE1005 Message cannot be longer than 10 pages
CE1007 Cannot find the identity on Sync Cloud
CE1008 Origin is pending verification
CE1009 Account Unbound. Please Recharge Account and Contact Sales
CE1010 Numeric Originator must be between 5 - 16 digits long
CE1011 P2P Message originator must be numeric
CE1012 Origin is not registered
CE1013 Sync App is Offline. Please check device
CE1014 Invalid values on returned properties
CE1802 No Valid Recipient
You can’t perform that action at this time.