Gửi tin nhắn theo mẫu đính kèm ảnh
Quyền cần có: Quyền gửi tin và thông báo qua OA
HTTP request
URL: https://zns.api.gobysend.com/api/follower/message/send
Method: POST
Content Type: application/json
Response Type: text/json

Example request
curl
-X POST
-H "Content-Type: application/json" -d '{
"recipient": {
"user_id": "2468458835296117922"
},
"message": {
"text": "Zalo đạt 100 triệu người dùng",
"attachment": {
"type": "template",
"payload": {
"template_type": "media",
"elements": [{
"media_type": "image",
"attachment_id": "51586aa2e5a40cfa55b5"
}]
}
}
}
}' "https://zns.api.gobysend.com/api/follower/message/send"
Tham số header
Tham số
Kiểu dữ liệu
Tính bắt buộc
Mô tả
Cấu trúc body của request
Tham số
Kiểu dữ liệu
Tính bắt buộc
Mô tả
recipient
object
yes
Thông tin người nhận
message
object
yes
Nội dung cần gửi
Cấu trúc thuộc tính recipient
Tham số
Kiểu dữ liệu
Tính bắt buộc
Mô tả
user_id
string
yes
ID của người nhận (nhận được thông qua API lấy thông tin người quan tâm, API lấy danh sách người quan tâm)
Cấu trúc thuộc tính message
Tham số
Kiểu dữ liệu
Tính bắt buộc
Mô tả
text
string
yes
Tiêu đề của ảnh
Giới hạn tối đa là 2.000 ký tự
attachment
object
yes
Attachment cần gửi.
Cấu trúc thuộc tính message.attachment
Tham số
Loại
Tính bắt buộc
Mô tả
type
string
yes
Loại attachment.
Giá trị nhận vào bắt buộc:
type = template
payload
object
yes
Chứa payload của attachment muốn gửi.
Cấu trúc thuộc tính message.attachment.payload
Tham số
Loại
Tính bắt buộc
Mô tả
template_type
string
yes
Loại template
Với template gửi thông báo theo mẫu đính kèm ảnh, giá trị nhận vào là:
template_type = media
elements
array
yes
Các đối tượng của template.
Lưu ý: Cấu trúc element thay đổi tùy theo loại template. Với template media, danh sách element bao gồm tối đa 1 phần tử.
Cấu trúc thuộc tính message.attachment.payload.element
Tham số
Kiểu dữ liệu
Tính bắt buộc
Mô tả
media_type
string
yes
Loại media.
Các giá trị nhận vào:
image: ảnh tĩnh
gif: ảnh động
attachment_id
string
yes
ID của ảnh bạn muốn sử dụng (nhận được thông qua API upload ảnh)
Các định dạng ảnh hỗ trợ: jpg và png
Dung lượng tối đa: 1MB
Lưu ý: chỉ sử dụng 1 trong 2 biến attachment_id hoặc url
url
string
yes
Đường dẫn đến ảnh
Các định dạng ảnh hỗ trợ: jpg và png
Dung lượng tối đa: 1MB
Lưu ý: chỉ sử dụng 1 trong 2 biến attachment_id hoặc url
width
integer
Chỉ bắt buộc khi media_type = gif
Chiều rộng của ảnh
height
integer
Chỉ bắt buộc khi media_type = gif
Chiều cao của ảnh
Example respond
{
"data": {
"msg_id": "e6fa968f027"
},
"error": 0,
"message": "Success"
}
Cấu trúc thuộc tính data
Thuộc tính
Kiểu dữ liệu
Mô tả
message_id
string
ID của thông báo
user_id
string
ID của người nhận
English version:
HTTP request
URL: https://zns.api.gobysend.com/api/follower/message/send
Method: POST
Content Type: application/json
Response Type: text/json

Example request
curl
-X POST
-H "Content-Type: application/json" -d '{
"recipient": {
"user_id": "2468458835296117922"
},
"message": {
"text": "Zalo đạt 100 triệu người dùng",
"attachment": {
"type": "template",
"payload": {
"template_type": "media",
"elements": [{
"media_type": "image",
"attachment_id": "51586aa2e5a40cfa55b5"
}]
}
}
}
}' "https://zns.api.gobysend.com/api/follower/message/send"
Param
Param
Data type
Compulsory
Description
Request body structure
Param
Data type
Compulsory
Description
recipient
object
yes
Recipient information
message
object
yes
Content to be sent
Recipient attribute structure
Param
Data type
Compulsory
Description
user_id
string
yes
User ID (received via API get follower information and follower list).
Message attribute structure
Param
Data type
Compulsory
Description
text
string
yes
Image title Maximum limit is 2,000 characters
attachment
object
yes
Attachment needs to be sent.
Message.attachment attribute structure
Param
Data type
Compulsory
Description
type
string
yes
Attachment type. Required input value: type = template
payload
object
yes
Contains the payload of the attachment want to send.
Message.attachment.payload attribute structure
Param
Data type
Compulsory
Description
template_type
string
yes
Template type. With template sending a photo attachment, the input value is: template_type = media
elements
array
yes
Template objects. Note: The element structure changes depending on the type of template. With media templates, the element list includes at most 1 element.
Message.attachment.payload.element attribute structure
Param
Data type
Compulsory
Description
media_type
string
yes
Media type. Input values: image, gif
attachment_id
string
yes
Image ID (received via upload API) Supported image formats: jpg and png Maximum capacity: 1MB Note: only 1 in 2 variable attachment_id or url
url
string
yes
Link to image Supported image formats: jpg and png Maximum capacity: 1MB Note: only 1 in 2 variable attachment_id or url
width
integer
Only required when media_type = gif
Width of image
height
integer
Only required when media_type = gif
Height of image
Example respond
{
"data": {
"msg_id": "e6fa968f027"
},
"error": 0,
"message": "Success"
}
Data attribute structure
Attribute
Data type
Description
message_id
string
Notification ID
user_id
string
User ID
Last updated