Nodes/ComfyUI Telegram Suite/Edit Message Audio 🔽
ComfyUI Node

Edit Message Audio 🔽

Swap the audio on a Telegram message without posting a new one

By SwissCore92·Created about a year ago·Updated 2 months ago· 9
Edit Message Audio 🔽
  • bot
  • audio
  • trigger
  • message
  • message_id
  • trigger
chat_id
message_id
caption
parse_mode
show_caption_above_mediafalse
file_nameaudio
as_filefalse

TTS workflows are trial and error - re-run the prompt, re-run the seed, listen again. If you're already posting results to Telegram with Send Audio 🔽, this node keeps those retries tidy: it replaces the audio on an existing message rather than stacking a fifth "attempt" in the chat.

It's part of the ComfyUI Telegram Suite edit family and works exactly like the other media editors: take a message_id from a send node, feed in new content, and the message updates in place.

How it works

The node calls Telegram's editMessageMedia with an audio file. The AUDIO input is ComfyUI's standard audio dict (the waveform + sample_rate output of a TTS or audio node). It renders that to WAV with torchaudio, and the as_file toggle picks the encoding:

  • as_file False (default) → converted to MP3 via ffmpeg and swapped in as an audio message.
  • as_file True → sent as a raw document (WAV), no conversion, no compression.

The ffmpeg requirement is the same as in Send Audio: the default path shells out to ffmpeg, which has to be on your PATH or the edit fails with an "ffmpeg audio conversion failed" runtime error. If you always use as_file, you can skip installing it.

Two Telegram rules apply to every media edit: the bot can only edit messages it sent itself, and media edits only work within 48 hours of the original send. So this is for fixing a fresh take, not curating last week's archive.

Inputs and outputs that matter

  • bot, chat_id - from a Telegram Bot 🔽 node.
  • message_id - the message whose audio you're replacing (the message_id output of your Send Audio node).
  • audio - the new AUDIO tensor.
  • caption, parse_mode - replacement caption; parse_mode is None/HTML/Markdown/MarkdownV2.
  • show_caption_above_media - caption placement.
  • file_name (default "audio") - base name for the uploaded file.
  • as_file - document vs. compressed audio, above.

Outputs: message (DICT), message_id (INT, unchanged by an edit), and trigger.

Installation

Pack-wide:

cd ComfyUI/custom_nodes
git clone https://github.com/SwissCore92/comfyui-telegram-suite.git
cd comfyui-telegram-suite
pip install -r requirements.txt

or install "ComfyUI Telegram Suite" via ComfyUI Manager and restart, then fill in ComfyUI/user/default/telegram-suite/config.json (bots + chats) and restart once more. Light pip deps, no models. ffmpeg needed on PATH for the default (non-as_file) path.

Troubleshooting

  • ffmpeg audio conversion failed - ffmpeg missing or not on PATH. Install it, restart, or use as_file True to bypass conversion.
  • "message to edit not found" - the message_id must come from a message this same bot sent in this same chat.
  • Old messages won't edit - the 48-hour media-edit window; resend instead.
  • The audio input is forceInput - it expects a wire from an audio/TTS node, not a file path you type in.
CategoryTelegram Suite 🔽/edit

Inputs (10)

NameTypeDefaultDescription
botTELEGRAM_BOTTelegram bot instance
chat_idINTUnique identifier for the target chat
message_idINTUnique Identifier of the message to edit
audioAUDIOthe audio to send
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
file_nameSTRINGaudiothe file name for this media
as_fileBOOLEANfalsePass True to send the media as file without compression
triggeropt*Optional trigger to enforce execution order

Outputs (3)

NameTypeDescription
messageDICT
message_idINT
trigger*