Loading...

Bulk SMS XML API


In order to use the XML API you need to have an account on EBulkSMS.

First you need to create your account on EBulkSMS in order to start using our XML API right away. Just click here to register now.

Once you have an account you will be able to start sending XML requests to our API in the format below

<SMS>
    <auth>
        <username>your_username</username>
        <apikey>your_api_key</apikey>
    </auth>
    <message>
        <sender>Sender_Name</sender>
        <messagetext>Your_message</messagetext>
        <flash>0</flash>
    </message>
    <recipients>
        <gsm><msidn>23480...</msidn><msgid>uniqueid1...</msgid></gsm>
        <gsm><msidn>23480...</msidn><msgid>uniqueid1...</msgid></gsm>
        ...
    </recipients>
</SMS>

Now you only have to post the above XML data using HTTP post to: https://api.ebulksms.com/sendsms.xml

 

Parameters

Name Description
username Your login username on eBulkSMS (same as your email address)
apikey This is generated for you here.
sender

Your chosen sender name

Alphanumeric sender name: Maximum of 11 characters

Numeric sender name: Maximum of 14 characters

messagetext

The text message you wish to send

Single page message is 160 characters

Maximum of 4 pages with 612 characters

flash

0 - for normal SMS.

1 - for flash text (Only displays on the screen and will not be saved to the recipients phone)

gsm

Recipient’s mobile number in full international format

msidn - the mobile phone number

msgid - a unique id if you need to request delivery reports.

For messages which require delivery reports please use this format:

<gsm><msidn>23480...</msidn><msgid>your_unique_message_id</msgid></gsm>

VERY IMPORTANT!!! Ensure you specify the "application/xml" Content-Type header. If you do not send this header you may get some unexpected errors.

 

If for any reason you post an JSON request to the XML API the response would be a 500 server error in an unformatted string.

 

Please note that if you are on a shared hosting server you may have to send a request to your hosting company to open outgoing connections on port 8443 to api.ebulksms.com Here is a sample message you can send.


Dear Web Hosting Team,
Please I need access to the API on www.ebulksms.com
The API runs on port 8443. 
Kindly grant my request by opening outgoing connections to api.ebulksms.com on port 8443.
Thanks.
    
 

API Responses


The following responses will indicate if your message was received - success, or if there was an error in your request - failure.

Importantly, you must be aware that errors that have to do with recipient numbers are permanent and such messages should not be resent.

For errors relating to the message format and actual message you could modify the message and resend it.

The same applies to the sender name. As much as possible avoid using special characters in the sender name.

 
Status Description
INVALID_XML The XML format is not valid.
MISSING_USERNAME Username field is empty
MISSING_APIKEY API Key field is empty
AUTH_FAILURE The username and API key combination is not correct.
MISSING_SENDER Sender name is empty
MISSING_MESSAGE Empty message content
MISSING_RECIPIENT No mobile phone number was found
INVALID_RECIPIENT An invalid mobile phone number was found
INVALID_MESSAGE Message is either too long or contains characters that cannot be sent.
INVALID_SENDER The sender name entered is not valid or is missing.
INSUFFICIENT_CREDIT Your account balance is too low to send the message.
UNKNOWN_CONTENTTYPE Check you post method to ensure there you added a content-type header of "application/xml" or "text/xml".
UNKNOWN_ERROR Rarely used - Errors in data specification / headers.
SUCCESS Your message was received successfully.
 

Response Format

Since we are using the XML API, each of the above responses would be sent back in an XML envelop as shown below.

<?xml version="1.0" encoding="UTF-8"?>
<response>
    <status>STATUS_STRING</status>
    <totalsent>{number of valid recipients}</totalsent>
    <cost>{number of units used}</cost>
</response>
 

Checking SMS Credit Balance


You may check your SMS balance using the API with a simple HTTP GET request. Just make a request to this URL:

https://api.ebulksms.com/balance/username/apikey

Here you will replace username and apikey with your username(email address) and your generated API key respectively.


For sample code on how to implement this in PHP please click here.


You may download this API documentation here.