Telegram capture
Send text and media to a personal Telegram bot; Trove stores a
trove://type/classify/pending/1 event and guides you to classify it in the same
chat. See planning/telegram-source for the full
design.
Prerequisites
- Build Trove and configure
[modules].paths— see Quick Start. [blobs]configured introve.toml(media is stored viacore.Put).- A Telegram bot token from @BotFather.
1. Create a bot
- Open Telegram and message @BotFather.
- Send
/newbotand follow the prompts. - Copy the HTTP API token.
2. Find your chat ID
Message @userinfobot or send any message to your bot
and inspect a one-off getUpdates response. Your user ID is the chat.id for
direct messages.
3. Configure the module
You can configure in the module manifest or override from trove.toml (see
Configuration).
Module manifest — edit modules/telegram-source/manifest.toml:
bot_token_env = "TELEGRAM_BOT_TOKEN"
allowed_chat_ids = [123456789] # your Telegram user/chat ID
[[bot.types]]
label = "Quick note"
target_type = "trove://type/note/quick/1"
[[bot.types]]
label = "Bookmark"
target_type = "trove://type/note/bookmark/1"
Set the token in your environment (recommended):
export TELEGRAM_BOT_TOKEN="123456:ABC…"
Or set bot_token directly in the manifest (do not commit secrets).
trove.toml overlay (optional) — keep secrets and chat IDs out of the repo:
[modules.settings.telegram-source]
allowed_chat_ids = [123456789]
bot_token_env = "TELEGRAM_BOT_TOKEN"
[modules.config]
telegram-source = "/etc/trove/telegram.toml"
4. Build and start
make build
Ensure modules/ is in [modules].paths in trove.toml, then start Trove:
./bin/trove
5. Test the flow
- Open a DM with your bot.
- Send a photo or text message.
- The bot replies with
Captured 01J…and type buttons. - Tap Quick note (or another configured type).
- Answer any field prompts, or
/skipoptional fields. - Confirm with
Logged as trove://type/note/quick/1 (01J…).
Query records via MCP search_records or the capture-classifier
GET /pending endpoint.
Power-user commands
| Command | Use |
|---|---|
/note hello |
Log a quick note without the picker |
/bookmark |
Start a bookmark with field prompts |
/classify 01J… trove://type/note/quick/1 |
Classify a pending event by ID |
/cancel |
Abandon the in-chat session (pending event stays in journal) |
Security
- Only chats in
allowed_chat_idsare processed; others are ignored silently. - Keep your bot username private and prefer
bot_token_envover inline tokens. - Telegram Bot API has no inbound auth — the allowlist is the security boundary.
Troubleshooting
| Symptom | Check |
|---|---|
| Module fails at startup | TELEGRAM_BOT_TOKEN set; allowed_chat_ids non-empty; at least one [[bot.types]] |
| Bot does not respond | Chat ID in allowlist; Trove running; module healthcheck OK |
| "Finish classifying …" | Complete classification or /cancel before sending new content |
| Large file rejected | max_file_bytes (default 50 MiB) |