TG Edit Message Video ◀️
Swap the clip in a message the bot already posted
- video
- trigger
- message
- message_id
- trigger
The workflow this exists for: your bot posts a five-second draft as soon as the first pass decodes, then the upscale/interp pass finishes and the same message gets the better clip - same bubble, same conversation, no "here's the real one" follow-up. It's the video twin of Edit Message Image, and like that one it changes the media of an existing message rather than sending a new one.
What it actually replaces
video takes a VHS_FILENAMES socket, so it wants Video Helper Suite's Filenames output (or the Listener's message_video output, if you're bouncing a user's clip back). It reads the file from disk, uploads the bytes, and tells Telegram to swap them into the message via editMessageMedia.
send_as decides how the replacement is declared: Animation (animation, inline looping and muted), Video (a real video with controls), or File (a document, no re-encode). There's no file_name widget here - the uploaded name is taken from the filename on disk, so if you care what it's called, control it in Video Combine's filename_prefix.
The metadata warning applies here too, and it's worse than on the senders if you're not careful. Video and animation paths upload the original bytes and filename, so anything embedded in that MP4 - prompt, seed, model, the whole graph if Video Combine wrote it - travels to whoever receives the message. Turn save_metadata off in Video Combine and feed this node its Filenames output directly. Images and audio in this pack are re-encoded and carry nothing; video is the exception.
Inputs
bot_token, chat_id, and message_id - and that ID has to come from a sender (Send Video's message_id output), because a bot can only edit its own messages. The Listener's message_id is the user's incoming message and will be rejected.
caption (0–1024 characters) plus parse_mode (None/HTML/Markdown/MarkdownV2) let you fix the caption in the same call, and show_caption_above_media moves it over the clip. There's no has_spoiler, no notification or protection toggle here - those are send-time properties, and Telegram doesn't retroactively re-notify anyone for an edit. trigger is the usual untyped ordering input; wire the sender's trigger into it so the edit can't run before the message exists.
Outputs
message (the response DICT), message_id (same ID, chainable), trigger (passthrough). Failures that outlive the pack's five retry attempts come back as silent blockers on message/message_id, with trigger still flowing, so the workflow continues instead of throwing.
The mismatch you'll hit
Telegram is stricter about media edits than about text edits, and this pack doesn't retry a 400 - it treats it as permanent and raises, which becomes a ComfyUI execution error and stops Run (Instant). So send_as isn't a cosmetic label: your replacement has to be the kind of media Telegram is willing to substitute. If you posted a video, replace a video. If you swap in an Animation against a message the app is treating as a document, expect an error in the console instead of a silent no-op. The log names the method (editMessageMedia) and Telegram's own description, which is where to look first.
Install
cd ComfyUI/custom_nodes
git clone https://github.com/CoolBreeze164/ComfyUI-Autonomous-Telegram-Bot
python -m pip install -r ComfyUI-Autonomous-Telegram-Bot/requirements.txt
Windows portable: python_embeded\python.exe -m pip install ... from the portable root. Requirements: httpx, numpy, pillow, av>=14.2.0 - PyAV ships its own media libraries, no system ffmpeg needed. Manager install works too: search ComfyUI Autonomous Telegram Bot. Restart after installing; nodes live under Autonomous Telegram Bot ◀️/edit.
Common issues
- "No video file" from the VHS input - you wired a preview path. Use Video Combine's
Filenames. - The clip arrives with your prompt inside it -
save_metadatastill on in Video Combine. - Nothing happens at all - check the sender actually produced a
message_id. If the initial send failed, its outputs are blockers and this node is skipped by design. - Slow and then "skipped the failed request" - that's the pack's failure path: five attempts with widening timeouts, then a warning, blockers, and the run continues. A flaky connection to Telegram is the usual culprit; big clips over a slow uplink make it much more likely.
Inputs (9)
| Name | Type | Default | Description |
|---|---|---|---|
| bot_token | STRING | Telegram bot token from BotFather | |
| chat_id | INT | Unique identifier for the target chat | |
| message_id | INT | Unique Identifier of the message to edit | |
| video | VHS_FILENAMES | the video to send (VHS) | |
| caption | STRING | Media caption, 0-1024 characters after entities parsing | |
| parse_mode | COMBO | Mode for parsing entities in the photo caption. See https://core.telegram.org/bots/api#formatting-options for more details. | |
| show_caption_above_media | BOOLEAN | false | Pass True, if the caption must be shown above the message media |
| send_as | COMBO | How to send the video | |
| triggeropt | * | Optional trigger to enforce execution order |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| message | DICT | — |
| message_id | INT | — |
| trigger | * | — |