Telegram Listener
Turn ComfyUI into a robot you can text
- message_text
- chat_id
This is the node that makes ComfyUI wait for you. Telegram Listener sits in your graph, blocks execution, and waits up to a set number of seconds for a message sent to your bot. Whatever text arrives becomes an output you can wire anywhere - into a prompt, into a text pipeline, into a condition. Combined with its sibling Save to Telegram from the same pack, you get a closed loop: you text your machine, it generates, it texts you back. It's the in-graph approach to "run your GPU from your couch," and for a two-node pack with one Python dependency, that's a lot of capability.
The mental model matters here: this isn't a standalone bot that talks to your ComfyUI API. It's a node inside a workflow, so whatever it listens for happens inside a single run. The author's example workflow is an echo bot - listener → CLIPTextEncode → Save to Telegram - and the same shape scales to "message becomes a prompt" or "message triggers a branch."
How it works - and the catch
The node spins up a python-telegram-bot Application in a background daemon thread that polls Telegram for you. Incoming text messages get pushed to an internal queue. Then - here's the part that surprises people - the node sits and blocks for up to timeout seconds polling that queue. If a message shows up, you get it as output. If not, you get the string "No message received within timeout" instead.
That blocking behavior is the whole design, and also the trap. Every node in the queue behind the listener waits. Set timeout to 300 and a run that gets no message will hold your queue for five minutes. Keep it sane for your use case.
The handler filters to plain text only (TEXT & ~COMMAND), so images, files, and /commands are ignored. And each listener runs its own bot instance - the README says so explicitly - so two listeners in one graph mean two polling connections on that token.
The inputs and outputs
- bot_token - from @BotFather. Get the bot started by sending it
/startonce or it won't deliver. - timeout - seconds to wait for a message. Integer, 1 to 300, default 10.
Outputs are two strings:
- message_text - the message body, or the timeout message if nothing came.
- chat_id - where the message came from; wire this straight into Save to Telegram so the reply goes back to the right person.
The gotcha nobody warns you about
Because message_text is just a string, the timeout text flows downstream like any real message. If you wire it straight into a prompt and nothing arrives, ComfyUI happily generates from the words "No message received within timeout." Guard it - use a Text Concatenate or conditional node, or accept that a silent run generates gibberish.
Install
Same shared pack install for both nodes. ComfyUI Manager → search "Telegram Bot"; or:
cd ComfyUI/custom_nodes/
git clone https://github.com/AKharytonchyk/ComfyUI-telegram-bot-node
cd ComfyUI-telegram-bot-node
./install.sh # Windows: install.bat
Restart ComfyUI after. The only real dependency is python-telegram-bot==20.7 - lightweight, no models. If the node won't import, pip install python-telegram-bot==20.7 usually clears it.
Troubleshooting
- Message arrives in Telegram but the node still times out: make sure you sent
/startto the bot first, and check your firewall isn't blocking Telegram's servers (a real thing the README calls out). - Bad token → the node returns
"Error: Invalid bot token format"as the message output rather than crashing, which is nice until you forget it's an error string. - If you change the token between runs, the node tears down and restarts its bot - that part is handled for you, but it means a brief reconnect gap.
Is this the most polished pack in the ecosystem? No - its metadata still says "author: Your Name," which tells you it's a lightly-maintained template job. But it's small, dependency-light, and the pattern it unlocks - text your ComfyUI box, have it text you back - is genuinely useful. For a first remote-control setup, it's a solid place to start.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| bot_token | STRING | — | |
| timeout | INT | 101–300 | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| message_text | STRING | — |
| chat_id | STRING | — |