SMS Price: ZW$ 1.40 ONLY!

Call Now: +263 8644 102348/9,
+263 773 098427, +263 773 577173

Working Java sample code

Main Code Page | PHP | Python | C# | Java
This is working sample of a Java console app that actually sends SMS. This code can be used to send SMS through the Bulk SMS API. It was tested and working perfectly. All you need to do is fill the missing information - $username, $token, $destinations. The mobile numbers in this sample are for Bulk SMS technical team and should be removed when implementing the Web Services in your applications. The Webservice username and token (get it from the User Configuration) is case sensitive. You can integrate this code into the rest of your Java Application.

You can create your own Bulk SMS account. Sign Up here! Your Account will be created with FREE SMS credits for testing. Create your Sender ID before testing. After you login, go to Settings, then Manage Sender ID. You will not be able to send SMS without a Sender ID. First test your account from our system before using these Code examples!

    package javasms;

    public class JavaSMS {

         * @param args the command line arguments
        public static void main (String[] args) {

          //  Step 1:  Start creating a few objects we'll need.

          URL url;
          String username,token,bulksms_ws,strJson;
          String destinations,ws_str,message;

            //  Step 2:  Create and encode our Webservice URL.

            //Username that you use to login to
            username = "";

            // Webservices token for above Webservice username.
            //login to and got to My Account -> User Configuration
            //to get your token

            token = "";

            // BulkSMS Webservices URL
            bulksms_ws = "";

            // destination numbers, or use #groupcode for sending to group
            // $destinations = '#devteam'
            // $destinations = '26300123123123'

            destinations = "263772268353"; //multiple numbers allowed. Separate with commas

            // SMS Message to send
            message = "Testing Java to BulkSMS Webservice";

            // send via BulkSMS HTTP API
        try {
            ws_str = bulksms_ws + "&u=" + username + "&h=" + token + "&op=pv";
            ws_str = ws_str + "&to=" + URLEncoder.encode(destinations, "UTF-8") + "&msg=" + URLEncoder.encode(message,"UTF-8");

            url = new URL(ws_str);

            // Sttep 3: Open a URLConnection to the url.  //

            URLConnection conn = url.openConnection();         // throws an IOException

            // Step 4:                                                     //
            // Convert the InputStreamReader to a Buffered Reader.      //
            // Buffering the stream makes the reading faster; the          //
            // readLine() method of the BufferedReader makes the reading  //
            // easier.                                                     //

            BufferedReader br = new BufferedReader(
                                   new InputStreamReader(conn.getInputStream()));

            // Step 5:                                                    //
            // Store the whole output in a variable. The output will be    //
            // JSON string variable.                                      //

            String inputLine;
            strJson = "";
            while ((inputLine = br.readLine()) != null) {
                    strJson += inputLine;


            //Variable strJson holds the reponse from the Webservice

         } catch (MalformedURLException mue) {

            System.out.println("Ouch - a MalformedURLException happened.");

         } catch (IOException ioe) {

            System.out.println("Oops- an IOException happened.");





Use of Smart Phones with Bulk SMS

Our Bulk SMS system is fully compatible with smart phones. It was designed to display efficiently on both desktop, tablets and smart phones. Its now possible to use your smart phone for anything that you want to do in the system. Allowing you to be productive even when you are out of the office or on the go. BUT, just DON'T use this system while you drive!

Why is SMS good for you?

  • The personal nature of mobile phones make SMS marketing a very powerful tool. Basic Phone image
  • Most people take their mobile phones everywhere - meaning they can be effective for time sensitive messages.
  • People tend to read virtually every text they get - unlike junk mail, spam or adverts which can be ignored.
  • It's a direct, immediate communication channel. SMS is one of the most immediate channels available; with a read rate of 97% within 15 minutes delivery, you can be reassured that your time critical messages will be read almost instantly.
..Learn More
Powered by iHubCloud
Physical Address: 102 Churchill Road, Gunhill, Harare
Telephone: +263 8644 102348/9, +263 773 098427, +263 773 577173

Login In   /  Sign Up
(compatible with smart phones)

Powered By

Our Social Media Presence