Edit Message Audio 🔽
Swap the audio on a Telegram message without posting a new one
- bot
- audio
- trigger
- message
- message_id
- trigger
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 (themessage_idoutput of your Send Audio node).audio- the new AUDIO tensor.caption,parse_mode- replacement caption;parse_modeisNone/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 useas_fileTrue to bypass conversion.- "message to edit not found" - the
message_idmust 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
audioinput isforceInput- it expects a wire from an audio/TTS node, not a file path you type in.
Inputs (10)
| Name | Type | Default | Description |
|---|---|---|---|
| bot | TELEGRAM_BOT | Telegram bot instance | |
| chat_id | INT | Unique identifier for the target chat | |
| message_id | INT | Unique Identifier of the message to edit | |
| audio | AUDIO | the audio to send | |
| 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 |
| file_name | STRING | audio | the file name for this media |
| as_file | BOOLEAN | false | Pass True to send the media as file without compression |
| triggeropt | * | Optional trigger to enforce execution order |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| message | DICT | — |
| message_id | INT | — |
| trigger | * | — |