# Chat with PDFs on Telegram using Google Gemini and Pinecone

> Quick overview This workflow lets users upload PDFs or ask questions in Telegram, indexes PDF content in Pinecone using Google Gemini embeddings, and answers follow-up questions with a Google Gemini chat model using retrieval-augmented generation formatted for Telegram HTML. How it works 1. Triggers when a new Telegram message is received by your bot. 2. Checks whether the message includes a document; if it does, it downloads the file from Telegram and forces the binary metadata to application/pdf. 3. Splits the PDF text into overlapping chunks, generates embeddings with Google Gemini, and inserts the vectors into a Pinecone index. 4. Sends a Telegram confirmation message indicating how many PDF pages were saved to Pinecone. 5. If the message is a text question, retrieves relevant context from the Pinecone index and uses the Google Gemini chat model to generate an answer constrained to that context. 6. Sends the generated answer back to Telegram using HTML parse mode formatting. Setup 

- **Domain**: `n8n-workflow-10077.n8n.io`
- **Provider**: n8n.io (https://n8n.io)
- **Kind**: workflow
- **Live-responds (last probe)**: None
- **Signed card**: False
- **Streaming**: False
- **Quality score**: 40%

## URLs
- Agent card: https://n8n.io/workflows/10077
- Page (HTML): https://agenstry.com/agents/n8n-workflow-10077.n8n.io
- Documentation: https://n8n.io/workflows/10077
