This skill should be used when fetching, searching, downloading, sending, or editing messages on Telegram. Use for queries like ”show my Telegram messages”, ”search Telegram for...”, ”get unread messages”, ”send a message to...”, ”edit that message”, or ”add Telegram messages to my notes”.
npx playbooks add skill glebis/claude-skills --skill telegram
Fetch, search, download, send, and publish Telegram messages with flexible filtering and output options.
Authentication must be configured in ~/.telegram_dl/. Run setup command to check status or get instructions:
python3 scripts/telegram_fetch.py setup
If not configured, follow these steps:
python telegram_dl.py and follow interactive promptspython3 scripts/telegram_fetch.py setupRun the script at scripts/telegram_fetch.py with appropriate commands:
# List available chats
python3 scripts/telegram_fetch.py list
# Get recent messages
python3 scripts/telegram_fetch.py recent --limit 20
# Search messages
python3 scripts/telegram_fetch.py search "meeting"
# Get unread messages
python3 scripts/telegram_fetch.py unread
To see available Telegram chats:
python3 scripts/telegram_fetch.py list
python3 scripts/telegram_fetch.py list --limit 50
python3 scripts/telegram_fetch.py list --search "AI"
python3 scripts/telegram_fetch.py list --search "claude code глеб + саши" --exact
Options:
--search "text": Filter by substring match (case-insensitive)--exact: Require exact name match instead of substring (use with --search)--limit N: Max chats to retrieve (default: 30, increase if chat not found)Important: If you're looking for a specific chat by exact name and it's not found, increase --limit to 100 or 200, as the chat may not be in the most recent 30.
Returns JSON with chat IDs, names, types, and unread counts.
To get recent messages:
# From all chats (last 50 messages across top 10 chats)
python3 scripts/telegram_fetch.py recent
# From specific chat
python3 scripts/telegram_fetch.py recent --chat "Tool Building Ape"
python3 scripts/telegram_fetch.py recent --chat-id 123456789
# With limits
python3 scripts/telegram_fetch.py recent --limit 100
python3 scripts/telegram_fetch.py recent --days 7
To search message content:
# Global search across all chats
python3 scripts/telegram_fetch.py search "project deadline"
# Search in specific chat
python3 scripts/telegram_fetch.py search "meeting" --chat-id 123456789
# Limit results
python3 scripts/telegram_fetch.py search "important" --limit 20
To get only unread messages:
python3 scripts/telegram_fetch.py unread
python3 scripts/telegram_fetch.py unread --chat-id 123456789
To send a message to a chat:
# Send to existing chat by name
python3 scripts/telegram_fetch.py send --chat "John Doe" --text "Hello!"
# Send to username (works even without prior conversation)
python3 scripts/telegram_fetch.py send --chat "@username" --text "Hello!"
# Reply to a specific message (use message ID from recent/search output)
python3 scripts/telegram_fetch.py send --chat "Tool Building Ape" --text "Thanks!" --reply-to 12345
# Send to a forum topic (for groups with topics enabled)
python3 scripts/telegram_fetch.py send --chat "Group Name" --text "Hello topic!" --topic 12
# Send with markdown formatting (converts **bold**, _italic_, [links](url) to Telegram HTML)
python3 scripts/telegram_fetch.py send --chat "@username" --text "**Bold** and _italic_ text" --markdown
Formatting (--markdown flag):
--markdown: text is sent as-is (plain text, no formatting)--markdown: converts markdown to Telegram HTML (bold -> bold, _italic_ -> italic, [text](url) -> link, ## Header -> bold, * item -> arrow list)--markdown when sending draft content that contains markdown formattingpublish command handles markdown conversion automatically; the send command does NOT unless --markdown is specifiedTo send images, documents, or videos:
# Send an image
python3 scripts/telegram_fetch.py send --chat "John Doe" --file "/path/to/image.jpg"
# Send document with caption
python3 scripts/telegram_fetch.py send --chat "@username" --file "report.pdf" --text "Here's the report"
# Reply with media
python3 scripts/telegram_fetch.py send --chat "Group" --file "screenshot.png" --reply-to 12345
Chat resolution order:
@username - Resolves Telegram username directlyReturns JSON with send status, resolved chat name, message ID, and file info (for media).
To edit an existing message:
# Edit a message by ID
python3 scripts/telegram_fetch.py edit --chat "@mentalhealthtech" --message-id 76 --text "Updated text"
# Edit in a group/channel
python3 scripts/telegram_fetch.py edit --chat "Mental health tech" --message-id 123 --text "Corrected content"
Note: You can only edit your own messages. Telegram formatting (bold, etc.) is preserved.
Returns JSON with edit status and message ID.
To download media files from a chat:
# Download last 5 attachments from a chat (default)
python3 scripts/telegram_fetch.py download --chat "Tool Building Ape"
# Download last 10 attachments
python3 scripts/telegram_fetch.py download --chat "Project Group" --limit 10
# Download to custom directory
python3 scripts/telegram_fetch.py download --chat "@username" --output "/path/to/folder"
# Download from specific message
python3 scripts/telegram_fetch.py download --chat "John Doe" --message-id 12345
Default output: ~/Downloads/telegram_attachments/
Returns JSON with download results (file names, paths, sizes).
To get messages from a specific forum thread (topics in groups):
# Fetch from thread 174 in Claude Code Lab
python3 scripts/telegram_fetch.py thread --chat-id -1003237581133 --thread-id 174
# Fetch with custom limit
python3 scripts/telegram_fetch.py thread --chat-id -1003237581133 --thread-id 174 --limit 50
# Save to file
python3 scripts/telegram_fetch.py thread --chat-id -1003237581133 --thread-id 174 -o ~/thread.md
# Append to daily note
python3 scripts/telegram_fetch.py thread --chat-id -1003237581133 --thread-id 174 --to-daily
# JSON output
python3 scripts/telegram_fetch.py thread --chat-id -1003237581133 --thread-id 174 --json
Messages are sorted newest first (reverse chronological order).
How to find thread ID:
https://t.me/c/CHAT_ID/THREAD_IDrecent command on the chat to see message IDs in threadsReturns markdown or JSON with all messages from the specified thread.
To publish a draft from the klodkot channel to Telegram:
# Dry run (preview without sending)
python3 scripts/telegram_fetch.py publish --draft "Channels/klodkot/drafts/20260122-anthropic-consciousness-question.md" --dry-run
# Publish to channel
python3 scripts/telegram_fetch.py publish --draft "Channels/klodkot/drafts/20260122-anthropic-consciousness-question.md"
Workflow:
video: field and wikilinksChannels/klodkot/attachments/ or Sources/published_date, telegram_message_iddrafts/ to published/Media handling:
video: filename.mp4[[filename.mp4]], [[image.png|alt text]]Safety:
--dry-run shows preview without sendingReturns: JSON with publish status, message ID, warnings (if any)
By default, outputs formatted markdown suitable for Claude to read and summarize.
Add --json flag for structured data:
python3 scripts/telegram_fetch.py recent --json
Add messages to today's daily note in the vault:
python3 scripts/telegram_fetch.py recent --to-daily
python3 scripts/telegram_fetch.py search "project" --to-daily
Appends to ~/Brains/brain/Daily/YYYYMMDD.md
Add messages to a specific person's note:
python3 scripts/telegram_fetch.py recent --chat "John Doe" --to-person "John Doe"
Creates or appends to ~/Brains/brain/{PersonName}.md
Save messages directly to file without consuming context tokens:
# Save 100 messages to markdown file
python3 scripts/telegram_fetch.py recent --chat "AGENCY: Community" --limit 100 -o ~/chat_archive.md
# Save with media files downloaded to same folder
python3 scripts/telegram_fetch.py recent --chat "Project Group" --limit 50 -o ~/project/archive.md --with-media
# Save search results to file
python3 scripts/telegram_fetch.py search "meeting" -o ~/meetings.md
Returns JSON with save status (file path, message count, media download results) - minimal token usage.
When user asks:
recent --limit 20recent --days 1search "project"unread + filter outputrecent --to-dailylistlist --search "X" --exact --limit 200send --chat "John" --text "Hello!"send --chat "@username" --text "..."send --chat "..." --text "Thanks!" --reply-to <id>send --chat "John" --file "/path/to/image.jpg"send --chat "..." --file "report.pdf" --text "Here's the report"send --chat "Group" --text "..." --topic 12download --chat "Tool Building Ape"download --chat "Project Group" --limit 10recent --chat "AGENCY: Community" --limit 100 -o ~/agency.mdrecent --chat "Group" -o ~/archive.md --with-mediaedit --chat "..." --message-id <id> --text "new text"edit --chat "..." --message-id 123 --text "corrected text"setupsetup (returns instructions if not configured)publish --draft "Channels/klodkot/drafts/...md"publish --draft "..." --dry-runThe script includes built-in rate limiting (0.1s between messages) and handles Telegram's FloodWaitError automatically with backoff.
Requires Python packages:
telethon - Telegram API clientpyyaml - YAML parsing for draft frontmatterInstall with: pip install telethon pyyaml
Weekly roundup of top Claude Code skills, MCP servers, and AI coding tips.