Bulk SMS APIs. For developers

Required Environment

In order to use the HTTP based API, you will need to have a system that has internet connectivity. This connectivity may be direct to the internet or via a firewall or proxy server. Additionally, if anyone wish to receive delivery reports (DLRs), then one must have a web server that is able to receive incoming requests from the Internet. This web server does not necessarily have to be running on the same machine that is sending messages to us.

Authentication

All requests are secured through BASIC authentication via API Key (apikey). An additional level of protection is provided where API key can be configured to accept requests from a specific IP Address only.

SSL Enabled API Triggering

These APIs has been designed to allow client to access them using an SSL Enabled connection for added security. To trigger API on an SSL enabled connection, one must enter the URL beginning with https:// instead of http://.

Our API supports both HTTP and HTTPS. Using HTTPS to encrypt all requests through SSL is recommended, but if you’re using a client and tool that’s not set up to make SSL requests, one can use HTTP also.

Input Restrictions

It can be used either in the form of a HTTP POST or HTTP GET. We recommend POST for larger data transfer and data security. All calls to the API must be URL-encoded. The parameter variables are case sensitive. Also, recommended to use the POST method for error free submission due to URL limitations.

API Parameter

Name Parameter Description
API Key* apikey API Key generated from your SMS account (API Menu)
Sender Id* sender Sender ID assigned to your account
Mobile Number* mobileno Receiver mobile number with or without 91. Multiple numbers in comma separated format.
message * text Message to be sent in url-encoded format
Route route System name of the route (leave blank if only one route in your account )

Parameters with (*) are mandatory.

Note : If you submit large number of request, always use XML API for better performance

Send an SMS

http://app.rpsms.in/api/push.json?apikey=<apikey>&sender=<senderid>&mobileno=<mob>&text=<text>

Schedule SMS

https://app.rpsms.in/api/push.json?apikey=<apikey>&sender=<senderid>&mobileno=<mob>&text=<text>&schedule=<schedule>

Cancel Schedule

http://app.rpsms.in/api/cancelschedule.json?apikey=<apikey>&batchid=<batchid>

Balance Check

http://app.rpsms.in/api/creditstatus.json?apikey=<apikey>

 Get Available Sender Id List

http://app.rpsms.in/api/senderlist.json?apikey=<apikey>

Get Templates List

http://app.rpsms.in/api/templatelist.json?apikey=<apikey>

 Get Group List

http://app.rpsms.in/api/grouplist.json?apikey=<apikey>

 Create Group

http://app.rpsms.in/api/creategroup.json?apikey=<apikey>&name=<group_name>

Create Contact

http://app.rpsms.in/api/createcontact.json?apikey=<apikey>&grpname=<group_name>&name=<contact_name>&number=<contact_number>

Sample HTTP Report PULL API URL Format

http://app.rpsms.in/api/pull.json?apikey=<apikey>&batchid=<batchid>

Obtaining Message Delivery Report (Push)

http://app.rpsms.in/api/push.json?apikey=<apikey>sender=<senderid>&mobileno=<mob>&text=<text>&dlrurl=<dlr-url>&reference=<reference>

 

Integrate Bulk SMS APIs Gateway with Java, PHP, HTTP Scripts

 

XML

 

<?xml version='1.0' encoding='ISO-8859-1'?>
<message>
<user apikey='xxxxxxxxxx' route='xxxxx' />
<sms text='test sms from xml api'>
<address from='TESTIN' to='xxxxxxxxxx' />
<address from='TESTIN' to='xxxxxxxxxx' />
</sms>
<sms text='second test sms from xml api'>
<address from='TESTIN' to='xxxxxxxxxx' />
</sms>
</message>

JAVA
/*Send SMS using JAVA*/

//Your authentication key

String apikey = "apikey";

//Multiple mobiles numbers separated by comma

String mobiles = "9999999";

//Sender ID,sender id should be 6 characters long asign to to your account.

String sender = "TESTIN";

//Your message to send, Add URL encoding here.

String text = "Test message";

//define route (leave blank if single route asign)

String route="";




//Prepare Url

URLConnection myURLConnection=null;

URL myURL=null;

BufferedReader reader=null;




//encoding message

String encoded_message=URLEncoder.encode(message);




//Send SMS API

String mainUrl="https://app.rpsms.in/api/push.json?";




//Prepare parameter string

StringBuilder sbPostData= new StringBuilder(url);

sbPostData.append("apikey="+apikey);

sbPostData.append("&mobileno="+mobileno);

sbPostData.append("&text="+encoded_text);

sbPostData.append("&route="+route);

sbPostData.append("&sender="+sender);




//final string

mainUrl = sbPostData.toString();

try

{

//prepare connection

myURL = new URL(mainUrl);

myURLConnection = myURL.openConnection();

myURLConnection.connect();

reader= new BufferedReader(new InputStreamReader(myURLConnection.getInputStream()));

//reading response

String response;

while ((response = reader.readLine()) != null)

//print response

System.out.println(response);




//finally close connection

reader.close();

}

catch (IOException e)

{

e.printStackTrace();

}

Python
import urllib # Python URL functions
import urllib2 # Python URL functions

apikey = "YourApiKey" # Your authentication key.

mobileno = "9999999999" # Multiple mobiles numbers separated by comma.

text = "Test message" # Your message to send.

sender = "ALTSMS" # Sender ID,sender id should be 6 characters long asign to to your account.

route = "default" # Define route (leave blank if single route asign)

# Prepare you post parameters
values = {
          'apikey' : apikey,
          'mobileno' : mobileno,
          'text' : text,
          'sender' : sender,
          'route' : route
          }


url = "https://app.rpsms.in/api/push.json" # API URL

postdata = urllib.urlencode(values) # URL encoding the data here.

req = urllib2.Request(url, postdata)

response = urllib2.urlopen(req)

output = response.read() # Get Response

print output # Print Response

C#
//Your authentication key
string apiKey = "YourApiKey";
//Multiple mobiles numbers separated by comma
string mobileno = "9999999";
//Sender ID,sender id should be 6 characters long asign to to your account.
string sender = "102234";
//Your message to send, Add URL encoding here.
string text = HttpUtility.UrlEncode("Test message");

//Prepare you post parameters
StringBuilder sbPostData = new StringBuilder();
sbPostData.AppendFormat("apikey={0}", apiKey);
sbPostData.AppendFormat("&mobileno={0}", mobileno);
sbPostData.AppendFormat("&text={0}", text);
sbPostData.AppendFormat("&sender={0}", sender);
sbPostData.AppendFormat("&route={0}", "");

try
{
    //Call Send SMS API
    string sendSMSUri = "https://app.rpsms.in/api/push.json";
    //Create HTTPWebrequest
    HttpWebRequest httpWReq = (HttpWebRequest)WebRequest.Create(sendSMSUri);
    //Prepare and Add URL Encoded data
    UTF8Encoding encoding = new UTF8Encoding();
    byte[] data = encoding.GetBytes(sbPostData.ToString());
    //Specify post method
    httpWReq.Method = "POST";
    httpWReq.ContentType = "application/x-www-form-urlencoded";
    httpWReq.ContentLength = data.Length;
    using (Stream stream = httpWReq.GetRequestStream())
    {
    	stream.Write(data, 0, data.Length);
    }
    //Get the response
    HttpWebResponse response = (HttpWebResponse)httpWReq.GetResponse();
    StreamReader reader = new StreamReader(response.GetResponseStream());
    string responseString = reader.ReadToEnd();

    //Close the response
    reader.Close();
    response.Close();
}
catch (SystemException ex)
{
	MessageBox.Show(ex.Message.ToString());
}

Windows 8
try
{
    string strResult = "";
    //Prepare you post parameters
    var postValues = new List<KeyValuePair<string, string>>();
    //Your api key
    postValues.Add(new KeyValuePair<string, string>("apikey", "apiKey"));
    //Multiple mobiles numbers separated by comma
    postValues.Add(new KeyValuePair<string, string>("mobileno", "9999999"));
    //Sender ID,sender id should be 6 characters long asign to to your account.
    postValues.Add(new KeyValuePair<string, string>("sender", "ALTSMS"));
    //Your message to send, Add URL encoding here.
    string message = HttpUtility.UrlEncode("Test message");
    postValues.Add(new KeyValuePair<string, string>("text", text));
    //Select route
    postValues.Add(new KeyValuePair<string, string>("route",""));

    //Prepare API to send SMS
    Uri requesturl = new Uri("https://app.rpsms.in/api/push.json");
    //create httpclient request
    var httpClient = new HttpClient();
    var httpContent = new HttpRequestMessage(HttpMethod.Post, requesturl);
    httpContent.Headers.ExpectContinue = false;
    httpContent.Content = new FormUrlEncodedContent(postValues);
    HttpResponseMessage response = await httpClient.SendAsync(httpContent);

    //Get response
    var result = await response.Content.ReadAsStringAsync();
    strResult = result.ToString();
    response.Dispose();
    httpClient.Dispose();
    httpContent.Dispose();
}
catch (Exception ex)
{
	throw ex;
}

Android
//Your authentication key
String authkey = "YourAuthKey";
//Multiple mobiles numbers separated by comma
String mobiles = "9999999";
//Sender ID,While using route4 sender id should be 6 characters long.
String senderId = "102234";
//Your message to send, Add URL encoding here.
String message = "Test message";
//define route
String route="default";

URLConnection myURLConnection=null;
URL myURL=null;
BufferedReader reader=null;

//encoding message
String encoded_message=URLEncoder.encode(message);

//Send SMS API
String mainUrl="http://sms.rpsms.in/api/sendhttp.php?";

//Prepare parameter string
StringBuilder sbPostData= new StringBuilder(mainUrl);
sbPostData.append("apikey="+apikey);
sbPostData.append("&mobileno="+mobileno);
sbPostData.append("&text="+encoded_text);
sbPostData.append("&route="+route);
sbPostData.append("&sender="+sender);

//final string
mainUrl = sbPostData.toString();
try
{
    //prepare connection
    myURL = new URL(mainUrl);
    myURLConnection = myURL.openConnection();
    myURLConnection.connect();
    reader= new BufferedReader(new InputStreamReader(myURLConnection.getInputStream()));

    //reading response
    String response;
    while ((response = reader.readLine()) != null)
    //print response
    Log.d("RESPONSE", ""+response);

    //finally close connection
    reader.close();
}
catch (IOException e)
{
	e.printStackTrace();
}

iOS
//Create Objects
NSMutableData * responseData;
NSURLConnection * connection;

// In your viewDidLoad method add this lines
-(void)viewDidLoad
{
    [super viewDidLoad];
    //Your api key
    NSString * apikey = @"apikey";
    //Multiple mobiles numbers separated by comma
    NSString * mobileno = @"9999999";
    //Sender ID,sender id should be 6 characters long asign to to your account.
    NSString * sender = @"ALTSMS";
    //Your message to send, Add URL encoding here.
    NSString * text = @"Test message";
    //define route
    NSString * route = @"";

    // Prepare your url to send sms with this parameters.
    NSString * url = [[NSString stringWithFormat:@"https://app.rpsms.in/api/push.json?apikey=%@&mobileno=%@&text=%@&sender=%@&route=%@", apikey, mobileno, text, sender, route] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
    NSURLRequest * request = [NSURLRequest requestWithURL:[NSURL URLWithString:url]];
    connection = [[NSURLConnection alloc] initWithRequest:request delegate:self];
}

// implement URLConnection Delegate Methods as follow
-(void) connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response
{
	//Get response data
    responseData = [NSMutableData data];
}

-(void) connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
{
	[responseData appendData:data];
}

-(void) connection:(NSURLConnection *)connection didFailWithError:(NSError *)error
{
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error" message:error.localizedDescription delegate:self cancelButtonTitle:nil otherButtonTitles:@"OK", nil];
    [alert show];
}

-(void) connectionDidFinishLoading:(NSURLConnection *)connection
{
    // Get response data in NSString.
    NSString * responceStr = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
}

VB6
Private Sub Command1_Click()

    Dim DataToSend As String
    Dim objXML As Object
    Dim text As String
    Dim apiKey As String
    Dim mobileno As String
    Dim sender As String
    Dim route As String
    Dim URL As String

'Set these variables
apiKey = "Your api key";

mobileno  = "9999999999";

'Sender ID,sender id should be 6 characters long asign to to your account.
sender = "TESTIN";

' this url encode function may not work fully functional.
text = URLEncode(" Your message ")

'Define route
route = ""
' do not use https
URL = "https://app.rpsms.in/api/push.json?"

Set objXML = CreateObject("Microsoft.XMLHTTP")
objXML.Open "POST", URL , False
objXML.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"

objXML.send "apikey=" + apiKey + "&mobileno=" + mobileno + "&text=" + text + "&sender=" + sender + "&route=" + route

 If Len(objXML.responseText) > 0 Then
        MsgBox objXML.responseText

 End If

End Sub

Function URLEncode(ByVal Text As String) As String
    Dim i As Integer
    Dim acode As Integer
    Dim char As String

    URLEncode = Text

    For i = Len(URLEncode) To 1 Step -1
        acode = Asc(Mid$(URLEncode, i, 1))
        Select Case acode
            Case 48 To 57, 65 To 90, 97 To 122
                ' don't touch alphanumeric chars
            Case 32
                ' replace space with "+"
                Mid$(URLEncode, i, 1) = "+"
            Case Else
                ' replace punctuation chars with "%hex"
                URLEncode = Left$(URLEncode, i - 1) & "%" & Hex$(acode) & Mid$ _
                    (URLEncode, i + 1)
        End Select
    Next

End Function

JAVA FOR XML
import java.io.*;
import java.net.URL;
import java.net.HttpURLConnection;

class Functions
{

	public static String hitUrl(String urlToHit, String param)
    	{
        	try
        	{
                URL url = new URL(urlToHit);
                HttpURLConnection http = (HttpURLConnection)url.openConnection();
                http.setDoOutput(true);
                http.setDoInput(true);
                http.setRequestMethod("POST");

                DataOutputStream wr = new DataOutputStream(http.getOutputStream());
                wr.writeBytes(param);
                // use wr.write(param.getBytes("UTF-8")); for unicode message's instead of wr.writeBytes(param);

                wr.flush();
                wr.close();
                http.disconnect();


                BufferedReader in = new BufferedReader(new InputStreamReader(http.getInputStream()));
                String inputLine;
                if ((inputLine = in.readLine()) != null)
                {
                        in.close();
                        return inputLine;
                }
                else
                {
                        in.close();
                        return "-1";
                }

            }
            catch(Exception e)
            {
                System.out.println("Exception Caught..!!!");
                e.printStackTrace();
                return "-2";
            }
        }
}

PHP
<?php

//Your api key
$apiKey = "YourApiKey";

//Multiple mobiles numbers separated by comma
$mobileno = "9999999";

//Sender ID,sender id should be 6 characters long asign to to your account.
$sender = "ALTSMS";

//Your message to send, Add URL encoding here.
$text = "Test message";

//define route (leave blank if single route asign) 
$route = "";
//Prepare you post parameters
$postData = array(
    'apikey' => $apiKey,
    'mobileno' => $mobileno,
    'text' => $text,
    'sender' => $sender,
    'route' => $route
);

//API URL
$url="https://app.rpsms.in/api/push.json";

// init the resource
$ch = curl_init();
curl_setopt_array($ch, array(
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_POSTFIELDS => $postData
    //,CURLOPT_FOLLOWLOCATION => true
));


//Ignore SSL certificate verification
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);


//get response
$output = curl_exec($ch);

//Print error if any
if(curl_errno($ch))
{
    echo 'error:' . curl_error($ch);
}

curl_close($ch);

echo $output;
?>

Google Appscript Sample Code
//write this code in your .gs file
//Your authentication key
var apiKey = "YourApiKey";

//Multiple mobiles numbers separated by comma
var mobileno = "9999999";

//Sender ID,sender id should be 6 characters long asign to to your account.
var sender = "ALTSMS";

//Your message to send, Add URL encoding here.
var text = "Test message";

//Define route
var route = "";


var payload = {
        "apikey": apiKey,
        'mobileno' : mobileno,
        'text' : text,
        'sender' : sender,
        'route' : route
};

var options = {
    "method": "post",
    "payload": payload
};

var res = UrlFetchApp.fetch("https://app.rpsms.in/api/push.json?", options);

var resAsTxt = '' + res + '';

Logger.log(resAsTxt)

Secure, Robust and effortlessly easy SMS API
to send and track SMS instantly

AND 500 SMS FREE

FOR EVERY DEVELOPER
Click Here