MekongSMS API Doc v2.1 Sandbox
MekongSMS API Doc v2.1 Sandbox
MekongSMS API Doc v2.1 Sandbox
Documentation
Table of Content
Introduction ........................................................................... 1
Send Message ........................................................................ 2
Check Account Balance .......................................................... 7
How to Download Deliver Report ………………………………………. 8
Introduction
This document provides developers with instructions for integrating MekongSMS service
into various solutions using HTTP(S) Application Programming Interface (HTTP(S) API).
HTTP(S) API can be used for sending message and collection reports.
Version: 2.1
2 MekongSMS API Documentation
Send Message
1. HTTP(S) GET Request Method
API URL: http(s)://sandbox.mekongsms.com/api/sendsms.aspx
Query String Parameters:
PARAMETER DESCRIPTION
username Your MekongSMS user account
(xxx@apitest)
pass MD5 hash string of your MekongSMS password
sender Dynamic message sender ID.
Alphanumeric string: max length 11 characters
smstext Message body
gsm Message destination address. (maximum 50 numbers)
Example: (85598123456;85512xxxxxx; +6523232323)
int Can be “0” or “1”
0 or Not include if we want to send only local number
1 - Enable sending to international numbers (domestic and international)
cd Custom Data (optional parameter and maximum 100 characters)
Return Values:
DESCRIPTION
0 Successful, sent message ID is the return value
0[Success]
101 Invalid User or pass
103 Invalid Phone Number Format
102 Missing or Invalid parameter
104 Missing or Invalid Destination address
105 Missing SMS Text
106 Not enough credits in user account
108 Network Problem
109 Account has no API access
110 Account was expired
111 Access Denies Sender ID
999 General System Error
Sample:
Version: 2.1
3 MekongSMS API Documentation
Let’s say you would like to use your account testing@apitest to send text SMS “hello” to
phone number +85598123456,+85512345678 and international , and you would like to
display “Friend” as your sender name.
Note:
(1) You can send to multiple numbers in a single request, simply use semi-colon (;) to
separate them.
(2) You will get multiple return values (separated by SPACE) when you have multiple phone
numbers in a single request.
The API will remove all numbers less than 8 characters, then accept only the following
formats:
Numbers will be first processed as a local number using the same accepted format as in
INT=0. However, if INVALID, then any number with length between 10-16 (excluding +
and numbers starting with 855) will be assumed to be an international number.
(4) You can use custom data (cd) for your optional data insert when you do transaction
SMS.
(5) For Production Account or Live account will be use with difference URL and username &
password.
Version: 2.1
4 MekongSMS API Documentation
void SendSMS(string username, string passMD5,string custdata ,string GSMPhone, string sender, string
TextMessage)
{
try
{
string tmp = "";
string urlSms = "http(s)://sandbox.mekongsms.com/api/sendsms.aspx?username=" + username +
"&pass=" + passMD5 +"&cd ="+ System.Web.HttpUtility.UrlEncode (custdata) +"&sender=" + sender +
"&smstext=" + System.Web.HttpUtility.UrlEncode (TextMessage) + "&gsm=" + GSMPhone;
Uri uri = new Uri(urlSms);
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(uri);
request.Method = WebRequestMethods.Http.Get;
request.ContentType = "application/x-www-form-urlencoded";
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
StreamReader reader = new StreamReader(response.GetResponseStream());
//tmp will be content that was returned by mekongsms
response.Close();
}
catch (Exception ex)
{ //any exception catch }
}
Return Values:
DESCRIPTION
0 Successful, sent message ID is the return value
0[Success]
Version: 2.1
5 MekongSMS API Documentation
Sample:
Let’s say you would like to use your account testing@apitest to send text SMS “hello” to
phone number +85598123456 and +85512345678, and you would like to display
“Friend” as your sender name.
You will have to send HTTP(S) Post request to following URL:
http(s)://sandbox.mekongsms.com/api/postsms.aspx
Note:
(1) You can send to multiple numbers in a single request, simply use semi-colon (;) to
separate them.
(2) You will get multiple return values (separated by SPACE) when you have multiple phone
numbers in a single request.
The API will remove all numbers less than 8 characters, then accept only the following
formats:
Numbers will be first processed as a local number using the same accepted format as in
INT=0. However, if INVALID, then any number with length between 10-16 (excluding +
and numbers starting with 855) will be assumed to be an international number.
Version: 2.1
6 MekongSMS API Documentation
(4) You can use custom data (cd) for your optional data insert when you do transaction
SMS.
(5) For Production Account or Live account will be use with difference URL and Username &
Password.
void SendSMS(string username, string passMD5, string custdata ,string GSMPhone, string sender, string
TextMessage)
{
try
{
string tmp = "";
string urlSms = "http(s)://sandbox.mekongsms.com/api/postsms.aspx";
string postParam = "username=" + username + "&pass=" + passMD5 +"&cd=" +
System.Web.HttpUtility. UrlEncode (custdata) + "&sender=" + sender + "&smstext=" +
System.Web.HttpUtility. UrlEncode (TextMessage) + "&gsm=" + GSMPhone;
Uri uri = new Uri(urlSms);
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(uri);
request.Method = WebRequestMethods.Http.Post;
request.ContentType = "application/x-www-form-urlencoded";
StreamWriter writer = new StreamWriter(request.GetRequestStream());
writer.Write(postParam);
writer.Close();
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
StreamReader reader = new StreamReader(response.GetResponseStream());
tmp = reader.ReadToEnd();
//tmp will be content that was returned by mekongsms
response.Close();
}
catch (Exception ex)
{
//any exception catch
}
}
Version: 2.1
7 MekongSMS API Documentation
Return Values:
VALUE DESCRIPTION
(Number) Your available account credits
Return Values:
VALUE DESCRIPTION
(Number) Your available account credits
Version: 2.1
8 MekongSMS API Documentation
THANK YOU
Version: 2.1