TG Send Message ◀️
The node that turns your workflow into a chat reply
- trigger
- message
- message_id
- trigger
If you're building your first bot, start here. Two wires - chat_id from the Listener and the text you want to say - and your ComfyUI graph is talking to a human on Telegram. examples/example_text_echo.json in the repo is exactly this, and it's worth loading before you build anything fancier.
The idea, and why a node instead of a script
Every bot node in this pack is a thin wrapper over one HTTP call to api.telegram.org, made with httpx - the same client library ComfyUI already ships. That's the whole trick behind the pack's "no third party software, no server setup" pitch: a node is allowed to reach the network, and ComfyUI's Run (Instant) mode gives you the loop. The alternative people used before this was a separate bot process outside ComfyUI, calling the API, with its own lifecycle to babysit. Neither approach is wrong; keeping it in the graph means one thing to start and one thing to debug.
Inputs you'll set
bot_token is the BotFather string. chat_id is a socket, not a typing box - it has a forceInput flag, so it must come from the Listener (or another node producing an INT). That's deliberate: replies go back to whoever asked.
text is the message body, 1–4096 characters after entity parsing, and it's multiline.
parse_mode defaults to None, which means plain text - the option is dropped from the request entirely rather than sent as a literal "None". The other three are HTML, Markdown and MarkdownV2. HTML is the forgiving one and what I'd reach for. MarkdownV2 is strict: a lone _ or * in a sentence containing a filename will get the message rejected by Telegram with an HTTP 400, and this pack treats a 400 as a permanent error - it isn't retried - so it surfaces as an execution error and stops your Run (Instant) loop until you fix the string. If your bot is quoting user text back, use HTML or no parse mode at all.
disable_notification defaults to True, which catches people out. Your bot replies silently by default; nobody's phone buzzes. If you want a notification, turn it off explicitly.
protect_content (off by default) stops the recipient from forwarding or saving your message. message_thread_id takes the Listener's thread ID so a forum-topic bot answers inside the right topic; -1 means "no thread", and any value ≤ 0 is dropped before the call.
There's also a trigger socket on the right, typed *. Nothing is computed from it - it's an execution-order leash. Chain trigger through your senders and editors to force a deterministic sequence when the graph would otherwise be ambiguous about what fires first.
Outputs
message is the raw Telegram response DICT for the sent message - handy if you want to dig out fields, and it's what the Parse JSON / API Method side of the pack speaks. message_id is the integer you feed to the Edit Message nodes when you want to rewrite this message later (post "generating…", then edit it into the result). trigger passes through unchanged.
The failure behaviour here is more careful than most packs. If text is empty after stripping whitespace, no API call happens at all and all three outputs become silent blockers, so a downstream edit can't act on a message that was never sent. If Telegram is unreachable, the request is retried up to five times with widening timeouts; if all five fail, the node logs a warning, hands back blockers, and the workflow continues rather than throwing a queue error. One honest caveat from the author: if a response is lost after Telegram accepted the request, the retry can duplicate the message. No exactly-once delivery.
Rate limits are real
Telegram asks bots to stay under roughly one message per second per chat, and caps group chats at 20 messages per minute. Blast a media-heavy branch into a group and you'll see retry_after come back; the pack waits the amount Telegram demands, which can be tens of seconds. That's the server talking, not a bug.
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: run that pip line with python_embeded\python.exe from the portable root. Requirements are httpx, numpy, pillow, av>=14.2.0; no models, no config file, restart ComfyUI after installing. Or use ComfyUI Manager and search ComfyUI Autonomous Telegram Bot.
Common issues
- Bot stays silent: check
disable_notificationis what you want, then check the parse mode, then check the workflow is actually running under Run (Instant) with the tab open. - A message in a group goes nowhere: bot must be in the group, and the chat ID needs its minus sign - the Listener hands you the negative group ID, so don't "clean it up".
- Text arrives truncated or rejected: 4096 characters is Telegram's ceiling, and it counts after entity parsing, so a bubble of HTML tags eats into it.
- Token leaking: tokens typed into widgets are saved inside the workflow JSON. Scrub them before sharing the graph.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| bot_token | STRING | Telegram bot token from BotFather | |
| chat_id | INT | Unique identifier for the target chat | |
| text | STRING | Text of the message to be sent, 1-4096 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. | |
| disable_notification | BOOLEAN | true | Sends the message silently. Users will receive a notification with no sound. |
| protect_content | BOOLEAN | false | Protects the contents of the sent message from forwarding and saving |
| message_thread_id | INT | -1-1–9223372036854776000 | Unique identifier for the target message thread of the forum topic (-1 = None) |
| triggeropt | * | Optional trigger to enforce execution order |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| message | DICT | — |
| message_id | INT | — |
| trigger | * | — |