Download
1 variant available
410 1 2 3 4 5 6 7 8 90 1 2 3 4 5 6 7 8 9
(4)
Aug 7, 2026
Other

140 1 2 3 4 5 6 7 8 90 1 2 3 4 5 6 7 8 9
440 1 2 3 4 5 6 7 8 90 1 2 3 4 5 6 7 8 9
Images hidden due to mature content settings
A fully autonomous functioning bot for Telegram made completely inside ComfyUI without any 3rd party software and complicated server setups. Just hit “Run” and that’s it. Share your bot with friends on Telegram so they can generate something using ComfyUI, running on your computer!
This workflow was designed as a general modular framework for building a multi-purpose bot that has two-way communication with Telegram through straightforward API calls. Combining Mute, Switch and Passthrough nodes into logic gates, the workflow actively changes its state and routs the received user’s text messages into different paths. And because the bot is entirely contained in ComfyUI, it allows to use the platform’s full functionality and limitless potential. Additionally, the bot can remember chat history independently for different users that interact with it, excluding any possibility of potential data sharing between them. To be specific, here I only added the functionality to remember last generated image and LLM chat, however this can easily be expanded to any data type.
This bot demo features 3 commands (check the showcase video above): image generation, editing of the last generated/edited image (not the one sent by user) and simple LLM chat with additional voiceover. The modular structure of the workflow allows you to make as many functions as you want and connect anything ComfyUI can offer, like image/video/music generators, chatbots, custom editing pipelines, automatic web downloaders, etc.
The custom node pack I used for sending outputs to the bot has a very rich functionality which you can check out here:
https://github.com/SwissCore92/comfyui-telegram-suite
However, it doesn’t feature any message receivers. From every pack out there, I found only one that can do that and unfortunately it can ONLY receive text messages and not images/videos/voice inputs. Here is the pack:
https://github.com/AKharytonchyk/ComfyUI-telegram-bot-node
If you can find good custom node packs for other apps like Discord, you can probably make a similar bot for them as well. Just swap the receiver and sender nodes.
With that being said, this workflow acts more as a proof-of-concept prototype and I’m sure it can probably be done in a more graceful way. So here is the list of some shortcomings and known issues:
Because the bot uses ComfyUI for simple calls, it does not connect to your installed Telegram app in any way and thus, cannot utilize its built-in protocols like MTProto or SOCKS for connection with Telegram servers. This means that if Telegram is blocked in your country, the bot will not be able to hook to the server. To bypass restrictions, I recommend using Cloudflare's WARP (Traffic and DNS (UDP) or Traffic and DNS (HTTPS) modes) or a VPN.
The bot responds to TEXT ONLY and does not respond to any other input from the user. User’s input (including dedicated commands) is received as a text string which is then processed in the message router.
If multiple different users interact with the bot at the same time, this can cause an issue where one user calls the command and changes the state of the workflow and the other user immediately after calls another command or writes a prompt, which changes the workflow again or makes it generate something for the second user. Though this cannot lead to accidental information transfer, it definitely makes the bot not suitable for mass usage.
Rarely, the bot might not respond to your message at all and you will need to send it again. This is followed by an error in the console about multiple API calls and bot instances. I suspect it is caused by the conflict between two custom node packs for receiver and senders. This error does not block queue or break the bot though.
While testing the “LLM Session Chat” node I found that it can sometimes freeze indefinitely trying to generate a response. This usually happens after several turns. If you have trouble with it, try swapping to native “Generate Text” node. It does not have a built-in memory feature though.
Ok, so how do you actually set up the bot and use the workflow?
First, create a new bot using @BotFather and get your bot's unique HTTP API token. The token should look like this:
0123456789:AbCdEfGhIjKlMnOpQrStUvWxYz0AbCdEfGhSecond, inside the workflow copy the bot token into the dedicated text node (purple, on the left), which is connected to "Telegram Listener" node. Beside that, copy the bot token into the config file for "comfyui-telegram-suite" node pack and restart ComfyUI. For portable comfy you can find it here:
\ComfyUI_windows_portable\user\default\telegram-suite\config.json
Optionaly, you can also add your ChatID as well if you want, but it doesn't do anything in this workflow because ChatID is automatically determined via "Telegram Listener" node.
The config file should look like this:
{
"bots": {
"MyCoolBot": "0123456789:AbCdEfGhIjKlMnOpQrStUvWxYz0AbCdEfGh"
},
"chats": {
"MyPrivateChat": 9876543210
}
}Finally, change the workflow queue mode from simple "Run" to "Run (Instant)". Now run the workflow and the chat bot should work! (ignore any "missing input" errors, they don't block the workflow from running)
Compatibility:
The workflow is tested on ComfyUI 0.29.2. Newer versions 0.30.x introduce a queue-blocking bug when chaining “Any Inversed Switch” nodes. I submitted an issue to the “Comfyui-Easy-Use” repo but I doubt it will be fixed any time soon. The error stems from the updated Comfy backend and the only solution I see for now is downgrading to 0.29.2 (which can be easily done through the Manager).
The LLM voiceover uses OmniVoice TTS, which requires transformers 5.x. If you have a prior version (4.x), installation of this pack will attempt to upgrade several dependencies, including torch, which will BRICK your ComfyUI. Though this TTS is one of the best for voiceover of long texts atm, you can swap it for different one that works for you.
Used resources:
Native implementation of Krea-2 image generator:
https://huggingface.co/Comfy-Org/Krea-2Native implementation of Flux.2 Klein 9B image editor:
https://huggingface.co/black-forest-labs/FLUX.2-klein-base-9b-fp8
https://huggingface.co/Comfy-Org/vae-text-encorder-for-flux-klein-9bLLM used for demo: MN-VelvetCafe-RP-12B-V2.Q6_K.gguf. It is multilingual and quite good for RP ( ͡° ͜ʖ ͡°) but gets kinda dumb after several turns and doesn’t follow the system prompt very well (I didn't optimize the settings of the chat node for it though). Can be found here:
https://huggingface.co/mradermacher/MN-VelvetCafe-RP-12B-V2-GGUF
Placed in \ComfyUI\models\LLM\.
Overall, to reliably produce TTS-compatible text for voice lines I would recommend something like good old Qwen3.OmniVoice TTS node pack (model is automatically downloaded):
https://github.com/Saganaki22/ComfyUI-OmniVoice-TTSMultiple other custom node packs that are widely used by everyone and some additional packs for logic gates that don’t have any requirements. All of them can be found in the Manager.
A clean sample of Trump speaking. You can find it anywhere yourself. Or use some other voice reference if you don’t like Trump, in which case don't forget to tweak the system prompt for LLM.
Other useful stuff and tips:
1) How to set up command menu inside the bot chat:
Click on your bot above the chat window -> Manage -> Edit Commands -> after choosing "Edit Commands", send the command list to @BotFather:
image - Write a prompt to generate an image.
edit - Edit previously generated image.
talk - Send a message to Donald Trump.Note that the "Telegram Listener" node which receives the messages DOES NOT trigger from commands (written with slash /) by default!! To fix this you need to go to the custom node pack folder and find this file:
\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-telegram-bot-node\telegram_nodes.py
Open the file and change the line 99 from this:
message_handler = MessageHandler(
filters.TEXT & ~filters.COMMAND,
self._handle_message
)to this:
message_handler = MessageHandler(
filters.TEXT,
self._handle_message
)2) If you want to check your API connection to the bot, you can paste the following link (with your bot token ofc) into the url bar of the browser:
https://api.telegram.org/bot[bot token]/getUpdates
This should open a page with a simple text string like this:
{"ok":true,"result":[]}
If instead the page isn't loading at all, then ComfyUI would not be able to receive any messages from the bot or send output back. This is due to either Telegram being blocked in your country (use a VPN or something like Cloudflare's WARP to bypass restrictions), or Telegram bot servers are offline for some reason in which case you just need to wait for them to come back up online.
3) Where is chat history stored?
The last generated image is cached inside this subfolder:
\ComfyUI\output\telegram_bot\
The name of the image file corresponds to the ChatID that it was sent to (the user that wrote the prompt).
Chat history of the LLM node by default is stored here:
\ComfyUI\output\llm_session_sessions\
Again, the name of the .json file corresponds to the relevant ChatID.