Bulk Mobile SMS APIs – Application Programming Interface for Automated Messaging

Bulk SMS APIs – Application Programming Interface for Automated Messaging

An Application Programming Interface (SMS APIs) is one way to connect to Resellers Core Messaging Platform. SMS API provides an easy, efficient and flexible option to integrate with your website / application, facilitating auto-generated SMS Text messages to be delivered to the intended recipients mobile phones. This method does not require Resellers Software Platform at your Enterprise/Data Center site. Accessing gateway through HTTP API is one of the best and the quickest ways to deliver SMS messages. The HTTP API can be used to send various types of SMS messages including normal text messages and Unicode messages only by providing few parametersUser-username,password,mobilenumber,message,senderid,mtype=N for normal message and mtype=L for language sms.

Sending a Single MessageTo send a single message of any type (normal text messages, Unicode messages), the gateway requires parameters like User and Passwd for authentication purpose in below URL formathttp://domainname/WebServiceSMS.aspx?User=xxxxxx&passwd=xxxxxxxxxxxx&mobilenumber=xxxxxxxxxx&message=xxxxxxxxx&sid =xxxxxxxx&mtype=N

For sending Bulk SMS messages, the following URL, along with the required parameters, needs to be accessed –http://domainname/WebServiceSMS.aspx?User=xxxxxx&passwd=xxxxxxxxx&mobilenumber=xxxxxxx,xxxxxxx,xxxxxxxxx&message=xx xxxxxxx&sid=xxxxxxxx&mtype=N

For sending Remainder SMS messages, the following URL, along with the required parameters, needs to be accessed – http://domainname/WebService_RemainderSMS.aspx?User=xxxx&Passwd=xxxx&message=xxxxxxx&mobilenumber=xxxxxxxxxx,xxxxxxxxxx&sendername=xxxx&remname=xxxx&remddate=mm/dd/yyyy Hr:Min:Sec AM/PM&predate=mm/dd/yyyy Hr:Min:Sec AM/PM&mtype=N

Sample URL for Delivery Reports-http://domainname/SMSCWebService_SMS_GetDR.aspx?user=xxxx&pwd=xxxx&fromdate=xxxx&todate=xxxx&jobno=xxxx

Sample URL for Getting Balance Credits– http://domainname/Webservicesms_get_userbalance.aspx?user=xxxx&passwd=xxxx


For sample codes click here


                            VB.NET CODE


Imports System.Data

Imports System.IO

Imports System.Configuration

Imports System

Imports System.Net

Imports System.Text


 Public Function SendSMS(ByVal User As String, ByVal password As String, ByVal Mobile_Number As String, ByVal Message As String, Optional ByVal MType As String = “N”) As String

        Dim stringpost As String = “User=” & User & “&passwd=” & password & “&mobilenumber=” & Mobile_Number & “&message=” & Message & “&MTYPE=” & MType


        Dim functionReturnValue As String = Nothing

        functionReturnValue = “”


        Dim objWebRequest As HttpWebRequest = Nothing

        Dim objWebResponse As HttpWebResponse = Nothing

        Dim objStreamWriter As StreamWriter = Nothing

        Dim objStreamReader As StreamReader = Nothing



            Dim stringResult As String = Nothing


        objWebRequest = DirectCast(WebRequest.Create(“http://Domain name/WebserviceSMS.aspx”), HttpWebRequest)

 //domain name: Domain name Replace With Your Domain 

            objWebRequest.Method = “POST”


            ‘ Response.Write(objWebRequest)


            ‘ Use below code if you want to SETUP PROXY.

            ‘Parameters to pass: 1. ProxyAddress 2. Port

            ‘You can find both the parameters in Connection settings of your internet explorer.


            ‘ If you are in the proxy then Uncomment below lines and enter IP and Port.

           ‘ Dim myProxy As New Net.WebProxy(“”, 6666)

            ‘myProxy.BypassProxyOnLocal = True

            ‘objWebRequest.Proxy = myProxy


            objWebRequest.ContentType = “application/x-www-form-urlencoded”


            objStreamWriter = New StreamWriter(objWebRequest.GetRequestStream())





            objWebResponse = DirectCast(objWebRequest.GetResponse(), HttpWebResponse)



            objWebResponse = DirectCast(objWebRequest.GetResponse(), HttpWebResponse)


            objStreamReader = New StreamReader(objWebResponse.GetResponseStream())

            stringResult = objStreamReader.ReadToEnd()


            Return (stringResult)

        Catch ex As Exception

            Return (ex.ToString)



            If (objStreamWriter IsNot Nothing) Then


            End If

            If (objStreamReader IsNot Nothing) Then


            End If

            objWebRequest = Nothing

            objWebResponse = Nothing


        End Try

    End Function


    Protected Sub btnsubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnsubmit.Click

        Dim str As String

        str = SendSMS(Trim(User1.Value), Passwd.Value, mobilenumber.Value, message.Value)


    End Sub


                                CSHARP CODE


using Microsoft.VisualBasic;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using System.IO;
using System.Configuration;
using System.Net;
using System.Text;
using System.Net;


 public string SendSMS(string User, string password, string Mobile_Number, string Message, [System.Runtime.InteropServices.OptionalAttribute, System.Runtime.InteropServices.DefaultParameterValueAttribute("N")]  // ERROR: Optional parameters aren't supported in C#
string MType)
        string stringpost = "User=" + User + "&passwd=" + password + "&mobilenumber=" + Mobile_Number + "&message=" + Message + "&MTYPE=" + MType;
                string functionReturnValue = null;
                functionReturnValue = "";
                HttpWebRequest objWebRequest = null;
                HttpWebResponse objWebResponse = null;
                StreamWriter objStreamWriter = null;
                StreamReader objStreamReader = null;
                try {
                    string stringResult = null;
                 objWebRequest = (HttpWebRequest)WebRequest.Create("(http://Domain name/WebserviceSMS.aspx");
                        //domain name: Domain name Replace With Your Domain  
                    objWebRequest.Method = "POST";
                    // Response.Write(objWebRequest)
                    // Use below code if you want to SETUP PROXY.
                    //Parameters to pass: 1. ProxyAddress 2. Port
                    //You can find both the parameters in Connection settings of your internet explorer.
                    // If You are In the proxy Then You Uncomment the below lines and Enter IP And Port Number
                    //System.Net.WebProxy myProxy = new System.Net.WebProxy("", 6666);
                    //myProxy.BypassProxyOnLocal = true;
                    //objWebRequest.Proxy = myProxy;
                    objWebRequest.ContentType = "application/x-www-form-urlencoded";
                    objStreamWriter = new StreamWriter(objWebRequest.GetRequestStream());
                    objWebResponse = (HttpWebResponse)objWebRequest.GetResponse();
                    objWebResponse = (HttpWebResponse)objWebRequest.GetResponse();
                    objStreamReader = new StreamReader(objWebResponse.GetResponseStream());
                    stringResult = objStreamReader.ReadToEnd();
                    return (stringResult);
                } catch (Exception ex) {
                    return (ex.ToString());
                } finally {
                    if ((objStreamWriter != null)) {
                    if ((objStreamReader != null)) {
                    objWebRequest = null;
                    objWebResponse = null;
            protected void btnsubmit_Click(object sender, System.EventArgs e)
                string str = null;
                str = SendSMS(User.Value, Passwd.Value, mobilenumber.Value, message.Value,"N");


                            PHP CODE


//Please Enter Your Details
 $user="XXXXXX"; //your username
 $password="XXXXXX"; //your password
 $mobilenumbers="919XXXXXXXXX"; //enter Mobile numbers comma seperated
 $message = "test messgae"; //enter Your Message
 $senderid="DEMO"; //Your senderid
 $messagetype="N"; //Type Of Your Message
$url="http://Domain name)/WebserviceSMS.aspx";
 //domain name: Domain name Replace With Your Domain  
 $message = urlencode($message);
 $ch = curl_init();
 if (!$ch){die("Couldn't initialize a cURL handle");}
 $ret = curl_setopt($ch, CURLOPT_URL,$url);
 curl_setopt ($ch, CURLOPT_POST, 1);
 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);          
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
 curl_setopt ($ch, CURLOPT_POSTFIELDS,
 $ret = curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);


//If you are behind proxy then please uncomment below line and provide your proxy ip with port.
// $ret = curl_setopt($ch, CURLOPT_PROXY, "PROXY IP ADDRESS:PORT");


 $curlresponse = curl_exec($ch); // execute
        echo 'curl error : '. curl_error($ch);


 if (empty($ret)) {
    // some kind of an error happened
    curl_close($ch); // close cURL handler
 } else {
    $info = curl_getinfo($ch);
    curl_close($ch); // close cURL handler
    //echo "<br>";
        echo $curlresponse;    //echo "Message Sent Succesfully" ;




To send SMS using XML the user has to create an interface (form) having a form element with name as ‘XML_DATA’.

e.g. <input name=”XML_DATA” type=”text”>

Post/Submit your case-sensitive XML through that form as HTTP post to the following URL: http://domainname/WebServicexmlapi.aspx

<text>Hi! Hru?</text>
Description of the XML format: –








User name of the account




Password of the account




Destination Mobile Number




Name of the Sender / Sender-Id



Hi!H r u?

Message to be send




Delivery Report Required




Type of message
(U for Unicode, N for normal text, P for picture messages)




' This is  ASP sample code


<% option explicit %>




 Dim objXMLHTTP, sRemoteURL,posturl


'Create & initialize the XMLHTTP object
Set objXMLHTTP = Server.CreateObject("Msxml2.ServerXMLHTTP.6.0")
sRemoteURL = "http://Domain name/WebserviceSMS.aspx"


'Open the connection to the remote server
objXMLHTTP.Open "POST", sRemoteURL
objXMLHTTP.setProxy 2, ""'If you are behind proxy please mention the proxy ip with port. Or just comment this particular line...
objXMLHTTP.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"


posturl = "User=xxxx&passwd=xxxx&mobilenumber=919xxxxxxxxx&message=xxxx&sid=xxxx&mtype=N&DR=Y"
objXMLHTTP.setRequestHeader "Content-Length",LEN(posturl)
'Send the request to the eProcessingNetwork Transparent Database Engine
objXMLHTTP.Send  posturl


'store the response
response.Write (objXMLHTTp.responseText)







import java.util.Properties;


public class CallSmscApi {


        public CallSmscApi() {


    1   Create a URL.
        2       Retrieve the URLConnection object.
        3       Set output capability on the URLConnection.
        4       Open a connection to the resource.
        5       Get an output stream from the connection.
        6       Write to the output stream.
        7       Close the output stream.
        public static void main( String[] args) throws Exception{
               String postData="";
               String retval = "";


               //give all Parameters In String
               String User ="User_Name";
               String passwd = "Password";
               String mobilenumber = "Mno1,Mno2,,,,Mnon";
               String message = "SMS MEssage";
               String sid = "Sender_Id";
               String mtype = "N";
               String DR = "Y";               


               postData += "User=" + URLEncoder.encode(User,"UTF-8") + "&passwd=" + passwd + "&mobilenumber=" + mobilenumber + "&message=" + URLEncoder.encode(message,"UTF-8") + "&sid=" + sid + "&mtype=" + mtype + "&DR=" + DR;
               URL url = new URL("http://Domain Name/WebserviceSMS.aspX");
               HttpURLConnection urlconnection = (HttpURLConnection) url.openConnection();


               // If You Are Behind The Proxy Server Set IP And PORT else Comment Below 4 Lines
               //Properties sysProps = System.getProperties();
               //sysProps.put("proxySet", "true");
               //sysProps.put("proxyHost", "Proxy Ip");
               //sysProps.put("proxyPort", "PORT");


               OutputStreamWriter out = new OutputStreamWriter(urlconnection.getOutputStream());
               BufferedReader in = new BufferedReader(       new InputStreamReader(urlconnection.getInputStream()));
               String decodedString;
               while ((decodedString = in.readLine()) != null) {
                       retval += decodedString;





Courtesy & SMS Country

Trai Rules For Bulk Sms

Trai Rules For Bulk Sms

These regulations will be effective from 1st February. Companies like ourselves that are providing such bulk sms services has to register with TRAI as telemarketers and sign new agreements with all Access providers (operators/telcos).

There are primarily 3 effects because of this regulation.

From 1st February  2011 you can only send SMS to people who are not in the National Do Not Call Registry(NDNC). Since about 9 crore people have registered in the NDNC list, we can send commercial communication for the rest of the mobile consumers who are approximately 61 crores.

You cannot send SMS after 9pm and before 9am, all communication should happen only between 09:00 & 21:00 every day. This is for all consumers irrespective of the National Do Not Call Registry(NDNC) list.

You cannot have the “branded” sender Ids like you have now, which will be changed to a number as specified in TCCP Regulations dated 01-dec-2010, page 27, under Schedule -IV “Agreement between Access Provider and Telemarketer”, para 6, copy-pasted here, for your kind reference “(6) The telemarketer shall use alpha-numeric identifier for sending commercial communication in the format having nine alpha numeric characters, first alpha numeric character being code of Access provider and the second alpha numeric character being code of service area, as provided under the direction dated 10th December, 2008 issued by TRAI. The third alpha numeric character will be dash(-) and the fourth being any single digit (1-7) with each digit indicating a specific category of SMS as per schedule-I of the regulations and last five characters being five digit unique identification code provided by respective Access Provider to the telemarketer e.g XY-5ZZZZZ, where X stands for code allotted to Access rovider, Y stands for service area, 5 indicates that this SMS belongs to consumer goods and automobiles category and ZZZZZ indicates five digit unique identification code allotted to telemarketer by the Access Provider.”

As a customer of SMSCountry you need not register as a telemarketer. We have taken care of that and registered ourselves as a telemarketer and we will deliver the messages for you. We have taken care of all the processes and systems that are required to migrate to the new regulations and make the transition smooth for you. for more information on TCCCPR and NCPR (National Customer Preference Registry) please refer

The TCCCPR has come up with a customer preferences called National customer preference register (NCPR) where they can receive messages from categories they have unblocked themselves from. NCPR has two categories of SMS

a) Transactional:

i.    Information sent to its customer(s) by the Bank or financial institution or insurance company or Credit Card Company or Access Provider pertaining to the account of that customer(s)

ii.    Information given by Airlines or Indian Railways or its authorized agencies to its passengers regarding travel schedules, ticket booking and reservation

iii.   Information from a registered educational institution to parents or guardians of its students;

b) Commercial: Currently, any messages not in the list above would be classified as ‘Commercial’ messages.

If a consumer on NCPR list, files a complaint for receiving any sms, it will be traced back to the registered company. After 6th complaint and a fine totalling 7 lakhs(for 6 complaints) the company will be blacklisted and cannot do this business for 2 years.

Such extremely hard rules for any company to violate, even by mistake, is a big risk. So SMSCountry being a leader in this industry and focusing on long term growth has taken up this regulation seriously and following every rule to the book. We have decided that as a company policy will only allow delivery to non-NCPR numbers as the risk associated is very very high in the long term interest of the company.

So from 1st february 2011, all messages will be scrubbed and will be only delivered to numbers which are not present in the NCPR list. This means that even if you submit to DND numbers, they will be filtered at our end and will not be delivered.

Please write to us or talk to our CRM, Sales person if you have any queries regarding the regulation or how we are implementing the regulation from 1st february.