KosmoKrator

communication

Telegram CLI for Shell Scripts

Use the Telegram CLI for shell scripts with headless JSON commands, schema discovery, credentials, and permission controls.

7 functions 5 read 2 write Bearer token auth

Telegram CLI for Shell Scripts

Call integration functions from shell scripts with stable JSON input and output.

Use shell scripts for small local automations that need one or more integration calls. The Telegram CLI uses the same integration registry as the TUI, Lua runtime, and MCP gateway, but returns predictable command output for automation.

Command Shape

# Telegram CLI for Shell Scripts
kosmokrator integrations:configure telegram --set access_token="$TELEGRAM_ACCESS_TOKEN" --enable --read allow --write ask --json
kosmo integrations:call telegram.telegram_send_message '{"chat_id":"example_chat_id","text":"example_text","parse_mode":"example_parse_mode","reply_to_message_id":1,"disable_notification":true}' --json

Discovery Before Execution

Agents and scripts can inspect Telegram docs and schemas before choosing a function.

kosmo integrations:docs telegram --json
kosmo integrations:docs telegram.telegram_send_message --json
kosmo integrations:schema telegram.telegram_send_message --json
kosmo integrations:search "Telegram" --json
kosmo integrations:list --json

Useful Telegram CLI Functions

FunctionTypeParametersDescription
telegram.telegram_send_message Write chat_id, text, parse_mode, reply_to_message_id, disable_notification Send a text message to a Telegram chat. Provide the chat_id and message text. The chat_id can be a numeric ID or @channelusername. Supports optional parse_mode (Markdown, MarkdownV2, HTML) and other formatting options.
telegram.telegram_list_updates Read offset, limit, timeout Get incoming updates (messages, callback queries, inline queries, etc.) for the Telegram bot. Use offset to acknowledge previously received updates. Returns an array of update objects.
telegram.telegram_get_me Read none Get information about the authenticated Telegram bot. Returns the bot ID, username, display name, and capability flags.
telegram.telegram_list_chats Read limit List recent chats the bot has interacted with. Since Telegram Bot API does not have a native list-chats endpoint, this fetches recent updates and extracts unique chats. Returns chat IDs, types, and titles.
telegram.telegram_get_chat Read chat_id Get information about a specific Telegram chat by its ID or @username. Returns chat type, title, description, member count, and other metadata.
telegram.telegram_send_photo Write chat_id, photo, caption, parse_mode, reply_to_message_id, disable_notification Send a photo to a Telegram chat. Provide the chat_id and a photo URL or file_id. Supports optional caption with formatting and other options.
telegram.telegram_get_current_user Read none Get the profile of the currently authenticated Telegram bot. Returns bot ID, username, display name, and capability flags.

Automation Notes

Related Telegram CLI Pages