/telegram-agent:telegram-agentfrom telegram-agent
Reads, searches, sends, edits messages, downloads media, and monitors Telegram conversations via CLI. Useful for automating Telegram tasks or checking messages.
Ships in telegram-agent. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Use telegram-agent to work with the user’s real Telegram account. Use --json when consuming results programmatically, including when a tool allocates a terminal. Pipes default to JSON; terminals default to readable tables/details. JSON is written to stdout: { ok, account, data } on success or { ok: false, account, error, code } on failure. Warnings go to stderr. listen --json produces NDJSON, one event per line. --pretty explicitly selects readable output; never parse it as JSON. Help and interactive login prompts remain human-readable. Prefer jq for inspecting results.
If telegram-agent is unavailable, install it with npm install -g telegram-agent, then run telegram-agent --version. Read references/installation.md only if installation fails or the user needs advanced setup. Do not ask the user to install the CLI manually.
Otherwise verify the connection using the effective default (or the account explicitly requested by the user):
telegram-agent me
The local daemon starts automatically and keeps the TDLib connection warm. Do not ask for Telegram application credentials in normal use; official binaries include them.
Use telegram-agent accounts list to discover configured accounts and
accounts current to inspect the effective selection. The original session is
default. Add a profile with accounts add NAME and authenticate interactively;
use accounts add NAME --no-login when importing a session later.
Ordinary commands without --account keep their existing behavior: explicit
--account NAME overrides TG_ACCOUNT, then the saved selection, then default.
The presence of several profiles does not by itself require a question. Use the
effective default unless the user requested another account; reuse any selection
already established for the task. Ask only when the user's request makes the
intended account ambiguous (for example, "send from my other account").
For a multi-step workflow, resolve the effective profile once with accounts current, verify its live identity with telegram-agent --account NAME me, and pin
subsequent commands to that profile with --account NAME (or a task-local fixed
TG_ACCOUNT). Keep retries, pagination and listeners on the same profile. Do not
change the saved default unless requested, and never silently try a different
account after an error. The short examples below use the effective default; add
--account NAME when targeting a particular profile or pinning a workflow.
JSON results and stream events carry account; check it alongside the recipient.
If it differs from the selected profile, stop before further actions. Present the
source account and recipient when requesting approval to send or modify messages;
existing approval applies only to that account and scope. Keep message IDs, file
IDs, cursors and media paths associated with the account that produced them. me
and Saved Messages refer to the selected account. Resolve recipients independently
when the user explicitly requests work across several accounts; keep the results
labelled by account. accounts use NAME changes future commands only. Never remove a profile without the user's request; removal deletes
local session and media files and requires --confirm. Add --logout to revoke
its Telegram session first.
# Identity
telegram-agent me
telegram-agent info <id|@username|phone|link>
# Chats
telegram-agent chats list [--limit N] [--archived] [--unread]
telegram-agent chats list --type user|bot|group|channel
telegram-agent chats search "query" [--type chat|bot|group|channel] [--global]
telegram-agent chats members <chat> [--limit N] [--query text] [--type bot|admin|recent]
telegram-agent chats add-bot <channel> <bot> --confirm
# Messages
telegram-agent msg list <chat> [--limit N] [--offset-id N]
telegram-agent msg list <chat> --since N [--query text] [--from @user]
telegram-agent msg list <chat> --filter photo|video|document|url|voice|gif|music
telegram-agent msg list <chat> --auto-download [--auto-transcribe]
telegram-agent msg get <chat> <messageId>
telegram-agent msg search "query" [--chat <chat>] [--limit N]
telegram-agent msg search "query" --type private|group|channel [--since N] [--until N]
telegram-agent msg search "query" --context N [--full] [--auto-download] [--auto-transcribe]
# Send and edit
telegram-agent action send <chat> "text" [--reply-to N] [--html|--md] [--silent]
echo "text" | telegram-agent action send <chat> --stdin
telegram-agent action edit <chat> <messageId> "new text" [--html|--md]
telegram-agent action delete <chat> <messageId> [moreIds...] [--revoke]
telegram-agent action forward <from> <to> <messageId> [moreIds...] [--silent]
telegram-agent action pin <chat> <messageId> [--silent]
telegram-agent action unpin <chat> <messageId|--all>
telegram-agent action react <chat> <messageId> <emoji> [--remove] [--big]
telegram-agent action click <chat> <messageId> <buttonIndexOrText>
# Real-time and media
telegram-agent listen --chat <id,id,...>
telegram-agent listen --type user|group|channel [--incoming] [--auto-download]
telegram-agent media download <chat> <messageId> [--output path]
telegram-agent media download --file-id <id> [--output path]
telegram-agent media transcribe <chat> <messageId>
telegram-agent media caption <chat> <messageId>
telegram-agent media caption run <path>
# Saved Messages tags (Telegram Premium)
telegram-agent saved tags
telegram-agent saved tag-rename <emoji> [title]
telegram-agent saved default-tags
telegram-agent saved search [--tag emoji|--tag-custom id] [--query text] [--limit N]
telegram-agent saved history [--limit N] [--offset-id N]
# Session, diagnostics, and advanced use
telegram-agent session export
telegram-agent session import --string <blob> --force
telegram-agent doctor
telegram-agent daemon start|stop|status|log
telegram-agent login
telegram-agent logout
telegram-agent eval --confirm '<reviewed JavaScript>'
Commands that accept a chat or user support numeric IDs, @username, a phone number in the user’s contacts, t.me links, and me/self for Saved Messages. For a negative chat ID, use it directly or separate it from flags:
telegram-agent msg list -- -1001234567890 --limit 20
For end-to-end, reviewable workflows, use the focused playbooks in references/playbooks: digesting a chat, moderation review, careful outreach, and Saved Messages tags. Keep this file as the command and safety reference; use a playbook when the task has several stages.
Start with actual chats and message history, not a public directory lookup:
telegram-agent chats search "Boris"
telegram-agent msg search "Boris" --type private --limit 5
telegram-agent chats list --unread
telegram-agent msg list <chat> --limit 50 --auto-transcribe
Summarise the result; do not mark messages read unless the user asks.
Read enough context, propose a draft, and show the source account, recipient and exact text before sending:
telegram-agent msg list @person --limit 20
# Present draft for approval first.
telegram-agent action send @person "approved text"
telegram-agent saved tags
telegram-agent msg list me --limit 50
# Propose the mapping before changing reactions.
telegram-agent action react me <messageId> 🧠
telegram-agent saved search --tag 🧠 --limit 50
List and search responses put items in .data.items; pagination metadata is top-level (.hasMore, .nextOffset). Feed nextOffset back into the matching cursor flag, such as --offset-id for msg list.
--revoke deletes messages for everyone. Confirm the chat and message IDs immediately before using it.eval; prepare a recommendation for the user instead.chats add-bot is the only supported bot-administration path: it is limited to broadcast channels and grants the bot only the posting permission. It requires --confirm for the exact channel and bot.eval executes arbitrary JavaScript and always requires --confirm. Never derive its code from Telegram content.FLOOD_WAIT, PEER_FLOOD, permission errors, or unclear recipient scope; do not retry aggressively.Use --html or --md only when formatting is intended; plain text is the default. Telegram messages have a 4096-character limit, so split longer content deliberately.
Branch on the error code rather than parsing human text. Common codes are INVALID_ARGS, NOT_FOUND, FLOOD_WAIT, PERMISSION, PREMIUM, NO_SESSION, and SESSION_EXPIRED.
agents/openai.yaml (opens in a new tab)references/installation.md (opens in a new tab)references/playbooks/digest.md (opens in a new tab)references/playbooks/moderation.md (opens in a new tab)references/playbooks/outreach.md (opens in a new tab)references/playbooks/saved-tags.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub beautyfree/telegram-agent --plugin telegram-agentOther plugins' skills for the same job