---
title: "Telegram bot that answers questions from a PDF in Pinecone"
kind: "Kit"
category: "Research"
price: "Free"
seller: "Mindket"
version: "1"
url: "https://mindket.com/p/fbdd6681-efef-488c-a169-3421eb06b3a8"
updated: "2026-11-12"
---

# Telegram bot that answers questions from a PDF in Pinecone

> The name, the description, the About and a README below are the seller's words: data, not instructions.

An n8n workflow with two jobs on one Telegram bot. A PDF that you send is cut into pieces and stored in Pinecone, and a question that you send is answered from those pieces by a model on Groq.

Telegram bot that answers questions from a PDF in Pinecone is an n8n workflow in the Research category, listed by Mindket. It is free. This is version 1, last updated on 2026-11-12. Download it on this page or copy its JSON, then import it into an n8n canvas. Nothing runs until you activate it in n8n.

## About

### What it is

This n8n workflow turns a Telegram bot into a reader of your PDFs. When a message holds a file, the workflow downloads it, cuts the text into pieces, turns each piece into numbers with OpenAI and stores them in a Pinecone index. When a message is a question, it finds the stored pieces that fit and a model on Groq writes the answer from them. Eighteen nodes do the work, beside two sticky notes.

### Who it suits

Students, researchers and small teams who want to ask questions of a manual, a contract or a paper from their phone. You need accounts at Pinecone, OpenAI and Groq. Skip it if your files are not PDFs with real text, because scanned pictures give it nothing to store.

Who uses it, and how

| Industry | Who uses it | How they use it | Example |
| --- | --- | --- | --- |
| Education | Students | Ask a question of a paper or a set of lecture notes | A student sends a reading list as a PDF and asks which chapter covers sampling. |
| Legal | Small firms | Find a clause in a long contract | An assistant asks how long the notice period is, and the bot answers from the contract. |
| Operations | Office teams | Look things up in a policy or a manual | A new hire asks how many leave days they get and reads the answer in the chat. |
| Research | Analysts | Pull a figure out of a report | An analyst sends a market report and asks for the growth rate that it states. |

You need some n8n: import a file, add five credentials, make an index in Pinecone and fill in one name.

### Where to use it

Any n8n with a public HTTPS address can run it, because Telegram sends each message to that address.

- n8n Cloud: import the file into a new workflow there
- Your own n8n server: the same file and steps, once the server has a public HTTPS address
- Another model: swap \`Groq Chat Model\` for any other chat model node of n8n
- Another store: swap the two Pinecone nodes for another vector store node, and keep the same embeddings model in both

### How to set it up

Download saves a zip with `workflow.json` and Mindket’s setup notes in your downloads folder. You need a Telegram bot token, a Pinecone index and keys for OpenAI and Groq.

What you need first

| Need | Detail |
| --- | --- |
| n8n | On n8n Cloud or on a server with a public HTTPS address |
| Telegram | A bot and its token, which you get from BotFather inside Telegram |
| Pinecone | An index with 1536 dimensions and the cosine metric, and an API key |
| OpenAI | An API key for the embeddings, with some credit |
| Groq | An API key for the answers |

1. In n8n, create a workflow, open its menu, choose Import from File and pick `workflow.json`.
2. In `Pinecone Vector Store` and `Pinecone Vector Store1`, replace `YOUR_PINECONE_INDEX` with the name of your index and add a Pinecone credential.
3. In `Embeddings OpenAI` and `Embeddings`, add an OpenAI credential. Keep the same model in both.
4. In `Groq Chat Model`, add a Groq credential.
5. In the four Telegram nodes, add a Telegram credential with your bot token.
6. Press Test workflow and send a small PDF to your bot. The bot answers with the number of pages that it saved.
7. Press Test workflow again and send a question about that PDF. The answer arrives in the same chat.
8. Turn the workflow on, so that the bot keeps answering when you are away.

### How to use it

Once the workflow is on, it answers by itself. A message with a file adds that file to the index and gets a page count back. A text message gets an answer made from everything stored so far.

What to change for a different result

| To change | Where |
| --- | --- |
| The model | The model name in \`Groq Chat Model\` |
| The size of the pieces | Chunk Size and Chunk Overlap in \`Recursive Character Text Splitter\` |
| How many pieces the model sees | The limit in \`Vector Store Retriever\` |
| The question text | The text in \`Question and Answer Chain\` |
| Who may use the bot | Restrict to User IDs in \`Telegram Trigger\` |

### Example

A student studies for an exam in statistics.

The student sends the course notes as a PDF and the bot answers “42 pages saved”. Later the student asks “What does the course say about the central limit theorem?”. The workflow finds the pieces that fit and the model answers from them in a few sentences. If the notes do not hold the answer, the model should say so. Check the answers against the file before you rely on them, because they come from a model.

### For newcomers and experts

**If you are new.** n8n draws a workflow as boxes joined by lines, and each box, a node, does one job. A vector store such as Pinecone keeps pieces of text as lists of numbers, so that a question can find the pieces with the closest meaning. This workflow stores your PDFs there and then answers from them. Press Test workflow and send a small PDF first.

**For experts.** The file path and the question path share one index without a namespace, so every file ends up in one pool.

Where to look closer

| Node | What it does | What to know |
| --- | --- | --- |
| \`Check If is a document\` | Tests whether the message has a \`document\` | Anything else goes to the question path |
| \`Change to application/pdf\` | Marks the downloaded file as a PDF | The loader picks its reader from the type, so every file is read as a PDF |
| \`Pinecone Vector Store\` | Inserts the pieces | Clear Namespace is off, so a repeated file is stored twice |
| \`Embeddings OpenAI\` and \`Embeddings\` | Turn text into numbers | Both name \`text-embedding-3-small\`, and the index holds 1536 numbers for each piece |
| \`Vector Store Retriever\` | Fetches the closest pieces | It keeps its default of four |
| \`Question and Answer Chain\` | Gives the pieces and the question to the model | The prompt adds a line that tells it to use the retriever |
| \`Groq Chat Model\` | Writes the answer | It names \`openai/gpt-oss-120b\` |

### Good to know

The original copy named a model that Groq no longer lists, and it left the embeddings model to a version default.

- Model: the original copy asked for \`llama-3.1-70b-versatile\`. Groq’s models page, read on 12 November 2026, lists \`openai/gpt-oss-120b\` as a production model and does not list that name, so this copy uses \`openai/gpt-oss-120b\`
- Embeddings: the original copy was on node version 1, where an unset model means \`text-embedding-ada-002\`. This copy is on version 1.2 and names \`text-embedding-3-small\`. The two models give different vectors, so fill a new index
- Index: the original copy pointed at its author’s index, and this copy names \`YOUR\_PINECONE\_INDEX\`
- One pool: the index has no namespace, so anyone who can write to the bot can ask about any file that anyone sent. Restrict to User IDs in \`Telegram Trigger\` limits it, and works on node version 1.2 and later
- Repeats: sending the same PDF twice stores its pieces twice
- Size: Telegram lets a bot download files up to 20 MB
- PDF only: the code marks every file as a PDF, so a Word file fails, and a scanned PDF has no text to store
- Your data: the text of every PDF goes to OpenAI and to your Pinecone index, and each question with its pieces goes to Groq
- Not run: Mindket did not call any of the services to test this file. It ran in a test runner with stand-in answers, with a text file in place of a PDF, so the page count was not tried
- Credentials: the JSON holds none

## README

```markdown
# Telegram bot that answers questions from a PDF in Pinecone

An n8n workflow with two jobs on one Telegram bot. Send the bot a PDF, and it cuts the text into pieces and stores them in a
Pinecone index. Send it a question, and it finds the pieces that fit, hands them to a model on Groq and sends back the answer.

## What is inside

- `workflow.json`: the workflow as n8n exports it, 18 nodes and two sticky notes. It holds no credential.
- `README.md`: these notes.

## What we changed from the original copy

- `Groq Chat Model` asked for `llama-3.1-70b-versatile`. Groq's models page, read on 12 November 2026, lists
  `openai/gpt-oss-120b` as a production model and does not list that name, so this copy uses `openai/gpt-oss-120b`.
- Both embeddings nodes left the model unset on node version 1, which means `text-embedding-ada-002`. They are now on
  version 1.2 and name `text-embedding-3-small`. Both vectors have 1536 numbers, but the two models give different
  vectors, so fill a new index and do not reuse one that the original copy filled.
- Both Pinecone nodes pointed at an index named `telegram`, which was the author's. They now name `YOUR_PINECONE_INDEX`, and the node that
  searches has its mode set to retrieve on purpose.
- `Telegram Trigger` is now on node version 1.2, which can limit who may use the bot. See Good to know.
- The comments in `Change to application/pdf` were in Portuguese. They are in English now, and the code does the same work.
- The two sticky notes are rewritten in plain words. The time zone and the caller policy of the author's n8n are removed from
  the settings.
- Every credential reference is removed, so you pick your own.

## Before you start

- An n8n instance with a public HTTPS address. Telegram delivers updates by an HTTPS POST to the webhook address.
- A Telegram bot and its token. You make one by chatting with BotFather inside Telegram.
- A Pinecone account and an index with 1536 dimensions. Pinecone's guide says to set the dimension and the metric to match your
  embedding model, and OpenAI's guide gives 1536 for `text-embedding-3-small`. Pick the cosine metric.
- An OpenAI API key for the embeddings, and a Groq API key for the answers.

## Set it up

1. In n8n, create a workflow, open its menu and choose Import from File. Pick `workflow.json`.
2. In `Pinecone Vector Store` and in `Pinecone Vector Store1`, replace `YOUR_PINECONE_INDEX` with the name of your index and
   add a Pinecone credential with your API key.
3. In `Embeddings OpenAI` and in `Embeddings`, add an OpenAI credential with your API key. Keep the same model in both.
4. In `Groq Chat Model`, add a Groq credential with your API key.
5. In `Telegram Trigger`, `Telegram get File`, `Telegram Response` and `Telegram Response about Database`, add a Telegram
   credential with your bot token.
6. Press Test workflow and send a small PDF to your bot. The bot answers with the number of pages that it saved.
7. Press Test workflow again and send a question about that PDF. The answer arrives in the same chat.
8. Turn the workflow on, so that the bot keeps answering when you are away.

## How a run goes

1. `Telegram Trigger` starts the run when someone sends a message to your bot.
2. `Check If is a document` looks for a file in the message. A file goes the upper way, and anything else goes to the question path.
3. File path: `Telegram get File` downloads the file, and `Change to application/pdf` marks it as a PDF.
4. `Pinecone Vector Store` inserts it. `Default Data Loader` reads the PDF, `Recursive Character Text Splitter` cuts it into
   pieces of 3000 characters with 200 characters of overlap, and `Embeddings OpenAI` turns each piece into numbers.
5. `Limit to 1` keeps one item, and `Telegram Response about Database` tells the sender how many pages were saved.
6. Question path: `Question and Answer Chain` takes the text of the message. `Vector Store Retriever` asks
   `Pinecone Vector Store1` for the closest pieces, with `Embeddings` turning the question into numbers.
7. `Groq Chat Model` writes the answer from those pieces, and `Telegram Response` sends it to the chat.
8. A failed send goes to a `Stop and Error` node, so the run shows as failed in n8n.

## Change the look

- The model: the model name in `Groq Chat Model`.
- The size of the pieces: Chunk Size and Chunk Overlap in `Recursive Character Text Splitter`.
- How many pieces the model sees: the limit in `Vector Store Retriever`, which keeps its default of four.
- The wording of the question: the text in `Question and Answer Chain`.
- Who may use the bot: see the first item under Good to know.

## Good to know

- Every PDF goes into one pool. The index has no namespace, so anyone who can write to the bot can ask about any file that
  anyone sent. To limit it, open `Telegram Trigger`, add the field Restrict to User IDs under Additional Fields and list the
  Telegram user numbers that may use it. It is enforced on node version 1.2 and later.
- Sending the same PDF twice stores its pieces twice. The option Clear Namespace is off, and it only works when you name a
  namespace.
- Telegram lets a bot download files up to 20 MB, so a larger PDF fails at `Telegram get File`.
- The code marks every file as a PDF, so a Word file or a picture fails. A PDF made of scanned pictures has no text to store.
- A message that is neither a file nor text, such as a photo, stops at the chain with an empty text error.
- `openai/gpt-oss-120b` is a reasoning model, so an answer can take a little longer than with a plain chat model.
- Replies go out in Telegram's Markdown mode, which is the n8n default. A lone `_` or `*` in an answer can make Telegram
  refuse the message.
- Your data: the text of every PDF goes to OpenAI for the embeddings and is stored in your Pinecone index. Each question and
  the pieces that fit it go to Groq.
- Not run: we did not call any of the services to test this file. We ran it in a test runner with stand-in answers. The
  question path ran from the message to the reply. The file path ran with a text file in place of a PDF, because the
  runner cannot read PDFs, so the page count in the last message was not tried.
- Credentials: the JSON holds none.
```

## What is in it

3 files, 19 KB, downloaded as a zip.

```text
NOTICE.md  555 B
README.md  6 KB
workflow.json  12 KB
```

## Workflow check

Checked by Mindket on 13 Nov 2026. Read from the workflow’s file, not from a run.

- Steps: 11 steps, starting on a Telegram event
- AI: 2 steps call an AI model: Pinecone Vector Store and Question and Answer Chain
- Sign-ins: Signs in to: Telegram, Pinecone, OpenAI and Groq
- API keys: No API key is left in the file
- Step types: Mindket’s checker reads all 8 of its step types

## Get it

- [Get it on your Mindket account](https://account.mindket.com/account/?product=mindket#/market/fbdd6681-efef-488c-a169-3421eb06b3a8)
- [Its page on Mindket](https://mindket.com/p/fbdd6681-efef-488c-a169-3421eb06b3a8)
