Send transaction message
POST /SendZNSTxn HTTP/1.1
Host: $BASE_URL.Zalo
Content-Type: application/json
Accept: */*
Content-Length: 458
{
"language": "unknown",
"message": {
"buttons": [
{
"image_icon": "text",
"payload": {
"content": "text",
"phone_code": "text",
"url": "text"
},
"title": "text",
"type": "unknown"
}
],
"content_banner": {
"attachment_id": "text",
"image_url": "text"
},
"content_header": {
"align": "text",
"content": "text"
},
"content_table": [
{
"key": "text",
"style": "text",
"value": "text"
}
],
"content_text": {
"align": "text",
"content": "text"
}
},
"oa_id": "text",
"recipient": {
"user_id": "text"
},
"template_type": "unknown"
}
A successful response
{
"message_id": "text"
}
Request:
curl --location 'BASE_URL.Zalo/SendZNSTxn' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer $API_KEY' \
--data '{
"language": "unknown",
"message": {
"buttons": [
{
"image_icon": "string",
"payload": {
"url": "string"
},
"title": "string",
"type": "unknown"
}
],
"content_banner": {
"attachment_id": "string"
},
"content_header": {
"align": "string",
"content": "string"
},
"content_table": [
{
"key": "string",
"style": "string",
"value": "string"
}
],
"content_text": {
"align": "string",
"content": "string"
}
},
"oa_id": "string",
"recipient": {
"user_id": "string"
},
"template_type": "unknown"
}'
Response:
{
"message_id": "string"
}
Request body structure
language
string
Language used for the message Input value:
language
= WE
or
language
= IN
When selecting a language, the default content of the message will switch to the corresponding language.
buttons
array
CTA buttons (optional, up to 4 buttons)
image_icon
string
Can transmit:
image url of the image
attachment_id after using image upload API
leave blank or “default”: to use Zalo's default icon image
Note: Optimal image size: 100px * 100px
payload
object (mrButtonPayload)
content
phone_code url
title
string
Button Title
Note: Title cannot exceed 35 characters
type
string (thTemplateTxnButtonType)
Type of action that will be performed when the interested person clicks oa.open.url
: Data is a Url that will be opened in the Zalo application when the interested person clicks the button. For example:
{
"image_icon": "string",
"payload": {
"url": "string"
},
"title": "string",
"type": "unknown"
}
Note: The limit for the "title" attribute is 100 characters.
oa.query.show
: Data is a string of characters, for example “#callback_data”. When the interested person clicks the button, the system will send a message containing the content in the data from the interested person to the Official Account. This message will appear in the chat window on the interested person's computer.
Attention:
The limit for the "title" attribute is 100 characters.
The limit for the "payload" attribute is 1000 characters.
oa.query.hide
: Data is a string of characters, for example “#callback_data”. When the interested person clicks the button, the system will send a message containing the content in the data from the interested person to the Official Account. This message will be hidden in the chat window on the interested person's computer.
Attention:
The limit for the "title" attribute is 100 characters.
The limit for the "payload" attribute is 1000 characters.
oa.open.sms
: The json object data contains 2 properties “content” and “phoneCode”. For example:
{
"payload": {
"content": "sting",
"phone_code": "string"
},
"title": "OPEN SMS",
"type": "oa.open.sms"
}
When the interested person clicks on the button, the SMS window on the interested person's phone will open with 2 available information: phone code and message content in data.
Attention:
The limit for the "title" attribute is 100 characters.
The "content" attribute has a limit of 160 characters.
oa.open.phone
: Phone number data will be entered when turning on the calling application, for example:
{
"payload": {
"phone_code": "string"
},
"title": "OPEN PHONE",
"type": "oa.open.phone"
}
When the interested person clicks on the button, the call window on the interested person's phone will open with the available information as the phone number in the data.
Note: The limit for the "title" attribute is 100 characters.
content_banner
object (mrContentBanner)
attachment_id
: ID of the image you want to use (received via the file upload API)
image_url
: Path to the image Supported image formats: jpg and png
Maximum size: 1MB Image aspect ratio (height : width): from 1:5 to 1:1 (square image)
Note: only use 1 of the 2 variables image_url or attachment_id
content_header
object (mrContentHeader)
content
: The content of the header, up to 100 characters.
align
: Accepts 3 values
left (or blank): left margin
center: center margin
right: right margin
content_table
Array
The structure of an element in a table is:
{
"key": "key value", // maxlength = 35
"value": "value of value" // maxlength = 100
}
In which must have 1 of the 2 following elements:
VN:
{ "key": "Mã...", // bắt đầu là "Mã", dùng định danh người nhận "value": "Giá trị tự do" }
EN:
{ "key": "...Code...", // must contain "Code" in key "value": "Free value" }
or
VN:
{ "key": "Tên khách hàng", // key có giá trị cố định "Tên khách hàng" "value": "Giá trị tự do" }
EN:
{ "key": "Customer Name", // key has fixed value "Customer Name" "value": "Free value" }
The "Status" key is the only key currently allowed to use the "Style" parameter:
VN:
{ "key": "Trạng thái" // key có giá trị cố định "Trạng thái" "value": "Giá trị tự do" "style": "yellow" // Giá trị hợp lệ: green, blue, yellow, red, grey }
EN:
{ "key": "Status" // key has fixed value "Status" "value": "Free value" "style": "yellow" // Valid values: green, blue, yellow, red, grey }
Values of "style": green, blue, yellow, red, grey
In addition to the system elements specified above, the developer can declare up to 5 additional arbitrary elements.
content_text
object (mrContentText)
content
: The content of the header, up to 100 characters. align
: Accepts 3 values
left (or blank): left margin
center: margin
id
string
OA ID
recipient
object (mrRecipient)
user_id
: Zalo user ID
template_type
string
transaction_billing
Bill
Billing
All
transaction_order
Order
Order
All
transaction_reward
Earn points
Reward
All
transaction_contract
Contract
Contract
All
transaction_booking
Appointment
Booking
All
transaction_membership
Member
Membership
All
transaction_event
Event
Event
All
transaction_transaction
Transaction
Transaction
All
transaction_account
Account
Account
All
transaction_internal
Internal
Internal
All
transaction_partnership
Partner
Partnership
All
transaction_education
Education
Education
Education and training
transaction_rating
Evaluate
Rating
All
Return data attribute structure
msg_id
string
Notification ID
Last updated