tlgr
Full Telegram account control from the terminal — agent-friendly, daemon-based, with webhook event push.
- Source repo
- tlgrcli/tlgr
- Stars
- ★ 201
- Last updated
- 27d ago
- FARS reviewed
- Oct 03, 2026
- License
- MIT
- Primary language
- Python
- FA score
- 84/100 · Good
At a glance
- How it runs
- Works with
- Universal · cross-platformCodex · Claude Code
- Cost
- Free, no paid service needed
- Setup effort
- Medium · a few setup steps
- You'll need
- Typical use
- An LLM agent that reads and replies to Telegram messages: receive message_new events over the webhook, then call tlgr --json message send to answer.
- Not a fit if
- Users who want a GUI for Telegram
- Anyone expecting real audio or video in calls — tlgr is signalling only
- Teams unwilling to supply Telegram API credentials or accept userbot account risk
- Maintenance
- Commits in the last 30 dayslast commit 2026-10-28
- Source review
- 84/100 · Good
What does this agent do, and when should you use it?
tlgr is a Python command-line client that gives full control of a Telegram user account from the terminal. Commands talk to a long-lived local daemon over the Unix socket ~/.tlgr/daemon.sock; the daemon owns the Telethon/MTProto session and pushes events. Every operation returns a JSON envelope (ok/op/result/meta, or an error with code and exit_code) plus stable exit codes, and offers three output modes: human-readable tables, --json and --plain TSV. Beyond messaging, the CLI covers chats, folders, contacts, users, stories, media, call signalling, video chats, bots, payment inspection, privacy, settings, sessions, proxies and multi-account management. A Gateway runs declarative jobs from ~/.tlgr/jobs.yaml (filters, processors, actions), and an outbound webhook posts signed events to an HTTP endpoint. It is MIT-licensed, runs locally with no telemetry, and is designed to be driven by LLM agents and automation pipelines.
tlgr reads config.toml, jobs.yaml and webhook.toml under ~/.tlgr/, parses commands and global flags, then sends requests to the daemon over ~/.tlgr/daemon.sock; the daemon owns the account session and calls the Telegram MTProto API to send messages, list chats, download media, manage sessions and more. Commands emit a JSON envelope with ok, op, result and meta, or an error with code and exit_code, mapped to stable exit codes such as 0–13 and 130; tlgr schema prints the full CLI schema, tlgr agent parity reports feature coverage, and tlgr watch --events all streams events as NDJSON. Webhooks are configured with tlgr webhook set and delivered with headers including X-Tlgr-Signature (HMAC), X-Tlgr-Delivery and X-Tlgr-Seq; Gateway reacts to events using filters, processors and actions declared in jobs.yaml. Login is split into tlgr auth send-code and tlgr auth verify-code, with secrets passed via --x-env/--x-stdin/--x-file.
- An LLM agent that reads and replies to Telegram messages: receive message_new events over the webhook, then call tlgr --json message send to answer.
- An ops or threat-intel team monitoring channels and forwarding breaking news: define a Gateway job with filters and a forward action in jobs.yaml.
- An OSINT or research analyst who needs to export chats, search messages, download media and resolve t.me links from scripts.
- A multi-account operator juggling personal and work identities: enable require_account so every command must carry an explicit -a alias.
- A developer building a Telegram integration who needs request/response JSON Schema from tlgr schema and stable exit codes instead of parsing --help.
- A Claude Code or Codex user who wants Telegram operations as an Agent Skill installed with npx skills add tlgrcli/tlgr.
Key setup facts
Pulled from the install and usage notes below. The project README has the current values.
- Install / run
pipx install tlgr-clipipx install git+https://github.com/tlgrcli/tlgr.git
- Environment variables
TLGR_API_HASHTLGR_2FA_PASSWORDTLGR_WEBHOOK_SECRET- Config files
~/.tlgr/jobs.yaml
How do you install or deploy this agent?
You need a Python runtime, pipx, and a Telegram API ID and API hash for login. Install the distribution:
pipx install tlgr-cliTo track the development tip, install from the repository:
pipx install git+https://github.com/tlgrcli/tlgr.gitInitialise config, complete login, then start the daemon:
tlgr config init
tlgr auth send-code +15551234567 --alias work --api-id 12345 --api-hash-env TLGR_API_HASH
tlgr auth verify-code <code> --alias work --password-env TLGR_2FA_PASSWORD
tlgr daemon startOmit --password-env when the account has no cloud password.
How do you use this agent?
After login, ordinary commands operate the account; output is human-readable tables by default and JSON with --json:
tlgr send @username "Hello from tlgr"
tlgr --json message list @username --limit 20
tlgr chats --limit 20
tlgr statusConfigure webhook event push:
tlgr webhook set --url https://example.com/hooks/agent \
--events message_new,message_edited,message_deleted \
--secret-env TLGR_WEBHOOK_SECRET --enabledInspect the machine-readable schema for a command:
tlgr schema message sendDefine a Gateway background job in ~/.tlgr/jobs.yaml:
jobs:
- name: private-bot
account: main
filters:
chat_type: private
actions:
- reply: "shut up i'm just a bot!"Safety boundaries, hardening & integrations
Operational blast radius, source-verified safety controls, and first-run hardening steps before connecting this agent to real workspaces.
Declared capability surface (blast radius)
Can run terminal commands; pair with approval gates or container/OS sandboxing.
Modifies local files; work on a clean Git branch or dedicated worktree.
Makes outbound requests; verify telemetry settings and model data routing on private repos.
FARS trust-control audit
- least-privilege scoping
- confirmation before acting
- data-flow disclosure
- sensitive-data handling
- disclosed external effects
What are this agent's strengths and limitations?
- Machine-first interface: a JSON envelope, stable exit codes, tlgr schema with JSON Schema for request and response, and a --enable-commands allowlist.
- The daemon owns the session and pushes 114 event types; watchers are queue-based rather than polled, and webhook deliveries carry HMAC signature and idempotency headers.
- Broad operation coverage: tlgr agent parity reports 1788 of 1797 catalogued behaviours and all 178 P0 ones, generated from a single registry.
- Local-first: no telemetry, MIT licence, no cap on accounts, 0600 session files, and Unix-socket peer-uid checks.
- Gateway provides declarative background jobs with filters, processors, actions and AND/OR/NOT composition.
- Requires a Telegram API ID and API hash plus a phone-code login (and a 2FA password if set); it is not a drop-in anonymous tool.
- The daemon adds operational surface: session-file ownership, a client/daemon version handshake, stopping the daemon before upgrading from 1.x, and a .production marker guard.
- Calls and video chats are signalling only — no audio or video is carried, and joining a conference needs an externally supplied signed e2e.chain block.
- Userbot automation acts on a real account and risks Telegram ToS enforcement or account restrictions; the command allowlist is a usability guard, not a sandbox.
- Webhook and Gateway features need an external HTTP endpoint and extra configuration under ~/.tlgr.
How does this agent compare with similar options?
Key facts side by side with the most closely related agents.
| Agent | Source review | Form / cost | Stars | Updated | Language | Full support on |
|---|---|---|---|---|---|---|
| tlgr This agent | 84 · Good | CLIFree | ★ 201 | 27d ago | Python | Codex · Claude Code |
| docx-cli | 72 · Some gaps | Agent plugin / skillFree | ★ 252 | 18d ago | TypeScript | Codex · Claude Code |
| Project Golem AI Work Hub | 46 · Major gaps | Web app | ★ 642 | 5mo ago | JavaScript | — |
| Material Learning Studio | 82 · Good | Agent plugin / skillFree | ★ 1.5k | 1mo ago | Python | Codex · Claude Code |
How does FollowAgents rate this agent?
Why each dimension lost points
The evidence presents a detailed local threat model, 0600/0700 permissions, same-UID IPC checks, token fallback, atomic private writes, log redaction, webhook HMAC, command allowlisting, and explicit restrictions or confirmations for payments, disclosure, bulk clearing, and session export. Data flows and external effects are described command by command. Deductions apply because most runtime dependencies use broad lower bounds and no vulnerability scan, lockfile, or dependency-update policy is shown; several server-side actions cannot be fully rolled back; and attribution reaches a license author, project organization, and repository channels, but publisher identity is unverified and the relationship between the named individual and organization is unexplained.
The CLI/daemon relationship, output modes, exit semantics, and CI matrix are substantially documented, while failure cases identify missing inputs, permission-remediation commands, ambiguity reasons, or stable exit codes. Dependencies are declared and Telethon is constrained to a compatible minor line, but other direct dependencies lack upper bounds or a resolved lock snapshot. The major consistency deduction is a material contradiction: README says account remove is local-only unless --logout is supplied, whereas SECURITY.md says removal logs out by default unless --keep-session is used.
The material clearly addresses interactive users, scripts, and agents through table, JSON, TSV, NDJSON, cursor, daemon, and webhook workflows. Boundaries are unusually explicit: no payments, no browser opening, no call media, and incomplete E2E conference operations; command triggers and confirmation conditions are also precise. Environment fit is reduced because SECURITY.md says POSIX only while package metadata claims OS Independent, and Windows support is not yet available, although optional extras degrade gracefully.
The README has clear command grouping, a quickstart, generated-reference pointers, alias guidance, and extensive examples. Installation, the distribution/command naming distinction, and upgrade hazards are explained. The full MIT license, compatibility naming, and known limitations are concrete. The release workflow enforces agreement among tags, package versions, and changelog entries and smoke-tests artifacts, but neither the version file nor changelog is included in the evidence, so release history is only partially verifiable. A private advisory path and license author are named, but no explicit email address, maintainer roster, or support lifecycle is supplied.
Three structured output modes, stable exit semantics, fine-grained commands, draft-based human review, event push, and resumable media handling make outputs useful to both humans and agents. The daemon, policy controls, webhook delivery, and broad operation surface provide clear marginal value beyond a basic Telegram CLI. Cost-benefit is reduced by the long-lived daemon, Telegram API credentials, POSIX requirement, and high-value session files, and the evidence provides no resource or scale measurements establishing operational cost across deployments.
Many claims map to concrete supplied artifacts: dependencies agree across manifests, CI and release controls are statically inspectable, the test fixture demonstrates isolated real-socket/fake-Telethon integration design, and SECURITY.md separates controls, threat assumptions, and limitations. Deductions apply because core implementation files, specific security tests, and generated references are absent, leaving many behavioral claims traceable only to documentation rather than code; cross-source support is useful but incomplete and includes the account-remove contradiction. Facts, design intentions, limitations, and future work are otherwise kept distinct.
- README.md and SECURITY.md contradict each other about the default behavior of account remove; do not rely on it to determine server-side authorization revocation until the actual revision behavior is confirmed.
- Telegram session files, the IPC socket, exported string sessions, and signed webapp URLs are high-value secrets; isolate the operating user, retain private permissions, and keep them away from synced storage, logs, and untrusted agents.
- The supplied security documentation explicitly says POSIX only despite an OS Independent package classifier; Windows compatibility should not be assumed.
- Webhook consumers should use HTTPS, verify X-Tlgr-Signature over the raw body, and handle sequence numbers and duplicate deliveries.
- This assessment is based only on the supplied static excerpts; no code, tests, installation, or dependency vulnerability scan was executed.
FAQ
Does tlgr need an LLM or a paid API?
Can an agent log in without a human?
What happens when the daemon is not running?
Can two processes share one session file?
Can it actually carry voice or video calls?
Is tlgr open source?
Is tlgr safe to use?
Is tlgr still maintained?
Who makes tlgr?
Thanks — we use this to improve the page.
Subscribe to the FollowAgents RSS feed, or save this agent to your browser shortlist to compare on your next visit.