Telegram Bot API
🌐 Tiếng Việt

sendVideo

Danh mục: Media · Bot API 10.3 · Tài liệu chính thức

Gửi video.

Giá trị trả về: Nếu thành công, trả về Message.

Tham số

Tham sốKiểuBắt buộcMô tả
business_connection_idStringTùy chọnID kết nối doanh nghiệp
chat_idInteger or StringCóID chat hoặc @username
message_thread_idIntegerTùy chọnID chủ đề diễn đàn
direct_messages_topic_idIntegerTùy chọnID chủ đề tin nhắn trực tiếp (Bot API 10.0)
ephemeral_message_parametersEphemeralMessageParametersTù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)
videoInputFile or StringCóURL hoặc file_id của video
durationIntegerTùy chọnThời lượng tính bằng giây
widthIntegerTùy chọnChiều rộng video
heightIntegerTùy chọnChiều cao video
thumbnailInputFile or StringTùy chọnURL hoặc file_id của ảnh thu nhỏ
coverInputFile or StringTùy chọnẢnh bìa video (Bot API 10.0)
start_timestampIntegerTùy chọnMốc thời gian bắt đầu video (Bot API 10.0)
captionStringTùy chọnChú thích (0-1024)
parse_modeStringTùy chọnHTML, Markdown, MarkdownV2
caption_entitiesArray of MessageEntityTùy chọnMảng JSON MessageEntity
show_caption_above_mediaBooleanTùy chọnHiển thị chú thích phía trên video
has_spoilerBooleanTùy chọnẨn nội dung (spoiler)
supports_streamingBooleanTùy chọnHỗ trợ phát trực tuyến
disable_notificationBooleanTùy chọnGửi không âm thanh
protect_contentBooleanTùy chọnBảo vệ nội dung
allow_paid_broadcastBooleanTùy chọnCho phép gửi hàng loạt trả phí
message_effect_idStringTùy chọnID hiệu ứng tin nhắn
suggested_post_parametersSuggestedPostParametersTùy chọnĐối tượng JSON SuggestedPostParameters
reply_parametersReplyParametersTùy chọnĐối tượng JSON ReplyParameters
reply_markupInlineKeyboardMarkup or ReplyKeyboardMarkup or ReplyKeyboardRemove or ForceReplyTùy chọnJSON: InlineKeyboardMarkup / ReplyKeyboardMarkup / ReplyKeyboardRemove / ForceReply

Mô tả tham số chỉ là bản tóm tắt ngắn gọn; xem tài liệu chính thức để đọc toàn văn.

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