telegram-historyFetch Telegram chat message history via MTProto user API (Telethon). Use when needing to read old messages from any Telegram chat, group, or forum topic that...
Install via ClawdBot CLI:
clawdbot install rhlsthrm/telegram-historyFetch message history from any Telegram chat using MTProto (Telethon). The Bot API cannot read chat history — this skill uses the user API instead.
pip3 install telethon
Go to https://my.telegram.org/apps and create an app. Save credentials in the skill directory:
cat > <skill-dir>/api_credentials.json << 'EOF'
{"api_id": YOUR_API_ID, "api_hash": "YOUR_API_HASH"}
EOF
All paths below are relative to the skill directory.
# Step 1: Request a login code (sent to your Telegram app)
python3 scripts/login.py send +1234567890
# Output: Code sent! phone_code_hash: abc123
# Output: Run: python3 login.py verify +1234567890 <code> abc123
# Step 2: Verify with the code you received
# IMPORTANT: Do NOT send the code via Telegram — Telegram detects shared codes and blocks login.
# Use a file, another messenger, or run the command directly in terminal.
python3 scripts/login.py verify +1234567890 <CODE> <PHONE_CODE_HASH>
# If 2FA is enabled, append your password:
python3 scripts/login.py verify +1234567890 <CODE> <PHONE_CODE_HASH> <2FA_PASSWORD>
# Check login status:
python3 scripts/login.py check +1234567890
Session persists in session/ — no need to re-login after initial setup.
# Fetch last 50 messages from a chat
python3 scripts/tg_history.py history <chat_id> --limit 50
# Fetch from a forum topic
python3 scripts/tg_history.py history <chat_id> --topic <topic_id> --limit 30
# JSON output
python3 scripts/tg_history.py history <chat_id> --json
# Paginate (messages before a specific ID)
python3 scripts/tg_history.py history <chat_id> --offset-id <msg_id> --limit 50
-100 prefix (e.g., -1001234567890)Generated Mar 1, 2026
Companies can fetch historical Telegram support chat messages to analyze customer inquiries, response times, and issue resolution patterns. This helps identify common problems and improve service quality by reviewing past interactions that are not accessible via the Bot API.
Moderators of large Telegram groups or forums can use this skill to retrieve old messages for auditing purposes, such as detecting policy violations, tracking user behavior over time, or archiving important discussions for compliance and community management.
Researchers can collect historical messages from public Telegram channels or groups to analyze trends, public sentiment, and discussions around specific topics. This data supports market analysis, competitor monitoring, and understanding audience engagement in niche communities.
Educators or online course providers can fetch past messages from Telegram-based learning groups to compile study materials, review Q&A sessions, or create archives of educational discussions for future reference and content curation.
Security teams or legal professionals can use this skill to retrieve chat history from Telegram for forensic analysis, such as investigating security breaches, tracking communication in cases of fraud, or gathering evidence from private groups that require user-level access.
Offer a subscription-based service where businesses can integrate this skill into a dashboard to analyze Telegram chat histories, providing insights like sentiment trends, user engagement metrics, and automated reporting. Revenue is generated through monthly or annual licensing fees.
Provide consulting services to help companies set up and customize this skill for specific use cases, such as compliance monitoring or customer support automation. Revenue comes from project-based fees, ongoing maintenance contracts, and training sessions.
Sell processed and anonymized datasets derived from Telegram chat histories to market research firms, academic institutions, or media companies. Revenue is generated through one-time sales or recurring data delivery contracts, focusing on niche industries or topics.
💬 Integration Tip
Ensure secure storage of session files and API credentials, and automate login checks to handle session expiration in production environments.
iMessage/SMS CLI for listing chats, history, watch, and sending.
Use when you need to control Discord from Clawdbot via the discord tool: send messages, react, post or upload stickers, upload emojis, run polls, manage threads/pins/search, fetch permissions or member/role/channel info, or handle moderation actions in Discord DMs or channels.
Use when you need to control Slack from Clawdbot via the slack tool, including reacting to messages or pinning/unpinning items in Slack channels or DMs.
Send WhatsApp messages to other people or search/sync WhatsApp history via the wacli CLI (not for normal user chats).
Build or update the BlueBubbles external channel plugin for Clawdbot (extension package, REST send/probe, webhook inbound).
OpenClaw skill for designing Telegram Bot API workflows and command-driven conversations using direct HTTPS requests (no SDKs).