Send Zalo Trading message

HTTP request

POST https://rest.esms.vn/mainservice.svc/json/SendZaloFollowerMessage_V5_post_json/

  • Content Type: application/json

  • Response Type: application/json

curl --location 'https://rest.esms.vn/mainservice.svc/json/SendZaloFollowerMessage_V5_post_json/' \
--header 'Content-Type: application/json' \
--data '{
    "ApiKey": "{{ApiKey}}",
    "SecretKey": "{{SecretKey}}",
    "OAID": "{{OAID}}",
    "CallbackUrl": "{{CallbackUrl}}",
    "Sandbox":0,
    "Payload": {
        "recipient": {
            "user_id": "{{user_id}}"
        },
        "message": {
            "attachment": {
                "type": "template",
                "payload": {
                    "template_type": "{{template_type}}",
                    "language": "{{language}}",
                    "elements": [
                        {
                            "image_url": "{{image_url}}",
                            "type": "banner"
                        },
                        {
                            "type": "header",
                            "content": "{{content}}",
                            "align": "{{align}}"
                        },
                        {
                            "type": "text",
                            "align": "{{align}}",
                            "content": "{{content}}"
                        },
                        {
                            "type": "table",
                            "content": [
                                {
                                    "value": "{{value}}",
                                    "key": "{{key}}"
                                },
                                {
                                    "value": "{{value}}",
                                    "key": "{{key}}"
                                },
                                {
                                    "style": "{{style}}",
                                    "value": "{{value}}",
                                    "key": "{{key}}"
                                },
                                {
                                    "value": "{{value}}",
                                    "key": "{{key}}"
                                },
                                {
                                    "value": "{{value}}",
                                    "key": "{{key}}"
                                },
                                {
                                    "value": "{{value}}",
                                    "key": "{{key}}"
                                }
                            ]
                        },
                        {
                            "type": "text",
                            "align": "{{align}}",
                            "content": "{{content}}"
                        }
                    ],
                    "buttons": [
                        {
                            "title": "{{title}}",
                            "image_icon": "{{image_icon}}",
                            "type": "oa.open.url",
                            "payload": {
                                "url": "{{url}}"
                            }
                        },
                        {
                            "title": "{{title}}",
                            "image_icon": "{{image_icon}}",
                            "type": "oa.query.show",
                            "payload": "{{payload}}"
                        },
                        {
                            "title": "{{title}}",
                            "type": "oa.open.sms",
                            "payload": {
                                "content": "{{content}}",
                                "phone_code": "{{phone_code}}"
                            }
                        },
                    
                        {
                        "title": "{{title}}",
                        "image_icon": "{{image_icon}}",
                        "type": "oa.open.phone",
                        "payload": {
                            "phone_code": "{{phone_code}}"
                        }
                    }
                ]
            }
        }
    }
}
}'
  • Body request

Parameters
Type
Required
Description

ApiKey

string

Your API Key.

SecretKey

string

Your Secret Key

OAID

string

Zalo OA Id is the Zalo Official Account Id of the organization. It can be obtained by accessing to the Zalo administrator page.

Note: Pre-registration is required.

user_id

string

The identification value of user at Zalo.

CallbackUrl

string

The webhook URL that will receive the status of message after it processed to the operator. It is used for determine whether the SMS is succcessfully delivered to the receiver or failed. See the sample request at here. More details at here.

template_type

string

Type of template: - transaction_billing - transaction_order - transaction_reward - transaction_contract - transaction_booking - transaction_membership - transaction_event - transaction_transaction - transaction_account - transaction_internal - transaction_partnership - transaction_education - transaction_rating

language

string

Message languague values. Giá trị nhận vào:

  • language = VI

or

  • language = EN

The default content of template will be transfered corresponding to the selected languague.

image_url

string

The image URL.

align

string

Align the content:

  • left (or blank): Align to left.

  • center: Align to center.

  • right: Align to right.

table

string

The structure of an element in table { "key": "key" // maxlength = 25 "value": "the value of key" // maxlength = 100 }

It is mandantory to have one of the two element below: VI: { "key": "Mã..." // Start with "Mã", use for identify. "value": "The value of key" }

EN: { "key": "...Code..." // It is mandantory to have the string "Code" inside. "value": "The value of key" } Or: VI:

{ "key": "Tên khách hàng" //It is fixed with the value "Tên khách hàng",

"value": "The vlaue of key" }

EN:

{ "key": "Customer Name" // It is fixed with value "Customer Name" ,

"value": "The value of key" } Key “Trạng thái” / “Status” is the only one key that can use the "Style" paramter: VN: { "key": "Trạng thái" //it is fixed with value "Trạng thái" "value": "the value of key" "style": "yellow" // Accepted values: green, blue, yellow, red, grey }

EN: { "key": "Status" // It is fixed with value "Status" "value": "the value of key" "style": "yellow" // Accepted values: green, blue, yellow, red, grey }

****Note: Maximun 5 elements can be declared.

button

string

Maximun 4 buttons can be added.

Sandbox

string

Sandbox option value (default is 0): 1: For testing purpose to verify the validation of the request. Message is not charged and sent to the receiver. 0: Message will be processed to the receiver properly.


  • Response

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

Valid request.

  • Response body

Parameter
Type
Description

CodeResult

string

Response code.

SMSID

string

The message id of eSMS system.

ErrorMessage

string

The error message if the request is invalid.

Last updated