paperless-telegram-bot
Manage Paperless-NGX documents entirely through Telegram.
A full-featured Telegram bot that integrates with Paperless-NGX, giving you complete document management from your phone or desktop -- no web UI required. Upload documents and photos, search your archive with full-text search, manage metadata, review your inbox, and download files, all within Telegram.
/search. Results are paginated with inline keyboard navigation./inbox lists all documents tagged with your inbox tag. Mark them as reviewed with a single tap./recent shows the latest documents added to your archive./stats displays document counts, tag usage, and storage information./health HTTP endpoint for Docker health checks and monitoring.docker run -d \
--name paperless-telegram-bot \
--restart unless-stopped \
-e TELEGRAM_BOT_TOKEN=your_bot_token \
-e PAPERLESS_URL=http://your-paperless:8000 \
-e PAPERLESS_TOKEN=your_api_token \
-e TELEGRAM_ALLOWED_USERS=123456789 \
drumsergio/paperless-telegram-bot:latest
services:
paperless-telegram-bot:
image: drumsergio/paperless-telegram-bot:latest
container_name: paperless-telegram-bot
restart: unless-stopped
environment:
TELEGRAM_BOT_TOKEN: "${TELEGRAM_BOT_TOKEN}"
PAPERLESS_URL: "http://paperless:8000"
PAPERLESS_TOKEN: "${PAPERLESS_TOKEN}"
TELEGRAM_ALLOWED_USERS: "${TELEGRAM_ALLOWED_USERS}"
healthcheck:
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8080/health')"]
interval: 30s
timeout: 5s
retries: 3
git clone https://github.com/GeiserX/paperless-telegram-bot.git
cd paperless-telegram-bot
python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
cp .env.example .env # Edit with your values
python -m paperless_bot run
All configuration is done through environment variables. Copy .env.example to .env for local development.
| Variable | Required | Default | Description |
|---|---|---|---|
TELEGRAM_BOT_TOKEN | Yes | -- | Telegram Bot API token from @BotFather |
PAPERLESS_URL | Yes | -- | Paperless-NGX instance URL (e.g. http://localhost:8000) |
PAPERLESS_TOKEN | Yes | -- | Paperless-NGX API authentication token |
TELEGRAM_ALLOWED_USERS | No | (open) | Comma-separated Telegram user IDs allowed to use the bot |
PAPERLESS_PUBLIC_URL | No | PAPERLESS_URL | User-facing URL for clickable document links |
MAX_SEARCH_RESULTS | No | 10 | Number of results per page in search, recent, and inbox |
REMOVE_INBOX_ON_DONE | No | true | Remove inbox tag when clicking "Done" in metadata flow |
INBOX_TAG | No | (auto-detect) | Explicit inbox tag name. If unset, auto-detects via Paperless API |
LOG_LEVEL | No | INFO | Logging level (DEBUG, INFO, WARNING, ERROR) |
HEALTH_PORT | No | 8080 | Port for the /health HTTP endpoint |
| Command | Description |
|---|---|
/search <query> | Full-text search across all documents |
/recent | Show recently added documents |
/inbox | List documents in the inbox with review actions |
/stats | Display Paperless-NGX statistics |
/help | Show available commands and usage |
In addition to commands, you can send any file or photo directly to the bot to upload it to Paperless-NGX. After upload, an interactive keyboard lets you assign tags, a correspondent, and a document type.
paperless-telegram-bot
|-- src/paperless_bot/
| |-- __main__.py # Entry point, health server, CLI
| |-- config.py # Environment variable loading and validation
| |-- api/
| | +-- client.py # Async Paperless-NGX API client with caching
| +-- bot/
| |-- handlers.py # Command handlers, callback routing, upload flow
| +-- keyboards.py # Inline keyboard builders for metadata selection
+-- tests/ # pytest + respx test suite
Key design decisions:
python-telegram-bot with httpx for fully asynchronous I/O.callback_data to 64 bytes. All prefixes are kept short (meta:tags:, dl:, sp:, etc.) and long search queries are stored server-side per chat.is_inbox_tag field from the Paperless API rather than matching by name, so it works with any language or custom tag name.TELEGRAM_ALLOWED_USERS to restrict access. When empty, the bot accepts messages from anyone (not recommended for production).paperlessbot user (UID 1000)..env files.# Install dev dependencies
pip install -e ".[dev]"
# Run linter and formatter
ruff check src/ && ruff format src/
# Run tests
python -m pytest tests/ -v
# Run tests with coverage
python -m pytest tests/ --cov=paperless_bot --cov-report=term-missing
Contributions are welcome. Please:
feat/my-feature or fix/my-bug)ruff)This project follows Conventional Commits and Semantic Versioning.
| Project | Description |
|---|---|
| Telegram-Archive | Automated, incremental Telegram backups with a local web viewer |
| telegram-delay-channel-cloner | Telegram bot that relays messages between channels with configurable delay |
| telegram-slskd-local-bot | Automated music discovery and download via Telegram bot with Soulseek |
| AskePub | Telegram bot for ePub annotation with GPT-4 |
| jellyfin-telegram-channel-sync | Sync Jellyfin access with Telegram channel membership |
| telegram-archive-mcp | MCP Server for Telegram-Archive |
| n8n-nodes-telegram-archive | n8n community node for Telegram-Archive |
This project is licensed under the GNU General Public License v3.0.
Content type
Image
Digest
sha256:20a6183ad…
Size
51.6 MB
Last updated
23 days ago
Requires Docker Desktop 4.37.1 or later.