Nodes/ComfyUI Telegram Suite/Telegram Bot πŸ”½
ComfyUI Node

Telegram Bot πŸ”½

The node that gives every other Telegram node a phone number

By SwissCore92Β·Created about a year agoΒ·Updated 2 months agoΒ· 9
Telegram Bot πŸ”½
    • bot
    • chat_id
    β—„botβ–Ύβ–Ί
    β—„chatβ–Ύβ–Ί
    β—„api_urlβ–Ύβ–Ί

    Telegram Bot is the front door of the whole ComfyUI Telegram Suite. Every other node in the pack needs a TELEGRAM_BOT instance and a chat_id before it can say a word, and this is the node that produces both. You drop one at the start of any workflow that should ping your phone when it's done - which, for most people, is the entire reason to install this pack. Render finishes, Telegram dings, you stop babysitting the queue.

    How it works

    The node never talks to Telegram itself. It reads ComfyUI/user/default/telegram-suite/config.json, looks up the token for whichever bot you select in the dropdown, and hands a bot object down the graph. That object holds your token as https://api.telegram.org/bot<TOKEN>, and every send node uses it to POST to the real Telegram Bot API over HTTP. The config file is created automatically with placeholder values the first time the pack loads - so if the dropdown only shows <YourBotName>, that's your cue that you haven't filled it in yet.

    You get a token from @BotFather in Telegram (send /newbot, follow the prompts). The chat id is the part people trip on: message your bot once, then open https://api.telegram.org/bot<TOKEN>/getUpdates in a browser and read the "chat":{"id":...} out of the JSON. Your private chat is a positive number; groups come back negative.

    The config

    {
      "bots": {
        "MyCoolBot": "123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11"
      },
      "chats": {
        "MyPrivateChat": 567891234,
        "MyGroupChat": -1012345678
      },
      "api_url": "http://localhost:8081"
    }
    

    The keys are just names you pick - the README suggests using the bot's @username. api_url is optional and only matters if you run your own Telegram Bot API server; leave it out and the pack uses the public https://api.telegram.org.

    Inputs and outputs

    • bot (required) - a dropdown of every bot in your config.
    • chat (optional) - a dropdown of every chat; the one you pick becomes the chat_id output, so you can set a default chat here and override it later in individual send nodes.
    • api_url (optional) - enum, defaults to https://api.telegram.org.

    Outputs are bot (the TELEGRAM_BOT instance) and chat_id (INT). Feed both into any of the send nodes.

    Install and the two gotchas that will actually bite

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

    Or search "ComfyUI Telegram Suite" in ComfyUI Manager - same thing, less typing. Either way: restart, fill in the config, restart again. That double restart is real, because the node reads the config when it loads; edits don't apply until you reload.

    Before you panic, two things. The pack needs ffmpeg on your PATH - the README says it in a big warning, and the audio nodes genuinely need it. And your bot token is deliberately scrubbed from the console: error logs show <telegram_bot_api> instead of your URL, which is nice when you're sharing a screenshot of a crash. If you hit a bot token ... was not found in ... config.json ValueError, the name in your workflow doesn't match a key in the config file. The path in that error is the author pointing you at the exact file to fix.

    CategoryTelegram Suite πŸ”½

    Inputs (3)

    NameTypeDefaultDescription
    botCOMBOSelect your telegram bot. /tmp/ComfyUI/custom_nodes/user/default/telegram-suite/config.json
    chatoptCOMBOSelect your telegram chat. /tmp/ComfyUI/custom_nodes/user/default/telegram-suite/config.json
    api_urloptCOMBOThe api url to use if you are using your own telegram bot api server. /tmp/ComfyUI/custom_nodes/user/default/telegram-suite/config.json Eg. 'api_url': 'http://localhost:8081'

    Outputs (2)

    NameTypeDescription
    botTELEGRAM_BOTβ€”
    chat_idINTβ€”