🧠 Second Brain on Telegram: save and search your links (Google Sheets + Supabase RAG)

:brain: 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

  1. 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).
  2. Run the SQL from the Supabase note in your project’s SQL editor.
  3. Click ‘Run Setup Once’ → Execute: it creates the spreadsheet; the last node (‘Spreadsheet Id’) outputs its ID.
  4. Paste that ID into Document → By ID on 4 nodes: Find This Link · Read All Cards · Save to Library · search_library.
  5. In the save_link tool, change the URL to your instance: https://YOUR-DOMAIN/webhook/second-brain-save-link
  6. Publish and send your bot a link :tada:

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!

3 Likes

The Templates team is unbelievably lazy, I honestly don’t understand what the problem is.

I’ve submitted this workflow twice, and I’m confident there’s nothing wrong with it. Instead of explaining what the issue is, they just sent back the exact same workflow without any communication or feedback. I honestly have no idea what they expect me to change.

The template library is already full of low-quality templates, yet they seem determined to reject every minor issue they can find.

You’re just discouraging people from contributing.

And that’s before even mentioning the unnecessary bureaucracy and the AI-generated template descriptions that you have to fight with. The whole submission process has become a nightmare, gg :slight_smile:

1 Like

Hi @mohamed3nan

Maybe this last message is better suited as a feedback topic. Also I would probably change the tone a bit. As an active member of the community you know that the team is always busy with a load of stuff, so would be good to give them the benefit of the doubt with regards their intent. :slight_smile:

Nice submission though, we are working on one as well. :slight_smile:

2 Likes