ClawKit Logo
ClawKitReliability Toolkit
Back to Registry
Official Verified communication Safety 3/5

telegram-history

Fetch 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 the bot API can't access. Supports fetching by chat ID, forum topic/thread, message count, pagination, and JSON output. Requires one-time user login with phone number + 2FA.

Why use this skill?

Use the telegram-history skill to fetch chat messages, forum topics, and group history with OpenClaw. Overcomes Bot API limitations.

skill-install — Terminal

Install via CLI (Recommended)

clawhub install openclaw/skills/skills/rhlsthrm/telegram-history
Or

What This Skill Does

The telegram-history skill provides a robust interface for OpenClaw to interact with the Telegram network using the MTProto protocol. Unlike the standard Telegram Bot API, which is restricted from reading full historical chat content or private messages, this skill leverages the Telethon library to act as a user client. This allows the AI to perform deep-dives into message history across personal chats, group channels, and complex forum threads. The skill handles authentication, session persistence, and data extraction, returning results in a structured format that can be easily parsed for further AI processing.

Installation

Installation begins by cloning the repository and ensuring Python dependencies are met. You must install the Telethon library via pip. Navigate to the Telegram developer portal at my.telegram.org to generate your API ID and hash, which must be saved as a JSON configuration file within the skill directory. The initial setup requires a one-time authentication process: use the provided login.py script to request an SMS verification code, then supply that code along with your phone_code_hash to generate a persistent session file. If 2FA is enabled, you simply append your password to the final verification step. Once the session/ file is created, the skill will automatically authorize future requests without requiring re-login.

Use Cases

This skill is indispensable for users needing to perform large-scale data retrieval from Telegram. It is ideal for archiving group discussions, extracting information from long-standing forum topics, or migrating content from legacy chats to local storage. By enabling the AI to read history, users can ask for summaries of long threads, sentiment analysis of past conversations, or automated retrieval of specific historical shared links and documents that standard bots would otherwise miss.

Example Prompts

  1. "OpenClaw, fetch the last 50 messages from the project management group with ID -1001234567890 and summarize the key action items mentioned."
  2. "Search the forum topic 456 in my development chat and extract all links shared in the last 20 messages."
  3. "Retrieve the history for my conversation with @username and save the last 100 messages into a JSON file for my archive."

Tips & Limitations

Note that Telegram strictly enforces rate limits; do not attempt to scrape thousands of messages in a single second. Always ensure your group IDs include the mandatory '-100' prefix for supergroups. The tool performs best when used for specific range lookups via pagination rather than bulk dumping. For security, never share the session files with unauthorized users, as they contain the keys to your personal account access. Always run verification in a terminal, never inside a public Telegram chat, as Telegram will block credentials if it detects automated login attempts via their own network.

Metadata

Author@rhlsthrm
Stars1171
Views1
Updated2026-02-19
View Author Profile
AI Skill Finder

Not sure this is the right skill?

Describe what you want to build — we'll match you to the best skill from 16,000+ options.

Find the right skill
Add to Configuration

Paste this into your clawhub.json to enable this plugin.

{
  "plugins": {
    "official-rhlsthrm-telegram-history": {
      "enabled": true,
      "auto_update": true
    }
  }
}

Tags(AI)

#telegram#mtproto#chat-history#telethon#automation
Safety Score: 3/5

Flags: network-access, file-write, file-read, external-api