Sign inSign up

mesamirh/linkding-bot

By mesamirh

Updated about 1 month ago

Telegram bot that saves links to Linkding with AI-generated tags and notes.

Image
0

136

mesamirh/linkding-bot repository overview

Linkding Bot

A lightweight, zero-dependency Telegram bot that saves links to your Linkding instance with AI-generated tags and notes.

The bot automatically fetches website content as clean Markdown and uses your preferred LLM to intelligently tag and summarize your bookmarks.

Features

  • AI Auto-Tagging & Notes: Extracts context from the webpage and generates concise notes and up to 5 relevant tags.
  • Multi-URL Support: Send multiple links in a single message; the bot processes them concurrently.
  • Reply to Tag: Forgot a tag? Simply reply to the bot's success message with new tags (e.g., golang, tutorials) to append them to the bookmark.
  • Duplicate Prevention: Checks if a URL is already in your Linkding instance before saving.
  • Ultra-Lightweight: Written in Go with 0 external dependencies. Minimal Docker footprint.

Prerequisites

Before installing, make sure you have the following ready:

  1. Telegram Bot Token: Create a new bot and get the token from @BotFather on Telegram.
  2. Linkding Instance: Your Linkding URL and API Token (found in Settings > Integrations of your Linkding instance).
  3. LLM API Key: Any OpenAI-compatible API endpoint (e.g., OpenAI, a proxy, or a local LLM).

Installation & Setup

You can run the bot either using Docker (recommended) or locally from source.

The easiest and most reliable way to run the bot is using Docker Compose.

  1. Create a docker-compose.yml file:
services:
  bot:
    image: mesamirh/linkding-bot:latest
    container_name: linkding-bot
    restart: unless-stopped
    env_file:
      - .env
  1. Create a .env file next to it (see Configuration below for details):
TELEGRAM_TOKEN=your_telegram_bot_token
LINKDING_URL=https://linkding.yourdomain.com
LINKDING_TOKEN=your_linkding_api_token
LLM_API_KEY=your_llm_api_key
LLM_BASE_URL=https://api.openai.com/v1
LLM_MODEL=gpt-4o
TAG_LIMIT=5
ALLOWED_CHAT_IDS=123456789,987654321
  1. Start the container in the background:
docker-compose up -d
Option B: Running Locally (Without Docker)

If you prefer to run it manually or for development purposes:

  1. Clone the repository:
git clone https://github.com/mesamirh/linkding-bot.git
cd linkding-bot
  1. Set your environment variables (copy .env.example to .env and fill it out):
cp .env.example .env
# Edit .env with your favorite editor
  1. Source the environment variables and run the bot:
set -a; source .env; set +a; 
go run ./cmd/bot

Configuration

The bot uses the following environment variables. All are required unless specified otherwise.

VariableDescriptionDefault
TELEGRAM_TOKENYour Telegram bot token from BotFatherRequired
LINKDING_URLThe full URL to your Linkding instanceRequired
LINKDING_TOKENYour Linkding API tokenRequired
LLM_API_KEYAPI key for your chosen LLM providerRequired
LLM_BASE_URLBase URL for the OpenAI-compatible APIRequired
LLM_MODELThe specific model to use for tagging (e.g., gpt-4o)gpt-4o
TAG_LIMITMaximum number of tags the AI should generate5
ALLOWED_CHAT_IDSComma-separated list of Telegram Chat IDs allowed to use the botRequired

Usage

  1. Open Telegram and start a chat with your newly created bot by sending /start.
  2. Send the bot a message containing one or more URLs.
  3. The bot will automatically:
    • Fetch the webpage content.
    • Generate tags and summary notes using AI.
    • Save the bookmark directly to your Linkding instance.
  4. Custom Tags: If you want to add specific custom tags later, simply reply to the bot's success message with your new tags separated by commas or spaces.

Credits

  • Linkding - The fantastic self-hosted bookmark manager.
  • Jina AI - Their Reader API powers the clean text extraction for LLM processing.

Tag summary

Content type

Image

Digest

sha256:a1bfcf3dc

Size

8.2 MB

Last updated

about 1 month ago

docker pull mesamirh/linkding-bot