Telegram News Skill (Read-Only)
Reads Telegram channels and groups for financial news and market research using
tdl, a Telegram CLI tool.
This skill is read-only. It is designed for financial research: reading channel messages, monitoring financial news channels, and exporting message history. It does NOT support sending messages, joining/leaving channels, or any write operations.
Step 1: Ensure tdl Is Installed
Before running any command, check if tdl is installed:
bash
command -v tdl && tdl version || echo "TDL_NOT_INSTALLED"
If
, install tdl based on the user's platform:
| Platform | Install Command |
|---|
| macOS / Linux | curl -sSL https://docs.iyear.me/tdl/install.sh | sudo bash
|
| macOS (Homebrew) | brew install telegram-downloader
|
| Linux (Termux) | |
| Linux (AUR) | |
| Linux (Nix) | |
| Go (any platform) | go install github.com/iyear/tdl@latest
|
Ask the user which installation method they prefer. Default to Homebrew on macOS, curl script on Linux.
Step 2: Ensure tdl Is Authenticated
Check if the user is logged in:
bash
tdl chat ls --limit 1 2>&1 && echo "AUTH_OK" || echo "AUTH_NEEDED"
If
, guide the user through login.
Login requires interactive input — the user must enter their phone number and verification code manually.
Login methods
Method A: QR Code (recommended — fastest)
A QR code will be displayed in the terminal. The user scans it with their Telegram mobile app (Settings > Devices > Link Desktop Device).
Method B: Phone + Code
The user enters their phone number, then the verification code sent to their Telegram app.
Method C: Import from Telegram Desktop
If the user has Telegram Desktop installed and logged in:
This imports the session from the existing desktop client. The desktop client must be from the
official website, NOT from the App Store or Microsoft Store.
Namespaces
By default, tdl uses a
namespace. To manage multiple accounts:
bash
tdl login -n work -T qr # Login to "work" namespace
tdl chat ls -n work # Use "work" namespace for commands
Important login notes
- Login is a one-time operation. The session persists on disk after successful login.
- If login fails, ask the user to check their internet connection and try again.
- Never ask for or handle Telegram passwords/2FA codes programmatically — always let the user enter them interactively.
Step 3: Identify What the User Needs
Match the user's request to one of the read operations below.
| User Request | Command | Key Flags |
|---|
| List all chats/channels | | , |
| List only channels | tdl chat ls -f "Type contains 'channel'"
| |
| Export recent messages | tdl chat export -c CHAT -T last -i N
| , |
| Export messages by time range | tdl chat export -c CHAT -T time -i START,END
| , |
| Export messages by ID range | tdl chat export -c CHAT -T id -i FROM,TO
| , |
| Export from a topic/thread | tdl chat export -c CHAT --topic TOPIC_ID
| , |
| Search for a channel by name | tdl chat ls -f "VisibleName contains 'NAME'"
| |
Chat identifiers
The
flag accepts multiple formats:
| Format | Example |
|---|
| Username (with @) | |
| Username (without @) | |
| Numeric chat ID | |
| Public link | -c https://t.me/channel_name
|
| Phone number | |
| Saved Messages | (empty) |
Step 4: Execute the Command
Listing chats
bash
# List all chats
tdl chat ls
# JSON output for processing
tdl chat ls -o json
# Filter for channels only
tdl chat ls -f "Type contains 'channel'"
# Search by name
tdl chat ls -f "VisibleName contains 'Bloomberg'"
Exporting messages
Always use
to get text messages (not just media):
bash
# Last 20 messages from a channel
tdl chat export -c @channel_name -T last -i 20 --all --with-content -o /tmp/tdl-export.json
# Messages from a time range (Unix timestamps)
tdl chat export -c @channel_name -T time -i 1710288000,1710374400 --all --with-content -o /tmp/tdl-export.json
# Messages by ID range
tdl chat export -c @channel_name -T id -i 100,200 --all --with-content -o /tmp/tdl-export.json
Key rules
- Check auth first — run before other commands to verify the session is valid
- Always use when exporting messages for reading — without these flags, tdl only exports media messages
- Use to save exports to a file, then read the JSON — this is more reliable than parsing stdout
- Start with small exports — use unless the user asks for more
- Use filters on to help users find the right channel before exporting
- NEVER execute write operations — this skill is read-only; do not send messages, join channels, or modify anything
- Convert timestamps — when the user gives dates, convert to Unix timestamps for the filter
Working with exported JSON
After exporting, read the JSON file and extract the relevant information:
bash
# Export messages
tdl chat export -c @channel_name -T last -i 20 --all --with-content -o /tmp/tdl-export.json
# Read and process the export
cat /tmp/tdl-export.json
The export JSON contains message objects with fields like
,
,
(text content),
,
, and media metadata.
Step 5: Present the Results
After fetching data, present it clearly for financial research:
- Summarize key messages — highlight the most relevant news or market updates
- Include timestamps — show when each message was posted
- Group by topic — if multiple channels, organize by theme (macro, earnings, crypto, etc.)
- Flag actionable information — note breaking news, price targets, earnings surprises
- Provide channel context — mention which channel/group each message came from
- For channel lists, show channel name, member count, and type
Step 6: Diagnostics
If something isn't working:
| Error | Cause | Fix |
|---|
| or session errors | Not logged in or session expired | Run to re-authenticate |
| Rate limited by Telegram | Wait X seconds, then retry |
| No access to channel | User must join the channel in their Telegram app first |
| tdl not installed | Install using Step 1 |
Reference Files
- — Complete tdl command reference for reading channels and exporting messages
Read the reference file when you need exact command syntax or detailed flag documentation.