---
title: "Chat with the PDF and text files in a Supabase bucket"
kind: "Kit"
category: "Productivity"
price: "Free"
seller: "Mindket"
version: "1"
url: "https://mindket.com/p/82a36b4f-8ca4-4b66-8df4-74452f1de324"
updated: "2026-11-12"
---

# Chat with the PDF and text files in a Supabase bucket

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

An n8n workflow that reads the PDF and text files in a Supabase storage bucket, stores their text as OpenAI embeddings in a Supabase table, and gives you a chat agent that answers from them.

Chat with the PDF and text files in a Supabase bucket is an n8n workflow in the Productivity 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 lets you chat with the files in a Supabase storage bucket. Its first half reads the bucket. It lists the files, skips any that a `files` table already records, downloads the rest and pulls the text out of PDFs and plain text files. The text is cut into pieces of 500 characters, and OpenAI turns each piece into an embedding stored in a Supabase table. Its second half is a chat agent with a knowledge tool that searches those pieces and answers from what it finds. Twenty-two nodes do the work, beside nine sticky notes.

### Who it suits

Teams that keep contracts, manuals or reports in Supabase storage and want to ask about them in plain words, and that already run a Supabase project. Skip it if your files are Word documents or images, or if people without n8n should use the chat. It opens only inside the n8n editor.

Who uses it, and how

| Industry | Who uses it | How they use it | Example |
| --- | --- | --- | --- |
| Operations | Office managers | Ask what a stored contract says about renewal | A manager asks when notice is due before a lease ends. |
| Customer support | Support leads | Search product manuals kept in a bucket | A lead asks which models a warranty note covers. |
| Legal | Paralegals | Look up a clause across stored PDFs before opening each one | A paralegal asks which agreements set a data retention period. |
| Education | Course teams | Let staff question lecture notes and handouts | A coordinator asks where a syllabus fixes the assessment dates. |

You need solid n8n for this one: a Supabase project with a bucket and two tables, a vector function and six nodes pointed at your Supabase credential.

### Where to use it

Any n8n that can reach Supabase and OpenAI will run it. The text of every file ends up in your Supabase project, and the chat answers inside n8n.

- n8n Cloud: import the file into a new workflow there
- Your own n8n server: the same file and steps
- Supabase: the bucket, the \`files\` table and the vector table all live in one project
- A shared chat: turn on Make Chat Publicly Available in \`When chat message received\` and set its authentication

### How to set it up

Download saves a zip with `workflow.json` and Mindket’s setup notes in your downloads folder. Build the Supabase side first.

What you need first

| Need | Detail |
| --- | --- |
| n8n | On n8n Cloud or on a server of your own |
| Supabase | A project with a storage bucket named \`private\`, a table \`files\` with \`name\` and \`storage\_id\` columns, and a table \`documents\` with a \`match\_documents\` function |
| OpenAI | An API key. The embeddings use \`text-embedding-3-small\`, and the chat models take their node’s default |
| Files | PDFs or plain text files in the bucket |

1. In n8n, create a workflow, open its menu, choose Import from File and pick `workflow.json`.
2. In Supabase, create the bucket, the `files` table and the `documents` table with its `match_documents` function. The vectors are 1536 numbers long, the size `text-embedding-3-small` returns.
3. Add a Supabase API credential with your project’s URL and a secret key. Select it in `Get All Files`, `Create File record2`, `Insert into Supabase Vectorstore` and `Supabase Vector Store`. In the HTTP nodes `Get All files` and `Download`, pick the Supabase credential type and the same credential.
4. In those two HTTP nodes, replace `<YOUR_SUPABASE_PROJECT_REF>` in the address with your project reference, the part before `.supabase.co`. If your bucket has another name, change `private` in both.
5. Add an OpenAI credential and select it in `Embeddings OpenAI`, `Embeddings OpenAI2`, `OpenAI Chat Model1` and `OpenAI Chat Model2`.
6. Put a PDF and a text file in the bucket, run the workflow from `When clicking ‘Test workflow’` and check that `files` and `documents` gain rows.
7. In `Supabase Vector Store`, replace `<YOUR_FILE_ID>` with the `id` of a row in `files` to answer from that one file, or remove the metadata filter to search every file.
8. Save, press Chat on the canvas and ask about a file.

### How to use it

Run the first half whenever you add files. It reads only files that `files` does not list yet. Then ask the chat about them. The agent calls its knowledge tool, which returns the 8 closest pieces, and answers from those.

What to change for a different result

| To change | Where |
| --- | --- |
| Which files are read | The two rules in \`Switch\` |
| Piece size | \`chunkSize\` 500 and \`chunkOverlap\` 200 in \`Recursive Character Text Splitter\` |
| Pieces per question | \`topK\`, 8, in \`Vector Store Tool1\` |
| The embedding model | \`text-embedding-3-small\` in both embedding nodes, which must match |
| The chat agent | The models in \`OpenAI Chat Model1\` and \`OpenAI Chat Model2\`, and the tool’s name and description |

### Example

An office manager puts two lease PDFs and a text file of building rules in the bucket. She runs the first half once, then asks the chat when notice is due before a lease ends.

Each file gets a row in `files`, and the pieces of its text go into `documents` with the row’s id as `file_id`. The agent searches for the 8 closest pieces and answers from them. Check any date or figure against the file before you act on it.

### 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. The upper band, Scenario 1, fills the knowledge base. The lower band, Scenario 2, is the chat. Start with one small file and check that its text lands in `documents` before you ask anything.

**For experts.** A loop handles one file at a time, and `If` decides a file is new by looking for its `storage_id` in the rows `Aggregate` collected.

Where to look closer

| Node | What it does | What to know |
| --- | --- | --- |
| \`Get All files\` | POSTs to the bucket’s list endpoint with a limit of 100 and an offset of 0, sorted by name | Only the first 100 files are seen |
| \`Get All Files\` | Reads the \`files\` table with n8n’s default limit of 50 rows | Past 50 rows, older files look new and are added again |
| \`If\` | Lets a file through when it is not in \`files\` and is not \`.emptyFolderPlaceholder\` | Other files return to the loop |
| \`Switch\` | \`txt\` for a download with no file extension in its binary data, \`pdf\` for a PDF | Any other type matches neither rule, so the loop stops |
| \`Default Data Loader\` | Reads \`data\` or \`text\` and stamps each piece with the row’s id as \`file\_id\` | The chat’s metadata filter uses that field |

### Good to know

Only PDFs and plain text files are meant to pass, and two limits cap how many files it keeps straight.

- Models: the two chat model nodes set no model, so they take the node’s own default, \`gpt-5-mini\` in n8n’s repository on 12 November 2026. OpenAI’s deprecations page, read that day, gives 14 January 2027 as the shutdown of \`gpt-4o\` and \`gpt-4o-mini\`, with \`gpt-6-luna\` as the replacement. If your n8n offers an older default, pick a model in each node
- File types: a Word file or an image matches no rule of \`Switch\`, so nothing returns to the loop and the run stops with later files unread. Keep to PDFs and text
- Limits: only the first 100 files in the bucket are seen, and \`Get All Files\` has Return All off, so n8n reads 50 rows of \`files\`. Turn on Return All in that node
- Repeats: each file goes in once. To read a file again, delete its row in \`files\` and its pieces in \`documents\` first
- The filter: with \`\<YOUR\_FILE\_ID\>\` replaced, the chat sees one file. Remove the filter to search every file
- Billing: OpenAI bills the embeddings for every piece of each new file, and each question takes an agent call plus a call for the knowledge tool
- Your data: the text of each file goes to OpenAI and into your Supabase project. Your questions go to OpenAI
- Keys: the Supabase credential holds a secret key, so use a project meant for this
- Credentials: the JSON holds none, and it names no project of its author’s

## README

```markdown
# Chat with the PDF and text files in a Supabase bucket

An n8n workflow in two halves. The first reads the PDF and text files in a Supabase storage bucket, cuts their text into
pieces and stores each piece as an OpenAI embedding in a Supabase table. The second is a chat agent that searches those
pieces and answers from them.

## What is inside

- `workflow.json`: the workflow as n8n exports it, 31 nodes, nine of them sticky notes. It holds no credential. Six notes
  remind you to replace credentials, two name the halves, Scenario 1 for the files and Scenario 2 for the chat, and one
  gives the workflow's title.
- `README.md`: these notes.

## What we changed from the original copy

- Every node was linked to a credential in its author's n8n. The links are gone, so select your own.
- `Get All files` and `Download` held the address of their author's Supabase project. It now reads
  `<YOUR_SUPABASE_PROJECT_REF>.supabase.co`.
- `Supabase Vector Store` filtered on one file's id from its author's database. It now reads `<YOUR_FILE_ID>`.
- Three sticky notes carried their author's promotion, a video link and setup steps. One now holds a short title, and the
  other two are gone.
- The original copy had no settings block. Mindket's sets the execution order to v1.
- Nothing else. The file has no Code node, and its expressions needed no repair.

## Before you start

- An n8n instance, on n8n Cloud or your own server.
- A Supabase project with a storage bucket named `private`, holding PDFs or plain text files.
- A table `files` with the text columns `name` and `storage_id`.
- A table `documents` and a `match_documents` function, set up the way n8n's Supabase vector store expects. The table has
  `content`, `metadata` and `embedding` columns, and the embedding is 1536 numbers long, the size `text-embedding-3-small`
  returns.
- An OpenAI API key.

## Set it up

1. In n8n, create a workflow, open its menu and choose Import from File. Pick `workflow.json`.
2. Create the bucket, the `files` table and the `documents` table with its function in Supabase.
3. Add a Supabase API credential with your project's URL and a secret key. Select it in `Get All Files`,
   `Create File record2`, `Insert into Supabase Vectorstore` and `Supabase Vector Store`. In `Get All files` and
   `Download`, which are HTTP requests, pick the Supabase credential type and the same credential.
4. In `Get All files` and `Download`, replace `<YOUR_SUPABASE_PROJECT_REF>` in the address with your project reference,
   the part before `.supabase.co`. If your bucket has another name, change `private` in both addresses.
5. Add an OpenAI credential and select it in `Embeddings OpenAI`, `Embeddings OpenAI2`, `OpenAI Chat Model1` and
   `OpenAI Chat Model2`.
6. Put one PDF and one text file in the bucket. Run the workflow from `When clicking ‘Test workflow’`, then check that
   `files` and `documents` gained rows.
7. In `Supabase Vector Store`, replace `<YOUR_FILE_ID>` with the `id` of a row in `files` to answer from that one file, or
   remove the metadata filter to search every file.
8. Save, press Chat on the canvas and ask a question about a file.

## How a run goes

Scenario 1, the files:

1. `Get All Files` reads the `files` table and `Aggregate` folds its rows into one list.
2. `Get All files` asks Supabase Storage for the bucket's file list, 100 files at most, sorted by name.
3. `Loop Over Items` takes one file at a time. `If` lets it through when no row in `files` has its `storage_id` and its
   name is not `.emptyFolderPlaceholder`. A file that fails goes back to the loop.
4. `Download` fetches the file. `Switch` sends a download with no file extension in its binary data, a text file, down
   the `txt` output, and a PDF down the `pdf` output through `Extract Document PDF`. `Merge` joins the two.
5. `Create File record2` adds the file to `files`. `Insert into Supabase Vectorstore` then stores its text. `Default Data
   Loader` reads `data` for a text file or `text` for a PDF and stamps each piece with the row's id as `file_id`.
   `Recursive Character Text Splitter` cuts the text into pieces of 500 characters that overlap by 200, and
   `Embeddings OpenAI` turns each into a vector. The loop then moves on.

Scenario 2, the chat:

1. `When chat message received` takes your message. `AI Agent` answers it, with `OpenAI Chat Model1` as its model.
2. Its one tool, `Vector Store Tool1`, is named `knowledge_base`. It searches `Supabase Vector Store` through
   `Embeddings OpenAI2` and returns the 8 closest pieces, and `OpenAI Chat Model2` reads them for the tool.

## Change the look

- Which files are read: the two rules in `Switch`.
- Piece size: `chunkSize` and `chunkOverlap` in `Recursive Character Text Splitter`.
- Pieces per question: `topK` in `Vector Store Tool1`.
- The embedding model: `text-embedding-3-small` in both embedding nodes. Keep them the same, and keep the table's vector
  size to match.
- The chat: the models in `OpenAI Chat Model1` and `OpenAI Chat Model2`, and the tool's name and description.

## Good to know

- Models: the two chat model nodes set no model, so they take the node's own default, `gpt-5-mini` in n8n's repository on
  12 November 2026. OpenAI's deprecations page, read that day, gives 14 January 2027 as the shutdown of `gpt-4o` and
  `gpt-4o-mini`, with `gpt-6-luna` as the replacement. If your n8n offers an older default, pick a model in each node.
- File types: only PDFs and plain text files are meant to pass. Another type, such as a Word file, matches no rule of
  `Switch`, so nothing returns to the loop and the run stops with later files unread.
- Limits: `Get All files` sees the first 100 files in the bucket. `Get All Files` has Return All off, so n8n reads only 50
  rows of `files`. Past 50 rows, older files look new and are added again. Turn on Return All in that node.
- Each file goes in once. To read a file again, delete its row in `files` and its pieces in `documents` first.
- The metadata filter keeps the chat to one file. Without it the agent searches every file in `documents`.
- Billing: OpenAI bills the embeddings for every piece of every new file, and each question takes an agent call plus a call
  for the knowledge tool.
- Your data: the text of each file goes to OpenAI and into your Supabase project. Your questions go to OpenAI.
- The Supabase credential holds a secret key, so use a project meant for this.
```

## What is in it

3 files, 26 KB, downloaded as a zip.

```text
NOTICE.md  628 B
README.md  6 KB
workflow.json  19 KB
```

## Workflow check

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

- Steps: 14 steps, starting by hand or on a chat message
- AI: 2 steps call an AI model: Insert into Supabase Vectorstore and AI Agent
- Sign-ins: Signs in to: Supabase and OpenAI
- API keys: No API key is left in the file
- Step types: Mindket’s checker reads all 12 of its step types

## Get it

- [Get it on your Mindket account](https://account.mindket.com/account/?product=mindket#/market/82a36b4f-8ca4-4b66-8df4-74452f1de324)
- [Its page on Mindket](https://mindket.com/p/82a36b4f-8ca4-4b66-8df4-74452f1de324)
