Learn-skills.dev telegram-cli
Use `tele` to authenticate, list dialogs, and fetch messages from Telegram.
install
source · Clone the upstream repo
git clone https://github.com/NeverSight/learn-skills.dev
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/NeverSight/learn-skills.dev "$T" && mkdir -p ~/.claude/skills && cp -r "$T/data/skills-md/afutured/tele-cli/telegram-cli" ~/.claude/skills/neversight-learn-skills-dev-telegram-cli && rm -rf "$T"
manifest:
data/skills-md/afutured/tele-cli/telegram-cli/SKILL.mdsource content
Telegram CLI Usage Guide
Overview
Use
tele to authenticate, list dialogs, and fetch messages from Telegram directly from the terminal.
Setup
- Requires
.uv - Install/upgrade (one-time per session):
uv tool install --upgrade git+https://github.com/AFutureD/tele-cli - Verify install:
tele -V - Per terminal session: run
once, then confirm auth withtele -h
(log in if needed).tele -f json me
Notice
- Call
once before running any command for the first time in the session.tele -h - Always use JSON output: always pass
to-f json
(example:tele
).tele -f json me - In each session, confirm authentication before running non-auth commands: run
.tele -f json me - Commands under
do not require an existing authenticated session.tele auth ...
Quick Start
- Read help once:
tele -h - Log in (interactive prompts):
tele auth login - Confirm who you are:
tele -f json me - List dialogs and find a
:dialog_idtele -f json dialog list - Fetch recent messages from a dialog:
tele -f json message list <dialog_id> -n 20
Session Management
Global options:
: alternate config file (default:--config <path>
)~/.config/tele/config.toml
: use a specific session file by name (listed by--session <name>
)tele auth list
Login / logout:
(creates a local session; prompts for phone, code, and optional 2FA password)tele auth login
(log in and make the new session active)tele auth login --switch
(logs out of the selected session)tele auth logout
List and switch sessions:
tele auth listtele auth switch --uid <user_id>
(acceptstele auth switch --username <username>
or@alice
)alicetele auth switch --session <session_name>
Where sessions live on disk (macOS/Linux default):
- Sessions folder:
~/.config/tele/sessions/ - Current activated session symlink:
~/.config/tele/sessions/Current.session
Dialog List
List all dialogs (users, groups, channels):
tele -f json dialog list
Notes:
- For
, the output follows the template:-f text[TYPE.UI.STATE] [UNREAD COUNT] [DIALOG_ID] NAME
:TYPE
user,U
group,G
channelC
:UI
pinned,P
archived,A
normal-
:STATE
muted,M
not muted-
- For
, each dialog includes keys like-f json
,name
(withentity
),id
, and the latestunread_count
.message
Message List
Fetch messages from a dialog:
tele -f json message list <dialog_id>
Common options:
- Limit count:
(example:-n <num>
)tele -f json message list <dialog_id> -n 20 - Pagination:
(fetch around/older than a known message id;--offset_id <message_id>
is excluded)offset_id - Output order:
--order asc|desc - Time filters:
--from "<natural language or date>"--to "<natural language or date>"
(overrides--range "<natural language range>"
, special:--from/--to
)"this week"
Examples:
tele -f json message list 1375282077 -n 10tele -f json message list 1375282077 --range "last week"tele -f json message list 1375282077 --from "2025-02-05" --to "yesterday"
Send Message
Send a text message to a user, group, or channel:
- Basic:
tele message send <receiver> "<message>" - Force peer id:
tele message send -t peer_id "<peer_id>" "<message>"
Receiver formats:
- Username:
oralice@alice - Phone:
"+15551234567" - Dialog name:
"My Group" - Numeric peer id:
(common for channels)"-1001234567890"
How the receiver is resolved:
- With
,--entity/-t peer_id
is treated as a numeric peer id (no name matching).<receiver> - Without
, it first tries Telegram/Telethon resolution (username/phone/id). If that fails, it scans your dialogs and picks the first match by:--entity- dialog name contains
(case-insensitive), or<receiver> - dialog id / entity id equals
(string compare).<receiver>
- dialog name contains
Examples:
tele message send alice "hi"tele message send "+15551234567" "hi"tele message send "My Group" "hi"tele message send -t peer_id "-1001234567890" "hi"
Notes:
- Quote negative peer ids (or use
) so the shell/CLI does not treat them as options.-- - The command prints no output on success; verify by listing messages:
.tele -f json message list <dialog_id> -n 5
Additional Informations
- Config file:
readstele
by default and will create it on first run;~/.config/tele/config.toml