sendVideo
Gửi video.
Giá trị trả về: Nếu thành công, trả về Message.
Tham số
| Tham số | Kiểu | Bắt buộc | Mô tả |
|---|---|---|---|
business_connection_id | String | Tùy chọn | ID kết nối doanh nghiệp |
chat_id | Integer or String | Có | ID chat hoặc @username |
message_thread_id | Integer | Tùy chọn | ID chủ đề diễn đàn |
direct_messages_topic_id | Integer | Tùy chọn | ID chủ đề tin nhắn trực tiếp (Bot API 10.0) |
ephemeral_message_parameters | EphemeralMessageParameters | Tùy chọn | Đối tượng JSON EphemeralMessageParameters — tin nhắn tạm thời chỉ hiển thị với một người dùng (Bot API 10.3) |
video | InputFile or String | Có | URL hoặc file_id của video |
duration | Integer | Tùy chọn | Thời lượng tính bằng giây |
width | Integer | Tùy chọn | Chiều rộng video |
height | Integer | Tùy chọn | Chiều cao video |
thumbnail | InputFile or String | Tùy chọn | URL hoặc file_id của ảnh thu nhỏ |
cover | InputFile or String | Tùy chọn | Ảnh bìa video (Bot API 10.0) |
start_timestamp | Integer | Tùy chọn | Mốc thời gian bắt đầu video (Bot API 10.0) |
caption | String | Tùy chọn | Chú thích (0-1024) |
parse_mode | String | Tùy chọn | HTML, Markdown, MarkdownV2 |
caption_entities | Array of MessageEntity | Tùy chọn | Mảng JSON MessageEntity |
show_caption_above_media | Boolean | Tùy chọn | Hiển thị chú thích phía trên video |
has_spoiler | Boolean | Tùy chọn | Ẩn nội dung (spoiler) |
supports_streaming | Boolean | Tùy chọn | Hỗ trợ phát trực tuyến |
disable_notification | Boolean | Tùy chọn | Gửi không âm thanh |
protect_content | Boolean | Tùy chọn | Bảo vệ nội dung |
allow_paid_broadcast | Boolean | Tùy chọn | Cho phép gửi hàng loạt trả phí |
message_effect_id | String | Tùy chọn | ID hiệu ứng tin nhắn |
suggested_post_parameters | SuggestedPostParameters | Tùy chọn | Đối tượng JSON SuggestedPostParameters |
reply_parameters | ReplyParameters | Tùy chọn | Đối tượng JSON ReplyParameters |
reply_markup | InlineKeyboardMarkup or ReplyKeyboardMarkup or ReplyKeyboardRemove or ForceReply | Tùy chọn | JSON: InlineKeyboardMarkup / ReplyKeyboardMarkup / ReplyKeyboardRemove / ForceReply |
Ví dụ request
curl
curl -s -X POST "https://api.telegram.org/bot$TOKEN/sendVideo" \
-H "Content-Type: application/json" \
-d '{"chat_id":123456789,"video":"https://example.com/video.mp4"}'
Python
import requests
TOKEN = "123456789:AAEexampleTokenReplaceWithYours"
resp = requests.post(
f"https://api.telegram.org/bot{TOKEN}/sendVideo",
json={
"chat_id": 123456789,
"video": "https://example.com/video.mp4"
},
timeout=30,
)
print(resp.json())
JavaScript
const TOKEN = "123456789:AAEexampleTokenReplaceWithYours";
const res = await fetch(`https://api.telegram.org/bot${TOKEN}/sendVideo`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"chat_id": 123456789,
"video": "https://example.com/video.mp4"
}),
});
console.log(await res.json());
Hướng dẫn từng bước: Cách tạo bot Telegram từ A đến Z: BotFather, token và tin nhắn đầu tiên
Phương thức liên quan
sendPhotoGửi ảnh.sendDocumentGửi tài liệu.sendAudioGửi tệp âm thanh.sendAnimationGửi ảnh động (GIF).sendStickerGửi sticker.sendVoiceGửi tin nhắn thoại.sendVideoNoteGửi video tròn (tin nhắn video).sendMediaGroupGửi một nhóm media (album).sendPaidMediaGửi media trả phí (Bot API 8.0+).sendDiceGửi xúc xắc.sendLivePhotoGửi ảnh Live (ảnh + video, Bot API 10.0).