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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

telegram_to_markdown-0.1.0.tar.gz (13.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

telegram_to_markdown-0.1.0-py3-none-any.whl (13.1 kB view details)

Uploaded Python 3

File details

Details for the file telegram_to_markdown-0.1.0.tar.gz.

File metadata

  • Download URL: telegram_to_markdown-0.1.0.tar.gz
  • Upload date:
  • Size: 13.0 kB
  • Tags: Source
  • Uploaded using 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}

File hashes

Hashes for telegram_to_markdown-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0acf083d64d11c2c5d2031262c3aadf315e3531a383042dd0a0274b295da347a
MD5 7cca7c42e68022bfcef30dcac73c0fcb
BLAKE2b-256 54ca6a2ce30b12497ca8010e117c252cba676da4580fc28384d2663e07aa1d92

See more details on using hashes here.

File details

Details for the file telegram_to_markdown-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: telegram_to_markdown-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 13.1 kB
  • Tags: Python 3
  • Uploaded using 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}

File hashes

Hashes for telegram_to_markdown-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 63547252cfaac37e51677ae063b49ea1930103e0784b4240e18bc8ec3ff25826
MD5 c1bf191ffaedc379fa03932cbf91c0a0
BLAKE2b-256 1c083338f8eade4ea605ac340eea8a4861b17e52409677957de7eae2180638d7

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page