Skip to main content

A Telegram bot that interfaces with a self-hosted Readeck instance to manage bookmarks.

Project description

A Telegram bot that interfaces with a self-hosted Readeck instance to manage bookmarks. It's based on the python-telegram-bot framework.

Features:

  • /register (create a new user) or /token to register the bot with an existent user
  • Save bookmarks by sending a URL (with optional title and tags).
  • Read. Create a simplified version of the article in telegra.ph
  • /md_ return the raw markdown
  • /list . unread articles
  • /epub generate an epub with the unread articles
  • /version show the current bot version
  • /restart restart the bot process (for upgrades, requires systemd or similar process manager)

Setup a development environment

1. Clone the bot repository

git clone https://github.com/mgaitan/readeckbot.git
cd readeckbot

2. Download the Readeck binary

Download the appropriate binary for your system from the official site: https://readeck.org/en/download

Place the readeck binary in the same directory as the bot code.

3. Start the Readeck API server in a console

Open a terminal and run

./readeck serve

or readeck.exe serve on Windows

This will start the Readeck backend on http://127.0.0.1:8000 by default.

4. Set up your environment variables

Create a file named .env in the project root. This file stores config variables used by the bot.

TELEGRAM_BOT_TOKEN=<your_bot_token>
READECK_BASE_URL=http://127.0.0.1:8000
READECK_CONFIG=./config.yaml      # optional, can be left out
READECK_DATA=./data               # optional, use if you want to customize where data is stored

LLM_KEY=<your_llm_key>           # optional, use if you want to enable LLM features
LLM_MODEL=<model_name>           # optional, by default it's gemini-2.0-flash-lite
LLM_SUMMARY_MAX_LENGTH=<int>     # optional , use if you want to customize the max length of LLM summary

📄 What’s a .env file? It's a simple file format for storing key=value pairs, that are loaded as environment variables by apps.

[!IMPORTANT] Keep in mind that, initially, we will be working with two different 'tokens'.

On one hand, there's the one we set in the .env file for the Telegram bot; on the other, there's the authentication token specific to Readeck. If you’re having issues when trying to use /register, it’s likely that you're missing the latter.

An easy way to resolve this is by going to the URL where you're hosting Readeck, then navigating to Settings → API. There you can generate the authentication token and then use it in the Telegram chat with the command /token <your_readeck_token>.

5. Get your own Telegram bot token

To connect your bot to Telegram, you’ll need to create a bot and get its API token.

  • Open Telegram and message @BotFather
  • Run /newbot and follow the prompts.
  • Copy the token it gives you and paste it into your .env file under TELEGRAM_BOT_TOKEN

More info: https://core.telegram.org/bots#creating-a-new-bot

6. Run the bot in development mode

This project uses uv, a fast Python package manager and runner.

Don't have it yet? Install it from here: https://github.com/astral-sh/uv#installation

Then in another terminal run the bot:

uv run --extra llm readeckbot

The first time it will install Python and the depenencies as needed and can take a bit, but that’s it!

You can now start chatting with your bot on Telegram using your own token.

Special commands for bot management

  • /version — Replies with the current version of the bot (from the code).
  • /restart — Restarts the bot process. This is useful for upgrades: if you run the bot under systemd (or similar), it will be relaunched and pick up the latest version (for example, if you use uvx to always run the latest code).
    Note: You may want to restrict this command to admin users in production.

Happy hacking and happy reading! 📚🤖

Project details


Download files

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

Source Distribution

readeckbot-0.1.2.tar.gz (14.8 kB view details)

Uploaded Source

Built Distribution

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

readeckbot-0.1.2-py3-none-any.whl (16.3 kB view details)

Uploaded Python 3

File details

Details for the file readeckbot-0.1.2.tar.gz.

File metadata

  • Download URL: readeckbot-0.1.2.tar.gz
  • Upload date:
  • Size: 14.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for readeckbot-0.1.2.tar.gz
Algorithm Hash digest
SHA256 ca46225ba67e07a3a46b9a02d18677ee98e8ebcb4b2dc6dff004b0ab5e57fe44
MD5 57140cb9f85faa292de843e441b3c07c
BLAKE2b-256 52fb3ee08f0f5de6a3bf0ad73a76ccf824c73a1e1ec526200747a84faf0c8e16

See more details on using hashes here.

Provenance

The following attestation bundles were made for readeckbot-0.1.2.tar.gz:

Publisher: cd.yml on mgaitan/readeckbot

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file readeckbot-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: readeckbot-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 16.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for readeckbot-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8d47feb9fc12646a481174b4a8023c2cf742214d82d829dfc752f7b73e35e089
MD5 555e7a29a8004d5f531a21c814da8597
BLAKE2b-256 67a9e94d5b5d9184f11bae133856fb98e72779e0932e4964ed787999b32e42e0

See more details on using hashes here.

Provenance

The following attestation bundles were made for readeckbot-0.1.2-py3-none-any.whl:

Publisher: cd.yml on mgaitan/readeckbot

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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