Introduction

SpeedSMS allows you to integrate features of sending messages into your apps. You can integrate SMS API into your website, desktop or mobile apps. SpeedSMS API is commensurate with all of programming languages such as C#, ASP.NET, PHP, Java,... SpeedSMS API guarantees quickness, simplicity, trustworthiness and is easy to integrate into any systems.

API Access Token

To use SMS API, you need to register an account at: https://connect.speedsms.vn.

Each registered account will be provided an API access token. Your apps will use this token to authenticate with SpeedSMS API

To get API access token, you need to log in at: https://connect.speedsms.vn, Access to menu category: "Settings" select "Profile"

Error Codes

  • 007: IP locked
  • 008: Account blocked
  • 009: Account not allow to call the API
  • 101: Invalid or missing parameters
  • 105: Phone number invalid
  • 110: Not support sms content encoding
  • 113: Sms content too long
  • 300: Your account balance not enough to send sms
  • 500: Internal error, please try again

Integrating API (SMS & VOICE OTP)

SpeedSMS provides available codes for programming languages such as PHP,  Java, C#, NodeJS, which helps you to save time and start integrating SMS immediately. Please select language commensurate with your apps below to download SpeedSMS code.
PHP

Sample Code for PHP

Click link below to download sample code

Download PHP Code

Java
C#
NodeJS

Below is the instruction on how to integrate SpeedSMSAPI into your code:

PHP

/*
 * Firstly, you need to include SpeedSMS's library by inserting the following code lines:
*/
require("SpeedSMSAPI.php");

/**
 * Then, create an instance of SpeedSMSAPI class and pass your parameter into api access token.
 */
$smsAPI = new SpeedSMSAPI("Your access token");
/**
 * To get information into your account like email, account balance, you need to use the function: getUserInfo()
 */

$userInfo = $smsAPI->getUserInfo();
/* * GetUserInfo() will return the result as follows:
 * /
["email"=>"[email protected]", "balance" =>100000.0, "currency" => "VND"]

/** To send sms, you use the function of sendsms as follows :
*/
$phones = ["8491xxxxx", "8498xxxxxx"]; 
/* up to 100 phone numbers for one time of API calling */
$content = "test sms";
$type = sms_type
/**
sms_type has the following values:
2: message sent by random phone number
3: message sent by branndname
4: message sent by default brandname (verify or notify)
5: message sent by android app
*/
$sender = "brandname";
/**
brandname is a kind of brand or phone number that is registered with SpeedSMS*/

$response = $smsAPI->sendSMS($phones, $content, $type, $sender);

/**SendSMS will return the result as follows:*/
[
   "status"=>"success", "code"=> "00", 
   "data"=>[
    "tranId"=>123456, "totalSMS"=>2,     
     "totalPrice"=>500, "invalidPhone"=>[] 
      ]
]
*/
// In case of failing to send voice otp, the function will return the result as follows:
[
"status"=>"error", "code"=>"error code", "message" => "error description",
"invalidPhone"=>["A list of failed number"]
]

/** To send VOICE OTP, you use sendvoice function as follows:
*/
$phone = "8491xxxxx"; 
$content = "xxxx";
/* The content only contains the code,ex: 1234 */
$response = $smsAPI->sendVoice($phone, $content);

/**Sendvoice will return the result as follows::*/
[
   "status"=>"success", "code"=> "00", 
   "data"=>[
    "tranId"=>123456,     
     "totalPrice"=>400, "invalidPhone"=>[] 
      ]
]
*/
// In case of failing to send voice otp, the function will return the result as follows:
[
"status"=>"error", "code"=>"error code", "message" => "error description",
"invalidPhone"=>["a list of failed number"]
]
Java
C#
NodeJS
Curl

Delivery Status Report

Almost all people have the same concern whether messages can be sent to customers or customers can receive the message when using SMS API service

We are worried about whether customers receive messages or not in case we send important information to clients. SpeedSMS will help you tackle this problem with the feature of Delivery status report. When messages are sent successfully or failed to send (in case mobile phone runs out of battery or is out of coverage area) to customers, SpeedSMS will inform you by sending a HTTP Post to url address that you have given to SpeedSMS (known as Webhook).

To use the feature of delivery report, firstly you need to log in dashboard page at http://connect.speedsms.vn. Select menu Setting ->Webhook , then declare an url address to receive request from SpeedSMS when messages are sent successfully to customers.

When messages are sent successfully to customers, SpeedSMS will send a HTTP Post to an url that you have provided: {"type": "report", "tranId": "transaction id", "phone": "phone number", "status": "status success/failed"} including:

  • Type: to differentiate between delivery report announcement and incoming sms announcement
  • tranld: is a transaction id that you get after calling API/sms/send
  • phone: is the customer' phone number
  • status informs you whether messages are sent successfully to customer
    • status = 0: success
    • 0 < status < 64 temporary fail
    • status >= 64: failed
      • ví dụ: {"type": "report", "tranId": 1234, "phone": "0912345678", "status": 0} //success
        • hoặc: {"type": "report", "tranId": 1234, "phone": "0912345678", "status": 69} //fail (in case mobile phone runs out of battery or is out of coverage area, or phone number is blocked)

Receiving Feedback Messages

Customers can reply the message if they receive your message. So, you can receive feedback messages from customers.

Like delivery report, you need to declare an url address to receive request from SpeedSMS when customers send feedback message to you.

When receiving feedback messages from customers, SpeedSMS will send a HTTP Post to an url address that you have provided: {"type": "sms", "phone": "phone number", "content": "sms content"} Including:

  • Type: to differentiate between delivery report announcement and incoming sms announcement
  • phone: is the customer' phone number
  • content: the message content