# Provide academic OCR and RAG answers on Telegram with Gemini: n8n workflow

> Started by an incoming Telegram message, and works across Google Drive, Google Sheets, Supabase, Supabase vectors and one other.

Source: https://millionrounds.com/workflow/provide-academic-ocr-and-rag-answers-on-telegram-with-gemini (Millionrounds; every figure on the page links to its filing or article)

[Automation library](https://millionrounds.com/workflows) · [Documents and files](https://millionrounds.com/workflows?category=Documents+and+files#library)

# Provide academic OCR and RAG answers on Telegram with Gemini

Started by an incoming Telegram message, and works across Google Drive, Google Sheets, Supabase, Supabase vectors and one other. It puts OpenAI behind a retrieval step, so answers are drawn from documents you supply rather than from the model alone. 28 steps, 2 branches: large, and worth reading before you trust it with anything live.

Large Calls a model: OpenAI Retrieval

[Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Fprovide-academic-ocr-and-rag-answers-on-telegram-with-gemini)

**28 steps** Large: read it before trusting it with anything live

**2** Branches: places the flow splits

**0** Loops or waits

**5** Services it connects to

## The flow

Starts it 3 Model 10 Logic 2 Service 13

The steps in the order they run, from what starts it.

- 1 **Telegram Trigger** Telegram trigger *Starts it*
- 2 **OpenAI Chat Model** Lm Chat Open Ai *Model*
- 3 **Get row(s) in sheet in Google Sheets** Google Sheets Tool *Service*
- 4 **Google Drive Trigger** Google Drive trigger *Starts it*
- 5 **Embeddings OpenAI** Embeddings Open Ai *Model*
- 6 **Default Data Loader** Document Default Data Loader *Model*
- 7 **OpenAI Chat Model1** Lm Chat Open Ai *Model*
- 8 **When Executed by Another Workflow** Execute Workflow trigger *Starts it*
- 9 **Postgres Chat Memory1** Memory Postgres Chat *Model*
- 10 **Embeddings HuggingFace Inference1** Embeddings Hugging Face Inference *Model*
- 11 **Switch** Switch *Logic*
- 12 **AI Agent2** Agent *Model*
- 13 **Download file** Google Drive *Service*
- 14 **Supabase Vector Store1** Vector Store Supabase *Model*
- 15 **AI Agent** Agent *Model*
- 16 **Get many rows** Supabase *Service*
- 17 **Supabase Vector Store** Vector Store Supabase *Model*
- 18 **from File** Extract From File *Service*
- 19 **Telegram5** Telegram *Service*
- 20 **Get row(s) in sheet** Google Sheets *Service*
- 21 **Telegram4** Telegram *Service*
- 22 **Send a text message** Telegram *Service*
- 23 **Append or update row in sheet** Google Sheets *Service*
- 24 **Analisa gambar** Http Request *Service*
- 25 **If** If *Logic*
- 26 **Respon error** Telegram *Service*
- 27 **Google Sheets** Google Sheets *Service*
- 28 **Telegram1** Telegram *Service*

## How it's built

- **Starts on:** An incoming Telegram message
- **Steps:** 28, with 2 branches
- **Size:** Large: read it before trusting it with anything live
- **Connects to:** Google Drive, Google Sheets, Supabase, Supabase vectors, Telegram
- **Model:** OpenAI
- **Retrieval:** Answers are drawn from documents you supply, not from the model alone

## Questions

What does it need to run?

An n8n account, plus your own Google Drive, Google Sheets, Supabase, Supabase vectors and Telegram accounts, and a key for OpenAI. You connect your own accounts after importing it; none are included.

What starts it?

It starts on an incoming Telegram message.

Does it use AI?

Yes. It calls OpenAI. Its answers draw on documents you give it, not on the model alone. Model calls are billed by the provider, not by n8n.

How long does it take to set up?

Take your time. At 28 steps it is large: read it before trusting it with anything live.

How do I import it?

Copy the workflow, open a new workflow in n8n and paste. The steps appear on the canvas, ready for your own accounts.

**Before you run it**

Nothing here has been tested by us. It is somebody's working automation, read and described from its own steps. Treat the connections it wants as a list of accounts it will touch, and read the 28 steps before you point it at anything that matters.

## Run it in n8n

- **Create your n8n account** Free to start. n8n is where the workflow runs. [Create an n8n account ↗](https://millionrounds.com/n8n)
- **Download the workflow** Free with a Millionrounds account. [Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Fprovide-academic-ocr-and-rag-answers-on-telegram-with-gemini)
- **Paste it into n8n** Open a new workflow in n8n and paste. Then connect your own accounts.

Stored with the author's traces removed: canvas notes, instance identifiers, saved credential names and any live document they had left behind.

## Connects to

Each opens the other workflows that use it.

[Google Drive](https://millionrounds.com/workflows?service=Google+Drive#library)[Google Sheets](https://millionrounds.com/workflows?service=Google+Sheets#library)[Supabase](https://millionrounds.com/workflows?service=Supabase#library)[Supabase vectors](https://millionrounds.com/workflows?service=Supabase+vectors#library)[Telegram](https://millionrounds.com/workflows?service=Telegram#library)

## Workflows like it

Also documents and files, with the same services where possible, closest in size first.

- [**Generate business requirement documents with Google Workspace** 28 steps · calls a model · Google Drive, Google Sheets](https://millionrounds.com/workflow/generate-business-requirement-documents-with-google-workspac)
- [**Automated workflow backup to Google Drive with Google Sheets** 28 steps · Google Drive, Google Sheets](https://millionrounds.com/workflow/automated-workflow-backup-to-google-drive-with-google-sheets)
- [**Automated workflow backup with GitHub** 28 steps · GitHub, Telegram](https://millionrounds.com/workflow/automated-workflow-backup-with-github)
- [**AI-Powered RAG Document Processing & Chatbot with Google Drive** 27 steps · calls a model · Google Drive, Supabase vectors](https://millionrounds.com/workflow/ai-powered-rag-document-processing-and-chatbot-with-google-d)
- [**Build a PDF Document RAG System with Mistral and Qdrant** 29 steps · calls a model · Google Drive, Qdrant](https://millionrounds.com/workflow/build-a-pdf-document-rag-system-with-mistral-and-qdrant)
- [**Automate commercial insurance submissions with Google Suite** 29 steps · Email, Google Docs](https://millionrounds.com/workflow/automate-commercial-insurance-submissions-with-google-suite)
