Chuyển tới nội dung chính

sendPhoto

API cho phép Bot của bạn gửi tin nhắn hình ảnh đến người dùng hoặc các cuộc trò chuyện.

  • URL: https://bot-api.zaloplatforms.com/bot${BOT_TOKEN}/sendPhoto
  • Method: POST
  • Response Type: application/json

Sample code

const axios = require('axios');

const entrypoint = `https://bot-api.zaloplatforms.com/bot${BOT_TOKEN}/sendPhoto`;
const response = await axios.post(entrypoint, { chat_id: 'abc.xyz', caption: 'My photo', photo: 'https://placehold.co/600x400'});

Parameters

TrườngKiểu dữ liệuBắt buộcMô tả
chat_idStringtrueID của người nhận hoặc cuộc trò chuyện
photoStringtrueĐường dẫn hình ảnh sẽ được gửi
captionStringfalseNội dung văn bản của tin nhắn sẽ được gửi kèm, với độ dài từ 1 đến 2000 ký tự

Sample response

{
"ok": true,
"result": {
"message_id": "82599fa32f56d00e8941",
"date": 1749632637199
}
}