How to Send SMS Through API

Alpha SMS API can be used by both GET and POST Method. You can send SMS from your software or application by integrating Alpha SMS API. Just follow the code samples below to send SMS API from your applications. To obtain your API Key, please login to your SMS Panel & go to "API" page, you will get your API KEY here. Now you have to follow the instructions below:

Send SMS
Endpoint
https://api.sms.net.bd/sendsms
Parameters
Name Meaning
api_key Required. Your API KEY is used to authenticate in our system.
msg Required. The body content of your message.
to Required. The recipient numbers. Multiple numbers must be separated by comma(,). The Number must start with country code(880) or Standard 01X.
schedule Optional. The schedule date and time to send your message. Date and time must be formatted as Y-m-d H:i:s (eg. 2021-10-13 16:00:52 )
sender_id Optional. If you have an approved Sender ID, you can use this parameter to set your Sender ID as from in you messages.
Request
https://api.sms.net.bd/sendsms?api_key={YOUR_API_KEY}&msg={YOUR_MSG}&to=8801800000000,8801700000000&schedule=2021-10-13 16:00:52
Response

{
    "error": 0,
    "msg": "Request successfully submitted",
    "data": {
        "request_id": 0000
    }
}
Report API
Endpoint
https://api.sms.net.bd/report/request/{id}/
Parameters
Name Meaning
api_key Required. Your API KEY is used to authenticate in our system.
Request
https://api.sms.net.bd/report/request/{id}/?api_key={YOUR_API_KEY}
Response

{
  "error": 0,
  "msg": "Success",
  "data": {
    "request_id": 0000,
    "request_status": "Complete",
    "request_charge": "0.0000",
    "recipients": [
      {
        "number": "8801800000000",
        "charge": "0.0000",
        "status": "Sent"
      }
    ]
  }
}
Balance API
Endpoint
https://api.sms.net.bd/user/balance/
Parameters
Name Meaning
api_key Required. Your API KEY is used to authenticate in our system.
Request
https://api.sms.net.bd/user/balance/?api_key={YOUR_API_KEY}
Response

{
  "error": 0,
  "msg": "Success",
  "data": {
    "balance": "00.0000"
  }
}
Error Codes
Common Errors
Error - 0 Success. Everything worked as expected.
Error - 400 The request was rejected, due to a missing or invalid parameter.
Error - 403 You don't have permissions to perform the request.
Error - 404 The requested resource not found.
Error - 405 Authorization required.
Error - 409 Unknown error occurred on Server end.
Send SMS Errors
Error - 410 Account expired
Error - 411 Reseller Account expired or suspended
Error - 412 Invalid Schedule
Error - 413 Invalid Sender ID
Error - 414 Message is empty
Error - 415 Message is too long
Error - 416 No valid number found
Error - 417 Insufficient balance
Error - 420 Content Blocked

WordPress Plugin

Keep your customers happy with automated SMS order notifications, right within WordPress! Alpha SMS is a WordPress plugin that allows you to send status updates about the order by sending an SMS to your customers. This plugin is designed for sending bulk SMS messages to your users, creating a marketing channel to get in direct contact with your users.

Download Learn More
wp sms plugin

SMS API Codes samples in popular languages.

We have included code samples for sending SMS in PHP, C#, Python, Java, NodeJS etc. Choose your choice of Language from the tabs below to view SMS API Code samples.


curl -X "POST" https://api.sms.net.bd/sendsms \
     -d api_key=YOUR_API_KEY \
     -d msg=Test \
     -d to=8801800000000
import requests

url = "https://api.sms.net.bd/sendsms"

payload = {'api_key': 'YOUR_API_KEY',
    'msg': 'Test',
    'to': '8801800000000'
    }

response = requests.request("POST", url, data=payload)

<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api.sms.net.bd/sendsms',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS => array('api_key' => 'YOUR_API_KEY','msg' => 'Test','to' => '8801800000000'),
));

$response = curl_exec($curl);

curl_close($curl);

Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.post("https://api.sms.net.bd/sendsms")
  .multiPartContent()
  .field("api_key", "YOUR_API_KEY")
  .field("msg", "Test")
  .field("to", "8801800000000")
  .asString();

var request = require('request');
var options = {
  'method': 'POST',
  'url': 'https://api.sms.net.bd/sendsms',
  formData: {
    'api_key': 'YOUR_API_KEY',
    'msg': 'Test',
    'to': '8801800000000'
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});


//Adding Library
using System.Net.Http;
using System.Net.Http.Headers;
using Newtonsoft.Json; //Adding New Package Newtonsoft


public class Program
{
    public static void Main(string[] args)
    {
        using (var client = new HttpClient())
        {
            string API_Url = "https://api.sms.net.bd/sendsms";
            string API_Key = "YOUR_API_KEY";
            string Text_Massage = "YOUR_MSG";
            string To_Phone_Number = "NUMBER_TO_SEND";
    
            client.BaseAddress = new Uri(API_Url);// //
            client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
            var response = client.GetAsync("?api_key=" + API_Key + "&msg=" + Text_Massage + "&to=" + To_Phone_Number).Result;
            using (HttpContent content = response.Content)
            {
                var bkresult = content.ReadAsStringAsync().Result;
                dynamic stuff = JsonConvert.DeserializeObject(bkresult);
                if (stuff.error == "0")
                {
                    Console.WriteLine(stuff.msg);
                }
                else
                {
                    Console.WriteLine("Sms Not Send, " + stuff.msg);
                }

            }
        }
    }
}

Question?

If you need help with selecting the right solution for your business, please call us at 09613-250250 within 9:00AM- 9:00PM or you can start a live chat. We are available 24/7 via live chat.

anyquestion