Startup Plan
Welcome to Sanchar SMS

SMS API

A SMS API is all around characterized programming interface which empowers code to send short messages through a SMS Gateway.

As the frameworks for SMS communications and the web are generally separated, SMS APIs are frequently used to 'overcome any barrier' between telecommunications transporter systems and the more extensive web. SMS APIs are utilized to permit web applications to effortlessly send and get instant messages through rationale composed for standard web systems.

Don’t have a developer to integrate SMS communication into your business? Why spending your money on unnecessary services when you can seek help from professionals. Sanchar SMS can help you with SMS API to make integration easier with no coding and other skills required. Our website is built to help you connect with your customers and potential clients. We help you improve your customer services and save bucks on marketing costs through SMS API services. We let you set up a direct connection between your target audience and your staff. Our fast and reliable SMS API services will help you get the convenience of delivery and setting up local support. Now, get well-rounded SMS API services and improve your business communications with your clients.



Quickly Integrate an SMS API With Your Business

Process to generate API key:

  • Select “Generate API Key” in ‘Settings’.
  • Click on “Generate”.
  • Allow IP: no (If required: yes).
  • Add Remarks.
  • Click on “Add”.
  • Copy the ‘Generated API Key’ from below generated list and paste it in the URL as mentioned above.
  • To See full documentation download the PDF file by clicking this button


Download PDF
sanchar-sms



Send an SMS using the Programmable SMS API -

PHP JAVA Python ASP C#

<?php 
    // Account details
    $apiKey = urlencode('Your apiKey'); // generate your API key in your account Process to generate API key
    // Message details
    $mobiles = urlencode(''); // Mobile-Number
    $senderid = urlencode(''); // Sender ID
    $sms = rawurlencode('This is your message');
        
    // Prepare data for POST request
    $data = 'apikey=' . $apiKey . '&mobiles=' . $mobiles . "&senderid=" . $senderid . "&sms=" . $sms;

    // Send the GET request with cURL
    $ch = curl_init('http://enterprise.sancharsms.in/sendsms.jsp?'. $data);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $response = curl_exec($ch);
    curl_close($ch);
    // Process your response here
    echo $response;
    ?>

    import java.io.BufferedReader;
        import java.io.InputStreamReader;
        import java.io.OutputStreamWriter;
        import java.net.URL;
        import java.net.URLConnection;
        import java.net.URLEncoder;
            
public class sendSMS {
        public String sendSms() {
                try {
        // Construct data
String apiKey = "apikey=" + URLEncoder.encode("yourapiKey", "UTF-8"); // generate your api key in account settings
        String sms = "&sms=" + URLEncoder.encode("This is your message", "UTF-8");
        String senderid = "&senderid=" + URLEncoder.encode("", "UTF-8"); // Your Sender-id
        String mobiles = "&mobiles=" + URLEncoder.encode("", "UTF-8"); // mobile-number
        
        // Send data
        String data = "http://enterprise.sancharsms.in/sendsms.jsp?" + apiKey + mobiles + senderid + sms;
        URL url = new URL(data);
        URLConnection conn = url.openConnection();
        conn.setDoOutput(true);
        
        // Get the response
        BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
        String line;
        String sResult="";
        while ((line = rd.readLine()) != null) {
        // Process line...
            sResult=sResult+line+" ";
        }
        rd.close();
        
        return sResult;
    } catch (Exception e) {
        System.out.println("Error SMS "+e);
        return "Error "+e;
    }
}
}

#!/usr/bin/env python

import urllib.request
import urllib.parse
    
def sendSMS(apikey, mobiles, senderid, sms):
    params = {'apikey': yourapiKey, 'mobiles': numbers, 'senderid': senderid, 'sms': sms}
    f = urllib.request.urlopen('http://enterprise.sancharsms.in/sendsms.jsp?'
        + urllib.parse.urlencode(params))
    return (f.read(), f.code)
    
resp, code = sendSMS('apikey', '919100000000',
    'Test-SMS', 'Test')
print (resp)

    

<%
    apikey = "your apiKey"
    address = "http://enterprise.sancharsms.in/sendsms.jsp?"
    sms = "This is your message"
    sms = Server.urlencode(sms)
    mobiles = "" // Your Mobile Number
    senderid = "" // Your Senderid
    url = address & "apikey=" & apikey & "&mobiles=" & mobiles & "&senderid=" & senderid & "&sms=" & sms 
    set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP")
    xmlhttp.open "GET", url, false
    xmlhttp.send ""
    msg = xmlhttp.responseText
    response.write(msg)
    set xmlhttp = nothing
%>
        

using System;
using System.Collections.Generic;
using System.Net;
using System.Collections.Specialized;
using System.IO;
    
namespace sendSMS
{
    class sendSMS
    {       
        public string sendSMS()
        {
        String result;
        string apiKey = "your apiKey";
        string mobiles = "918123456789"; // in a comma seperated list
        string sms = "This is your message";
        string senderid = ""; // Your senderid
    
        String url = "http://enterprise.sancharsms.in/sendsms.jsp?apikey=" + apiKey + "&mobiles=" + mobiles + "&senderid=" + senderid + "&sns=" + sms;
        //refer to parameters to complete correct url string
    
        StreamWriter myWriter = null;
        HttpWebRequest objRequest = (HttpWebRequest)WebRequest.Create(url);
    
        objRequest.Method = "POST";
        objRequest.ContentLength = Encoding.UTF8.GetByteCount(url);
        objRequest.ContentType = "application/x-www-form-urlencoded";
        try
        {
            myWriter = new StreamWriter(objRequest.GetRequestStream());
            myWriter.Write(url);
        }
        catch (Exception e)
        {
            return e.Message;
        }
        finally
        {
            myWriter.Close();
        }
    
        HttpWebResponse objResponse = (HttpWebResponse)objRequest.GetResponse();
        using (StreamReader sr = new StreamReader(objResponse.GetResponseStream()))
        {
            result = sr.ReadToEnd();
            // Close and clean up the StreamReader
            sr.Close();
        }
        return result;
        }  
    }
}