0% found this document useful (0 votes)
120 views9 pages

MekongSMS API Doc v2.1 Sandbox

Download as pdf or txt
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 9

MekongSMS API

Documentation

Document Version: 2.1


For API Version: 2.1
Last Updated: 14-Apr-2020
1 MekongSMS API 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.

You will have to send HTTP(S) GET request to following URL:


http(s)://sandbox.mekongsms.com/api/sendsms.aspx?username=
testing@apitest&pass=ba2c72734ae4762148e1970e88c0e7b7&cd=Cust001&sender=F
riend&smstext=hello&gsm=85598123456;85512345678; +6523232323&int=1

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.

(3) (A) Number Format Conditions for INT=0

The API will remove all numbers less than 8 characters, then accept only the following
formats:

xx123456 xx12345670 xx123456 0xx1234567 855xx123456 855xx1234567


8550xx123456 8550xx1234567 +855xx123456 +855xx1234567 +8550xx123456
+8550xx1234567

All remaining formats are INVALID.

(B) Number Format Conditions for INT=1

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.

Sample Code using C#:

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 }
}

2. HTTP(S) POST Request Method


API URL: http(s)://sandbox.mekongsms.com/api/postsms.aspx
Post 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 (at the moment 160 characters)
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]

Version: 2.1
5 MekongSMS API Documentation

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:
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.

(3) (A) Number Format Conditions for INT=0

The API will remove all numbers less than 8 characters, then accept only the following
formats:

xx123456 xx12345670 xx123456 0xx1234567 855xx123456 855xx1234567


8550xx123456 8550xx1234567 +855xx123456 +855xx1234567 +8550xx123456
+8550xx1234567

All remaining formats are INVALID.

(B) Number Format Conditions for INT=1

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.

Sample Code using C#:

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

Check Your Balance


1. HTTP(S) GET Request Method

API URL: http(s)://sandbox.mekongsms.com/api/credits.aspx


Query String Parameters:
PARAMETER DESCRIPTION
username Your MekongSMS user account
(xxx@apitest)
pass MD5 hash string of your MekongSMS password

Return Values:
VALUE DESCRIPTION
(Number) Your available account credits

2. HTTP(S) POST Request Method

API URL: http(s)://sandbox.mekongsms.com/api/postcheckbalance.aspx


Post Parameters:
PARAMETER DESCRIPTION
username Your MekongSMS user account
(xxx@apitest)
pass MD5 hash string of your MekongSMS password

Return Values:
VALUE DESCRIPTION
(Number) Your available account credits

Version: 2.1
8 MekongSMS API Documentation

Download Deliver Reports


1. HTTP(s) GET Request Method
API URL: http(s):// sandbox.mekongsms.com/api/DeliveryDownload.aspx
Query String Parameters:
PARAMETER DESCRIPTION
username Your MekongSMS user account
(xxx@apitest)
pass MD5 hash string of your MekongSMS password
sd Start date example: sd=01-mar-2017
ed End Date example: ed=03-mar-2017

Return Xls Format:


FIELDS DESCRIPTION
No Index number
Campaign# Number of your Campaign SMS
Mobile Operator Mobile operator that number send to
Send To Destination phone number that you send
Sender Text or number that show your sender name
Message Content Message that send
Send Date Date that send SMS
Receive Date Date that receive SMS
Status Text status that feedback from mobile operator
SMS Part Number of Part SMS that send
Custom data Optional Field

THANK YOU

Version: 2.1

You might also like