ComfyUI Node

TG API Method ◀️

The escape hatch for every Telegram call this pack doesn't wrap

By CoolBreeze164·Created 13 days ago·Updated 2 days ago· 3
TG API Method ◀️
  • params
  • RESULT *
◄bot_token►
◄method_namegetMe►
◄chat_id—►

Want the bot to pin a message? Set its command menu? Fetch a chat member's status? Check what token you actually pasted? None of that is a node in this pack - and none of it needs to be, because this one calls any Telegram Bot API method by name.

How it works

You give it a method name and a DICT of parameters, and it POSTs to https://api.telegram.org/bot<token>/<method_name> using the same httpx client and the same retry policy as the senders. The method name is matched case-insensitively, per the tooltip; the default is getMe, which is a nice built-in sanity check - it returns your bot's own profile if the token works.

params is a DICT (the type ComfyUI uses for structured blobs). Two conveniences save you real fiddling: the optional chat_id socket is merged into the params dictionary as chat_id if you wire it, and the transport JSON-encodes dict, list and boolean values for you while dropping None ones. So you don't have to hand-serialize nested objects, and you can't accidentally send a literal Python True.

This node also always runs. Its IS_CHANGED returns float("nan"), which is the standard ComfyUI way of opting out of the execution cache - NaN never equals itself, so the node can't be skipped even when its inputs are identical to last run. That's what makes it usable as a per-run housekeeping call rather than a one-shot.

The outputs, honestly

There's one: RESULT *, a wildcard. It's whatever Telegram's result field contained - a dict for getMe, True for most setters, a list for getChatAdministrators. The wildcard type means it wires into any input declaring *, which in this pack is the trigger sockets; elsewhere you'd need a node that accepts anything. In practice you use this node for the side effect, not the return value. If you expected to pull a chat member's name out of it and into a prompt, you're going to need a downstream node that can actually read a DICT, and this pack doesn't ship one beyond the send/edit family.

Failure behaviour: transient trouble retries up to five times, then the output becomes a silent blocker so nothing downstream edits a phantom message. Permanent errors - bad credentials, a forbidden chat, an invalid parameter - raise as errors, which is what you want, because those are your bug, not the network's.

The calls people actually set it to

  • getMe - verify a token before a long generation, and confirm which bot you're talking to.
  • deleteWebhook - with drop_pending_updates set to false, this clears the "terminated by other getUpdates request" conflict when you switch from a webhook setup to this poller. The Listener deliberately never deletes a webhook on its own, so this is on you.
  • setMyCommands (with commands built in Parse JSON) - give the bot a proper / command menu.
  • pinChatMessage, sendLocation, sendSticker, answerCallbackQuery, getChatMember - the long tail of things that have nothing to do with images.

One caution that applies to the whole pack but bites hardest here: your bot token lives in the widget and gets saved into the workflow JSON. This is also a node whose entire job is to call the network with your credential, which is exactly the pattern that made LLMVISION possible - a node that phones home with your key is the one kind of node where a malicious phone-home doesn't look wrong. You're calling the official Telegram host, so the risk is your own hygiene, not the pack's: scrub the token before sharing graphs.

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 uses python_embeded\python.exe. Dependencies are httpx, numpy, pillow, av>=14.2.0; no models, no config file, no Telegram SDK. Manager users: search ComfyUI Autonomous Telegram Bot. It's filed under Autonomous Telegram Bot ◀️/experimental, next to Parse JSON - a fair label.

Common issues

  • Telegram <method>: ... (code 400) - Telegram's description is in the message and it's usually blunt: the parameter name or value is wrong. Cross-check the Bot API page for that method's exact field names.
  • Token error before anything else happens - the token is validated as digits:letters and rejected with "Enter a valid Telegram bot_token from BotFather (digits:token)". A stray quote or a pasted bot prefix fails here.
  • Nothing comes back usable - expected; output is a wildcard and most methods return True.
  • Params ignored - check the names. Telegram is camelCase (disable_notification, message_thread_id), and unknown keys get rejected rather than ignored.
  • It re-runs every queue - that's IS_CHANGED returning NaN by design. Don't put an expensive method in it and expect caching.
CategoryAutonomous Telegram Bot ◀️/experimental

Inputs (4)

NameTypeDefaultDescription
bot_tokenSTRINGTelegram bot token from BotFather
method_nameSTRINGgetMeThe telegram bot api message to call. (case insensitive)
chat_idoptINTUnique identifier for the target chat
paramsoptDICT[object Object]The method parameters.

Outputs (1)

NameTypeDescription
RESULT **—