eSMS for Developers
Đăng nhập
EN - eSMS for Developers
EN - eSMS for Developers
  • Overview
    • Getting started
    • Mechanism
    • Access to the API information
  • eSMS API
    • Send SMS API
      • Send OTP/Customer care message
      • Send adveritising message
      • Send message via Zalo
      • Send message via Viber
      • Send fixed number with cheap price
      • Send multi-channel message via Zalo and SMS
      • Send personized message via Zalo
      • Send Zalo message Consulting in text form
      • Send Zalo message with attached photo
      • Send Zalo message Consulting button
      • Send Zalo Trading message
      • Send Zalo messages to request user's information
      • Send Journey ZNS message
      • Send auto-generated SMS
      • The multichannel auto-generated OTP
    • Retrive and register functions
      • Get balance
      • Get the message status
      • Get SMS by SMSID
      • Get message details
      • Get list registered brandnames
      • Get list customer care templates
      • Summary your customer care submit
      • Summary your advertising submit
      • Get list OA
      • Get list templates of OA
      • Summary Zalo message
      • Get the daily quota of OA
      • Get rating information of Zalo users
      • Check the OA quality
      • Get list Zalo's followers
      • Get callback data
      • Get Zalo template details
      • Purchase OA package
      • Registering the Zalo template
      • Registering SMS template
    • Other APIs
      • Send customer care message using GET
      • Send customer care message using POST X-Form
      • Send customer care message using POST TEXT
      • Send fixed number using GET
      • Send advertising message using POST TEXT
      • Send Zalo message (old version)
      • Send Zalo message using POST X-FORM
      • Send Zalo message full template
      • Send Viber message using GET
      • Check code
    • Svoucher Connect
      • Connect to shortcode service
    • Voice
      • Create voice OTP call
      • Create an auto-call using template
      • Create a call from recording file
      • Get voice call status
    • Table of error codes
    • Test environment ( Sandbox)
    • Callback Url
Powered by GitBook
On this page
  • 1: Thông tin kết nối:
  • Bước 1: Khi khách hàng gửi tin nhắn lên đầu số ngắn, phía eSMS sẽ gọi 1 request như bên dưới sang đối tác
  • Bước 2: Đối tác xử lý request này và trả về thông tin có dạng sau:
  • 2. Tạo khóa bí mật:
  • Mã lệnh mẫu
  1. eSMS API
  2. Svoucher Connect

Connect to shortcode service

1: Thông tin kết nối:

Bước 1: Khi khách hàng gửi tin nhắn lên đầu số ngắn, phía eSMS sẽ gọi 1 request như bên dưới sang đối tác

HTTP GET
http://domain.abc/receive_mo?sender={{sender}}&content={{content}}&serviceNumber={{serviceNumber}}&keyword={{keyword}}&sign={{sign}}&cpid={{cpid}}&smsid={{smsid}}&receiverTime={{receiverTime}}

Trong đó:

  • http://domain.abc/receive_mo : là link mà đối tác cung cấp cho eSMS để nhận các tin nhắn MO từ khách hàng

Tham số
Kiểu
Mô tả

string

Là mã định danh CP do eSMS cung cấp. Bao gồm CPID và PrivateKey

string

chữ ký số, tạo bởi chuỗi bí mật của ứng dụng tương ứng cpid

string

là một chuỗi do eSMS.vn cung cấp. Đây là số duy nhất tương ứng với một tin nhắn. Số này dùng để kiểm tra các trường hợp trùng và đối chiếu đối soát về sau.

string

số điện thoại khách hàng, định dạng quốc tế (có 84)

string

đầu số dịch vụ (8041, 8079, 6088, ...)

string

từ đầu tiên trong cú pháp MO

string

nội dung mà khách hàng nhắn

string

Thời gian nhận được MO, có format yyyyMMddhhmmss

Bước 2: Đối tác xử lý request này và trả về thông tin có dạng sau:

<ClientResponse>
   <Message>Nội dung tin nhắn trả về</Message>
   <Smsid>ID của tin nhắn gửi lên</Smdid>
   <Receiver>Số điện thoại người nhận</Receiver>
</ClientResponse>

2. Tạo khóa bí mật:

Sign: được băm từ 5 tham số: Cpid, smsid, content, receiveTime và PrivateKey hashValue(value1, value2,…) = MD5(value1 + value2 + … + private_key) Ví dụ: đối tác A sử dụng dịch vụ X có khóa bí mật là 17417a0d20114d36a902e49cad0e97f3 thì giá trị băm được tính như sau: hash("abcdef", "1234", "xyz") = MD5("abcdef1234xyz17417a0d20114d36a902e49cad0e97f3"); Format thời gian: giá trị thời gian được truyền dưới định dạng sau: yyyyMMddhhmmss. Ví dụ ngày 28 tháng 2 năm 2013, lúc 13 giờ 01 phút 01 giây: 20130228130101

Mã lệnh mẫu

Trong việc giao tiếp giữa client và server, có một giá trị băm gửi gửi kèm để đảm bảo toàn bộ các thông tin là chính xác. Đoạn lệnh mẫu tính giá trị băm xin tham khảo dưới đây.

  • .NET

string GetHash(string s)
{
  UTF8Encoding ue = new UTF8Encoding();
  byte[] v = ue.GetBytes(s);
  byte[] hashValue = new MD5CryptoServiceProvider().ComputeHash(v);
  return Convert.ToBase64String(hashValue);
}
  • Java

String getHash(String sSrc) throws Exception {
  Charset utf8Charset = Charset.forName("UTF-8");
  byte[] textBytes = sSrc.getBytes(utf8Charset);
  MessageDigest m = MessageDigest.getInstance("MD5");
  byte[] digest = m.digest(textBytes);
  String sEncodedText = B64.b64encode(digest);
  return sEncodedText;
} 
  • PHP

<?php
    $str = 'qwertyuiop';
    $hash = base64_encode(md5($str, true));
?>
PreviousSvoucher ConnectNextVoice
cpid
sign
smsid
sender
serviceNumber
keyword
content
receiverTime