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

At a glance

How it runs
CLIAgent plugin / skill
Works with
Universal · cross-platformCodex · Claude Code
Cost
Free, no paid service needed
Setup effort
Medium · a few setup steps
You'll need
pipxPythonTelegram API ID and API hashShell / CLINetwork accessLocal filesystem
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.

  1. 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.
  2. 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.
  3. An OSINT or research analyst who needs to export chats, search messages, download media and resolve t.me links from scripts.
  4. A multi-account operator juggling personal and work identities: enable require_account so every command must carry an explicit -a alias.
  5. A developer building a Telegram integration who needs request/response JSON Schema from tlgr schema and stable exit codes instead of parsing --help.
  6. 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-cli
  • pipx install git+https://github.com/tlgrcli/tlgr.git
Environment variables
TLGR_API_HASH TLGR_2FA_PASSWORD TLGR_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-cli

To track the development tip, install from the repository:

pipx install git+https://github.com/tlgrcli/tlgr.git

Initialise 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 start

Omit --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 status

Configure webhook event push:

tlgr webhook set --url https://example.com/hooks/agent \
                 --events message_new,message_edited,message_deleted \
                 --secret-env TLGR_WEBHOOK_SECRET --enabled

Inspect the machine-readable schema for a command:

tlgr schema message send

Define 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)

Local shell command execution

Can run terminal commands; pair with approval gates or container/OS sandboxing.

Local filesystem read/write

Modifies local files; work on a clean Git branch or dedicated worktree.

Outbound network access

Makes outbound requests; verify telemetry settings and model data routing on private repos.

FARS trust-control audit

Verified present in source (3/3)
  • least-privilege scoping
  • confirmation before acting
  • data-flow disclosure
  • sensitive-data handling
  • disclosed external effects

What are this agent's strengths and limitations?

Pros
  • 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.
Limitations
  • 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?

FollowAgents source review · FARS-2.1
Good
84/ 100 5-point scale 4.2 / 5
Trust 25/29
Reliability 9/14
Adaptability 16/18
Convention 16/18
Effectiveness 12/13
Verifiability 6/8
Why each dimension lost points
Trust25 / 29 · 4.3/5

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.

Reliability9 / 14 · 3.2/5

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.

Adaptability16 / 18 · 4.4/5

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.

Convention16 / 18 · 4.4/5

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.

Effectiveness12 / 13 · 4.6/5

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.

Verifiability6 / 8 · 3.8/5

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.

Risks and how to mitigate them
  • 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.
Evidence confidence: Low Reviewed Oct 03, 2026 Reviewed revision 87de859aab52
See the full review method →
Maintain this project? Add the FARS badge to your README

The badge shows the current review score and verdict and links back to this page. It refreshes about once an hour after a re-review.

FARS

[![FARS review](https://followagents.com/badge/tlgr.svg)](https://followagents.com/en/agents/tlgr)
<a href="https://followagents.com/en/agents/tlgr"><img src="https://followagents.com/badge/tlgr.svg" alt="FARS review"></a>

FAQ

Does tlgr need an LLM or a paid API?
No. It is a local Python CLI over Telegram's MTProto; the only costs are your own Telegram account and any server you run for webhooks. There is no model-provider dependency.
Can an agent log in without a human?
Mostly. Login is tlgr auth send-code followed by tlgr auth verify-code; only reading the code needs a person. With another account already logged in, tlgr auth code list -a <alias> reads the code Telegram delivered to that account's service chat. Pass secrets through --x-env/--x-stdin/--x-file, never argv.
What happens when the daemon is not running?
The CLI talks to the daemon over ~/.tlgr/daemon.sock. A newer client restarts a running daemon exactly once and says so on stderr, or refuses with --no-daemon-restart and exit 11. tlgr status distinguishes running, ready and healthy.
Can two processes share one session file?
No. The README warns that two processes on one session file can revoke an authorization. The daemon owns the session, and a home with a .production marker is refused unless TLGR_ALLOW_PRODUCTION_HOME=1.
Can it actually carry voice or video calls?
It implements the signalling half only: ring, answer, hang up, mute, moderate, record and observe. Answers report "media": "none" and no audio or video is carried.
Is tlgr open source?
Yes. The source code is on GitHub (tlgrcli/tlgr) under the MIT licence.
Is tlgr safe to use?
FollowAgents' FARS review (Oct 03, 2026) scored tlgr 25/29 on trust and safety. None of the eight safety controls the review checks for was missing outright.
Is tlgr still maintained?
Yes. The latest commit on GitHub is from 2026-10-28, within the last 30 days.
Who makes tlgr?
tlgr is published on GitHub by the account tlgrcli. FollowAgents has not verified which person or company is behind that account.
Was this page helpful?
View on GitHub ↗ Install ↓

Compare agents like this one

The same FARS review applied across the shortlist this agent qualifies for.

Related concepts