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. eSMS API
  2. Other APIs

Send Zalo message (old version)

PreviousSend advertising message using POST TEXTNextSend Zalo message using POST X-FORM

Hàm cho phép bạn gửi tin nhắn đến 1 hoặc nhiều số điện thoại đã đăng kí Zalo. Để có thể gửi được tin ZNS bạn cần tiến hành: - Đăng ký và xác thực Zalo Offical Account (Zalo OA) - Đăng ký template tin nhắn Để hoàn thành các việc trên vui lòng liên hệ nhân viên kinh doanh hỗ trợ của bạn hoặc Hotline 0901888484 Ví dụ 1 mẫu tin ZNS

HTTP request

  • Content Type: application/json

  • Response Type: application/json

curl --location 'https://rest.esms.vn/MainService.svc/json/SendZaloMessage_V4_post_json/' \
--header 'Content-Type: application/json' \
--data '{
    "ApiKey": "{{ApiKey}}",
    "SecretKey": "{{SecretKey}}",
    "Phone": "{{Phone}}",
    "Params": [
        "{{value1}}",
        "{{value2}}",
        "{{value3}}"
    ],
    "TempID": "{{TempID}}",
    "OAID": "{{OAID}}",
    "SendDate": "{{SendDate}}",
    "Sandbox": "0",
    "RequestId": "{{RequestId}}",
    "campaignid": "{{campaignid}}",
    "CallbackUrl": "{{CallbackUrl}}"
}'
  • Cấu trúc body của request:

Tham số
Kiểu dữ liệu
Tính bắt buộc
Mô tả

ApiKey

string

ApiKey của tài khoản.

SecretKey

string

Secretkey của tài khoản.

Phone

string

Số điện thoại nhận tin.

Params

string

Giá trị cần truyền cho các biến trong Template *Lưu ý:

  1. Các tham số truyền vào phải đúng thứ tự như template bạn đăng ký

  2. Nếu tham số trùng nhau chỉ cần truyền vào một tham số

TempID

string

Template của Zalo OA mà khách hàng đăng kí với eSMS.

OAID

string

Zalo OA ID, là ID của trang Zalo Offical Account của doanh nghiệp. Doanh nghiệp cần đăng nhập vào trang quản trị của Zalo OA để lấy phần Zalo OA ID này. Chú ý: sẽ phải đăng ký trước khi sử dụng.

SendDate

string

Thời gian hẹn gửi của tin. Không truyền khi tin muốn tin nhắn gửi đi liền. Định dạng: yyyy-mm-dd hh:MM:ss.

Sandbox

string

1: Tin gửi ở môi trường test, dùng để kiểm tra kết nối và các thông số tích hợp, không về tin nhắn, không trừ tiền. 0: Tin gửi ở môi trường bình thường, có về tin nhắn.

RequestId

string

ID Tin nhắn của đối tác, dùng để kiểm tra ID này đã được hệ thống esms tiếp nhận trước đó hay chưa. Ví dụ: RequestId=123456

campaignid

string

Tên chiến dịch gửi tin, tối đa 254 ký tự.

CallbackUrl

string


  • Response:

{
    "CodeResult": "100",
    "CountRegenerate": 0,
    "SMSID": "d8e0f1f0702544b2acb456ca9ccfd111250"
}

Request hợp lệ.

{
    "CodeResult": "101",
    "CountRegenerate": 0,
    "ErrorMessage": "Authorize Failed"
}

Sai thông tin ApiKey/SecretKey.

{
    "CodeResult": "789",
    "CountRegenerate": 0,
    "ErrorMessage": "TemplateId is not config"
}

Template chưa được cấu hình cho OA ID bạn đang sử dụng.

  • Cấu trúc body của response:

Thuộc tính
Kiểu dữ liệu
Mô tả

CodeResult

string

Mã trả về.

SMSID

string

ID tin nhắn do esms trả về.

ErrorMessage

string

Thông tin lỗi trả về (nếu có lỗi).

POST

URL nhận kết quả gửi tin. Xem body mẫu . Xem chi tiết .

Thông tin chi tiết mã lỗi xem ở bảng: .

Lấy code mẫu của các ngôn ngữ ở link: .

https://rest.esms.vn/MainService.svc/json/SendZaloMessage_V4_post_json/
Mã lỗi
Code mẫu
ở đây
ở đây
Một tin ZNS mẫu