sendVideo
Use this method to send video files, Telegram clients support MPEG4 videos (other formats may be sent as Document). On success, the sent Message is returned. Bots can currently send video files of up to 50 MB in size, this limit may be changed in the future.
Parameters
business_connection_idStringOptionalUnique identifier of the business connection on behalf of which the message will be sent
chat_idIntegerStringRequiredUnique identifier for the target chat or username of the target channel (in the format
@channelusername)message_thread_idIntegerOptionalUnique identifier for the target message thread (topic) of a forum; for forum supergroups and private chats of bots with forum topic mode enabled only
direct_messages_topic_idIntegerOptionalIdentifier of the direct messages topic to which the message will be sent; required if the message is sent to a direct messages chat
Video to send. Pass a file\_id as String to send a video that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a video from the Internet, or upload a new video using multipart/form-data. More information on Sending Files »
durationIntegerOptionalDuration of sent video in seconds
widthIntegerOptionalVideo width
heightIntegerOptionalVideo height
Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass "attach://attach\name>" if the thumbnail was uploaded using multipart/form-data under attach\name>. More information on Sending Files »
Cover for the video in the message. Pass a file\id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass "attach://attach\name>" to upload a new one using multipart/form-data under attach\_name> name. More information on Sending Files »
start_timestampIntegerOptionalStart timestamp for the video in the message
Video caption (may also be used when resending videos by file\_id), 0-1024 characters after entities parsing
parse_modeStringOptionalMode for parsing entities in the video caption. See formatting options for more details.
A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse\_mode
show_caption_above_mediaBooleanOptionalPass True, if the caption must be shown above the message media
has_spoilerBooleanOptionalPass True if the video needs to be covered with a spoiler animation
supports_streamingBooleanOptionalPass True if the uploaded video is suitable for streaming
disable_notificationBooleanOptionalSends the message silently. Users will receive a notification with no sound.
protect_contentBooleanOptionalProtects the contents of the sent message from forwarding and saving
allow_paid_broadcastBooleanOptionalPass True to allow up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance
message_effect_idStringOptionalUnique identifier of the message effect to be added to the message; for private chats only
A JSON-serialized object containing the parameters of the suggested post to send; for direct messages chats only. If the message is sent as a reply to another suggested post, then that suggested post is automatically declined.
Description of the message to reply to
reply_markupInlineKeyboardMarkupReplyKeyboardMarkupReplyKeyboardRemoveForceReplyOptional⌨️ KeyboardsAdditional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user
Returns
On success, the Message object is returned.
GramIO Usage
ts
// Send a video by file_id (fastest — no re-upload)
bot.command("clip", (ctx) =>
ctx.sendVideo(ts
// Upload a local MPEG4 file with metadata and streaming flag
bot.commandctx) => {
const video = await MediaUpload.path("./assets/intro.mp4");
return ctx.sendVideo(video, {
duration: 42,
width: 1280,
height: 720,
supports_streaming: true,
caption: "Welcome to GramIO!",
});
});ts
// Video with formatted caption and a spoiler overlay
bot.commandctx) => {
const video = await MediaUpload.path("./assets/reveal.mp4");
return ctx.sendVideo(video, {
caption: format`${bold
has_spoiler: true,
});
});ts
// Upload video from a URL with a custom JPEG thumbnail
bot.commandctx) => {
const thumbnail = await MediaUpload.path("./assets/thumb.jpg");
return ctx.sendVideo("https://example.com/demo.mp4", {
thumbnail,
caption: "Demo video from the web",
supports_streaming: true,
});
});ts
// Reply with a video and caption shown above the media
bot.commandctx) => {
const video = await MediaUpload.path("./assets/promo.mp4");
return ctx.replyWithVideo(video, {
caption: "This caption appears above the video",
show_caption_above_media: true,
duration: 15,
});
});Errors
| Code | Error | Cause |
|---|---|---|
| 400 | Bad Request: chat not found | Invalid or inaccessible chat_id — verify the chat exists and the bot is a member |
| 400 | Bad Request: VIDEO_INVALID | The provided file_id does not refer to a video |
| 400 | Bad Request: failed to get HTTP URL content | Telegram could not fetch the video from the provided HTTP URL |
| 400 | Bad Request: wrong type of the web page content | The URL did not return an MPEG4 file — non-MPEG4 formats are sent as Document |
| 400 | Bad Request: caption is too long | Caption exceeds 1024 characters after entity parsing |
| 400 | Bad Request: MEDIA_CAPTION_TOO_LONG | Same as above via a different code path |
| 413 | Request Entity Too Large | Uploaded file exceeds the 50 MB limit |
| 403 | Forbidden: bot was blocked by the user | The target user has blocked the bot |
| 403 | Forbidden: not enough rights | Bot lacks can_send_media_messages permission in the group/channel |
| 429 | Too Many Requests: retry after N | Flood control triggered — use the auto-retry plugin to handle this automatically |
Auto-retry for 429 errors
Install the @gramio/auto-retry plugin to transparently handle flood-wait errors without manual retry logic.
Tips & Gotchas
- Only MPEG4 (.mp4) renders inline. Other formats (AVI, MOV, MKV, etc.) will be sent as a generic Document without a video preview. Transcode to MPEG4 before sending.
- 50 MB upload limit. Files larger than 50 MB cannot be sent by bots. For larger files, consider hosting the video externally and passing a URL, or compress first.
- Cache
file_idafter the first upload. Capturemessage.video.file_idfrom the returnedMessageContextand store it so subsequent sends avoid re-uploading. - Set
supports_streaming: truefor streamable videos. This allows Telegram clients to start playing the video before it has fully buffered. Ensure the video is encoded with a fast-start flag (moov atom at the start of the file). - Thumbnail constraints. Custom thumbnails must be JPEG, under 200 kB, and at most 320×320 px. Thumbnails cannot be reused — they must be uploaded fresh each time.
has_spoilerblurs the preview. Users must tap to reveal the video. This is useful for plot spoilers or NSFW content gating.- Use
sendMediaGroupfor multiple videos. Sending up to 10 videos in a single album is more efficient and groups them visually for the recipient.
See Also
- sendVideoNote — Send a rounded video message (video circle)
- sendAnimation — Send GIF or MP4 animation without sound
- sendAudio — Send an audio file with music player display
- sendMediaGroup — Send multiple videos/photos as an album
- Video — The Video type embedded in Message
- Media upload guide — Upload files using
MediaUploadhelpers - Media input guide — Work with
InputMediafor albums - Formatting guide — Format captions using GramIO's
formattagged template