Nodes/ComfyUI Autonomous Telegram Bot/TG Edit Message Caption ◀️
ComfyUI Node

TG Edit Message Caption ◀️

Swap the caption on a picture you already posted

By CoolBreeze164·Created 13 days ago·Updated 2 days ago· 3
TG Edit Message Caption ◀️
  • trigger
  • message
  • message_id
  • trigger
◄bot_token►
◄chat_id—►
◄message_id—►
◄caption►
◄parse_mode▾►
◄show_caption_above_mediafalse►

Here's the bot workflow this node unlocks: send the image the second it's decoded with a bare caption like Rendering… or Upscaling…, then fill in the real caption afterwards - the prompt, the seed, the model, whatever the recipient actually wants to know. No second upload, no re-encode, no flicker of a second message arriving. Just the caption under the picture changing.

How it works

One API call, editMessageCaption, with chat_id, message_id, the new caption and the parse settings. Telegram rewrites the caption block on that media message. The media itself isn't touched - this node has no image input at all, which is the point. Use it on a photo, video, animation, audio or document message the bot posted earlier.

Two mechanics worth knowing, because they're more useful than they look:

An empty caption clears the caption. The pack deliberately preserves empty strings when it builds the request (unlike None values, which get dropped), so passing nothing doesn't send a "no caption" instruction you'd expect it to ignore - it removes the caption from the message. The README lists it as "replace or clear a media caption", and both are true.

parse_mode of None is removed from the request, not sent as the word "None" - that's handled inside this node specifically, so plain-text captions can't accidentally be parsed as markup.

Inputs

bot_token and chat_id as always, and message_id - which must be the ID of a message the bot sent. Wire it from Send Image's or Send Video's message_id output; the Listener's incoming message ID will get you a 400, since a bot can't edit someone else's message.

caption is 0–1024 characters, matching Telegram's own cap. parse_mode is None/HTML/Markdown/MarkdownV2. And show_caption_above_media toggles whether the caption sits above the media rather than below it - that's a per-edit property, so you can flip it after the fact if you set it wrong on the send.

The trigger input is the usual untyped ordering leash. Use it: this node is meaningless unless a sender has already produced a real message_id, and trigger is how you guarantee that ordering instead of hoping ComfyUI's scheduler agrees with you.

Outputs

message is the Telegram response DICT for the edited message, message_id is the ID you just edited, trigger passes through. If the request fails all five retry attempts, message and message_id become silent blockers rather than stale numbers, and the workflow continues - so a dropped connection doesn't kill your Run (Instant) loop, but it won't fake a success either.

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

Portable users: python_embeded\python.exe from the portable root. Deps are httpx, numpy, pillow, av>=14.2.0; no model downloads, no config file. Or ComfyUI Manager → search ComfyUI Autonomous Telegram Bot → Install → restart. Category: Autonomous Telegram Bot ◀️/edit.

Common issues

  • 400 error about editing - you're editing a text-only message, or you're editing a message the bot didn't send. Captions only exist on media messages, and only the author can rewrite them.
  • Caption doesn't change - Telegram treats an edit to identical content as an error ("message is not modified"). This pack doesn't retry 400s, so that surfaces as an execution error rather than a quiet no-op. Make sure the new caption differs from the current one.
  • Markup shows up as literal *asterisks* - you left parse_mode on None while writing HTML or Markdown. Pick the format you actually typed.
  • Caption vanished - congratulations, that's clearing working as designed. Pass real text if you want text.
  • It fights with the sender - connect trigger from the sender into the editor so the caption edit can't run before the media exists. Without it, you're relying on graph-completion order, and the pack's own note about intended ordering exists because that isn't always what you get.
CategoryAutonomous Telegram Bot ◀️/edit

Inputs (7)

NameTypeDefaultDescription
bot_tokenSTRINGTelegram bot token from BotFather
chat_idINTUnique identifier for the target chat
message_idINTUnique Identifier of the message to edit
captionSTRINGMedia caption, 0-1024 characters after entities parsing
parse_modeCOMBOMode for parsing entities in the photo caption. See https://core.telegram.org/bots/api#formatting-options for more details.
show_caption_above_mediaBOOLEANfalsePass True, if the caption must be shown above the message media
triggeropt*—

Outputs (3)

NameTypeDescription
messageDICT—
message_idINT—
trigger*—