Read posts and comments from Telegram channels via MTProto (Pyrogram or Telethon). Fetch recent messages and discussion replies from public or private channels by time window.
Standardmäßig ist der Prompt ausgewählt, der zuerst die Quelle prüft. Sie können zu einem direkten Befehl wechseln oder eine lokale Kopie herunterladen.
Quelldateien prüfen
Lesen Sie SKILL.md und alle von SkillsMP angezeigten Begleitdateien, bevor Sie sich für eine Installation entscheiden.
Mit Codex oder Claude installieren Kopieren Sie diesen Prompt, fügen Sie ihn in Codex, Claude oder einen anderen Assistant ein und lassen Sie die Skill-Seite prüfen und installieren.
Ein direkter Befehl überspringt den Prüf-Prompt. Prüfen Sie die Quelle, bevor Sie ihn ausführen.
Read posts and comments from Telegram channels via MTProto (Pyrogram or Telethon). Fetch recent messages and discussion replies from public or private channels by time window.
Read posts and comments from Telegram channels using MTProto (Pyrogram or Telethon).
Works with any public channel and private channels the user is subscribed to.
Supports fetching discussion replies (comments) for individual posts.
Security notice: This skill requires TG_API_ID and TG_API_HASH from my.telegram.org. The session file grants full Telegram account access — store it securely and never share it.
Exec Approvals
Just installed via clawhub install? Complete Setup & Installation (below) first — the skill needs pip install, credentials, and a session file before exec approvals matter.
OpenClaw blocks unknown CLI commands by default. The user must approve tg-reader commands before they can run. If the command hangs or the user says nothing is happening — exec approval is likely pending.
Quick setup (recommended)
Run from the skill directory — checks prerequisites, installs pip packages if needed, and prints the approval commands to run:
cd ~/.openclaw/workspace/skills/sergei-mikhailov-tg-channel-reader
bash setup-tg-reader.sh
Control UI — open http://localhost:18789/, find the pending approval for tg-reader, click "Always allow". Docs
Messenger (Telegram, Slack, Discord) — the bot sends an approval request with an <id>. Reply: /approve <id> allow-always. Other options: allow-once, deny.
The approval prompt appears in the Control UI or as a bot message — not in the agent's conversation. This is a common source of confusion.
When to Use
User asks to "check", "read", or "monitor" a Telegram channel
Wants a digest or summary of recent posts
Asks "what's new in @channel" or "summarize last 24h from @channel"
Wants to track or compare multiple channels
Wants channel info (title, description, subscribers) — use tg-reader info
Quick Start
# 1. Run pre-flight diagnostic (fast, no Telegram connection)
tg-reader-check
# 2. Get channel info
tg-reader info @channel_name
# 3. Fetch recent posts
tg-reader fetch @channel_name --since 24h
tg-reader: command not found? Run bash setup-tg-reader.sh from the skill directory (it will install the package), or manually: cd ~/.openclaw/workspace/skills/sergei-mikhailov-tg-channel-reader && pip install .
Commands
tg-reader-check — Pre-flight Diagnostic
Always run before fetching. Fast offline check — no Telegram connection needed.
Option B — env var (works with ~/.openclaw/openclaw.json):
export TG_READ_UNREAD=true
Env vars take priority over the config file. This lets you enable read_unread via openclaw.json Docker env alongside TG_API_ID/TG_API_HASH.
State is stored in ~/.tg-reader-state.json (configurable via "state_file" in config, TG_STATE_FILE env var, or --state-file flag).
Behavior
--since is not needed when read_unread is enabled — the skill automatically returns all unread posts regardless of time
First run (no prior state for channel): --since applies as usual (default 24h); state file created
Subsequent runs: only posts newer than the last read are returned; --since is ignored
--all flag: bypasses read_unread mode — fetches everything by --since without updating state (preserves your position)
New channel: behaves like a first run (no prior state)
No new posts: state unchanged, count: 0 returned
Examples
# With read_unread enabled — just fetch, no --since needed
tg-reader fetch @channel_name
# First run for a new channel — --since determines initial window
tg-reader fetch @new_channel --since 7d
# Override: fetch everything, don't update tracking state
tg-reader fetch @channel_name --since 7d --all
Output
When read_unread mode is active, the JSON output includes a read_unread field:
{"id":-1001234567890,"title":"Channel Name","username":"channel_name","description":"About this channel...","members_count":42000,"link":"https://t.me/channel_name"}
comments_available: false — channel has no linked discussion group (no comments possible)
comments_error on a message — rate limit hit for that post's comments
from_user may be null for anonymous comments
Images/videos in comments are not analyzed — only text is captured
Default post limit drops to 30 when --comments is active (override with --limit)
After Fetching
Parse the JSON output
Posts with images/videos have has_media: true and a media_type field. Their text is in the text field (from the caption). Do not skip posts just because they have media — they often contain important text.
Images and videos are not analyzed (no OCR/vision) — only the text/caption is returned.
Summarize key themes, top posts by views, notable links
If comments_enabled: true, analyze comment sentiment and key themes alongside the main posts
Save summary to memory/YYYY-MM-DD.md if user wants to track over time
Saving to File (Token Economy)
Use --output when the result is large (especially with --comments) and you don't need to analyze it immediately. The full data goes to a file, and stdout returns only a short confirmation — this saves tokens.
Periodic updates pattern: set up a cron task that runs tg-reader fetch @channel --comments --output comments.json on schedule. The file gets updated regularly. When the user asks to analyze comments — read the file instead of re-fetching. This avoids consuming tokens on every fetch.
When --output is used without a filename, the default is tg-output.json. Stdout confirmation:
Set these in your current shell session. Avoid writing TG_API_HASH to shell profiles (~/.bashrc) — use ~/.tg-reader.json instead for persistent storage.
Note: Agents and servers don't load shell profiles. Use ~/.tg-reader.json (the recommended method above) for non-interactive environments.
Step 3 — Install & Configure
npx clawhub@latest install sergei-mikhailov-tg-channel-reader
cd ~/.openclaw/workspace/skills/sergei-mikhailov-tg-channel-reader
bash setup-tg-reader.sh
The setup script: installs Python packages (pip install .), checks credentials and session, runs tg-reader-check, and prints the exec approval commands for you to run manually.
On Linux with managed Python (Ubuntu/Debian), use a venv before running the setup script:
Pyrogram will ask to confirm the phone number — answer y. The code arrives in the Telegram app (not SMS).
Step 5 — Verify
tg-reader-check
Should return "status": "ok". If not — fix the reported issues and re-run bash setup-tg-reader.sh.
Scheduled Tasks & Cron
This skill needs network access (MTProto connection to Telegram servers) and a session file. How you configure OpenClaw cron depends on the session target.
Important: When setting up a scheduled task that uses tg-reader, tell the user which approach you're using and what it means — so they can make an informed choice.
Option A — sessionTarget: "main" (recommended)
The cron task sends a reminder to the main agent session. The agent then runs tg-reader in the main environment where the skill, credentials, and session file are already available.
Pros: No extra configuration — everything works out of the box.
Cons: Not fully autonomous — the task sends a system event, the agent picks it up and executes. Requires payload.kind: "systemEvent" (OpenClaw cron API limitation for main target).
How to set up:
Create a cron task with sessionTarget: "main" and payload.kind: "systemEvent"
In the task description, include the exact tg-reader command to run
The agent receives the reminder and executes the command in its main session
Option B — sessionTarget: "isolated" (autonomous, complex setup)
The cron task runs in a Docker container — fully autonomous, no agent interaction needed. However, the container starts empty: no skill, no credentials, no session file.
Pros: Fully autonomous — runs on schedule without agent involvement.
Cons: Requires Docker setup; session file must be mounted into the container (may not work reliably — session files are tied to the machine and Telegram may invalidate them in a new environment).
Required configuration in ~/.openclaw/openclaw.json:
Session file caveat: The Telegram session file (~/.tg-reader-session.session) must also be available inside the container. This may require Docker volume mounting and might not work reliably — Telegram can invalidate sessions when they appear from a different environment. If you encounter AUTH_KEY_UNREGISTERED errors in isolated mode, switch to Option A.
Explicit paths (both options)
When ~/ is not available or points to a different location, use explicit paths: