Skip to main content

telegram-to-markdown

Convert Telegram chats into human-readable and LLM-friendly Markdown, keeping it simple and informative.

Example output:

# Cat Chat

## 2026-04-18

### Luna · 09:12

mrrp~

### Milo · 09:13

coming meow

### Luna · 09:15
- Reply to: "coming meow"

Please bring the box.

### Coco · 09:18
- Forwarded from: Cat Notes
- Attached file: nap-plan.pdf
- Reactions: 👍 2, 😸 1

I shared the plan. Please check **bedroom naps**, _feeding time_, ~~old toy list~~, and [today's tasks](https://example.com/tasks).

### Nala · 09:21
- Attached photo

will be sleeping here

### Luna · 09:24
- Service: changed the chat title to "Sleepy Cat Chat"

Setup

As dependency

telegram-to-markdown is a Telethon package. Install with pip/uv/etc:

pip install telegram-to-markdown

Compatible with Folds bot framework (pass the bot as the client).

For one-off use

TGPy recommended for running scripts in Telegram :)

  1. Start TGPy

  2. Install telegram-to-markdown to the TGPy environment

  3. Run the snippet
    from telegram_to_markdown import export
    
    await export(client, msg.chat, 'export.md', limit=100)
    await msg.respond(file='export.md')
    return 'Chat exported!'
    

Usage

from telegram_to_markdown import export

await export(client, chat, output_path, limit=1000)
  • client: Telethon TelegramClient
  • chat: username/link of any chat or ID/title of a known chat. "me" for saved messages
  • output_path: optional output path or writable text stream
  • limit: number of recent messages

Metadata

Release files for telegram-to-markdown 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for telegram-to-markdown 0.1.0
File Size Uploaded
telegram_to_markdown-0.1.0.tar.gz 13.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for telegram-to-markdown 0.1.0
File Interpreter ABI Platform
telegram_to_markdown-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 26.1 kB

Release files / telegram_to_markdown-0.1.0.tar.gz

Download URL telegram_to_markdown-0.1.0.tar.gz
Size 13.0 kB
Tags Source
SHA-256 checksum
How to use checksums
0acf083d64d11c2c5d2031262c3aadf315e3531a383042dd0a0274b295da347a
BLAKE2b-256 checksum
How to use checksums
54ca6a2ce30b12497ca8010e117c252cba676da4580fc28384d2663e07aa1d92
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / telegram_to_markdown-0.1.0-py3-none-any.whl

Download URL telegram_to_markdown-0.1.0-py3-none-any.whl
Size 13.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
63547252cfaac37e51677ae063b49ea1930103e0784b4240e18bc8ec3ff25826
BLAKE2b-256 checksum
How to use checksums
1c083338f8eade4ea605ac340eea8a4861b17e52409677957de7eae2180638d7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page