Second Brain - Link Library (Telegram Agent)
Workflow:
Send any link to your Telegram bot - the agent reads the page with Jina Reader (r.jina.ai), writes a concrete summary, picks a category (reusing existing ones), and files it into Google Sheets. Send the same link again and it updates the existing card - never a duplicate. Ask questions and it answers from your library, including semantic (RAG) search over the full text of every saved page via Supabase vectors.
Who’s it for
Anyone who saves links every day and can never find them again - and n8n builders who want a clean AI Agent + tools + RAG pattern to extend.
How it works
- A Telegram AI agent routes every message: URL → save, question → search, anything else → a short how-to reply. /clear resets the per-chat memory.
- save_link calls a deterministic webhook path: normalize the URL (the dedup key) → read the page via Jina Reader → an AI librarian writes title + concrete summary and reuses existing categories → upsert matched on URL. Your comment stays on the card (My Note). If a page cannot be read, nothing is filed - the bot tells you to retry instead of saving guesses.
- On every save, old vectors are deleted and the full page text is re-chunked and re-embedded into Supabase - a true replace, so RAG never serves stale versions.
- Two search tools: search_library (the Sheet - source of truth for lists, counts, categories) and search_content (semantic search over full page text).
Requirements
- Telegram bot token
- Google Sheets
- AI chat model + Google Gemini embeddings (or your own)
- Supabase project (free tier is fine)
- Jina Reader (r.jina.ai) - free, no API key needed (better with API)
How to set up
- Create the credentials above and select them on each node. Create ONE Header Auth credential and use it in TWO places: the ‘save link’ webhook and the save_link agent tool (same header name + value).
- Run the SQL from the Supabase note in your project’s SQL editor.
- Click ‘Run Setup Once’ → Execute: it creates the spreadsheet; the last node (‘Spreadsheet Id’) outputs its ID.
- Paste that ID into Document → By ID on 4 nodes: Find This Link · Read All Cards · Save to Library · search_library.
- In the save_link tool, change the URL to your instance: https://YOUR-DOMAIN/webhook/second-brain-save-link
- Publish and send your bot a link

How to customize
- Swap Google Sheets for Notion (or any wiki): storage is isolated inside the Save Link path - replace only those nodes; the agent and tools stay untouched.
- Add doorways: email, Slack or voice = another trigger feeding the same agent; each caller passes its own
source. - Tune the Librarian prompt (summary style, category rules), the model nodes (any OpenAI-compatible router), or RAG settings (chunk size, topK).
About this workflow
This is my entry to the #n8nAgentLightGiveaway challenge by Mario Haarmann @octionic
- sharing it here so anyone can import it and build their own version.
Feedback welcome!

