A Shopify storefront FAQ RAG chatbot built with n8n, Gemini and Supabase answers shopper questions using your own catalog and policy pages instead of a generic script. Shoppers ask “does this ship to Texas?” or “what is your return window?” and get a grounded answer pulled from your real store data. This guide builds the whole thing with Google Gemini and a Supabase vector store, so it stays free to run at small volume and never sends a shopper an invented policy.
What it does
Most storefront chat widgets either forward every message to a human or run on a static decision tree that breaks the moment a shopper phrases a question differently. Retrieval augmented generation (RAG) fixes that. You embed your store’s real content once, and the chatbot retrieves the most relevant pieces to answer each question in the shopper’s own words.
There are two flows in this template. The first is an ingestion flow: it pulls your Shopify products and your shop policies, turns them into clean text, and stores them as vectors in Supabase. The second is a chat flow: a hosted chat widget takes a shopper question, searches Supabase for the closest matching content, and lets Gemini write a short, grounded reply.
INGESTION (run on demand or nightly)
Manual/Schedule -> Get Products (Shopify) --.
-> Get Policies (HTTP) ------> Merge -> Build Documents -> Supabase (Insert)
^ Gemini Embeddings
^ Data Loader + Splitter
CHAT (always on)
Chat widget -> Storefront AI Agent -> reply
|-- Gemini Chat Model
|-- Store Knowledge tool -> Supabase (retrieve) -> Gemini Embeddings
If you have already built a general document chatbot, this is the store-specific cousin of our Drive and Supabase document chatbot. The difference here is the knowledge source: your live product catalog and policies, not files in a folder.
Why it beats the default
A canned FAQ widget only knows the answers you hard-coded. Add a product, change your return window, or run a sale, and the widget is instantly wrong. This RAG setup reads from the same catalog your storefront shows, so it is right by construction as long as you re-run ingestion when things change.
It also beats a plain large language model with no retrieval. Ask a bare model about your shipping policy and it will happily guess. Because this agent is told to answer only from the store_knowledge tool and to defer to support when unsure, it does not fabricate prices or policies, which is exactly the failure mode that gets stores in trouble. For open-ended support tickets and order lookups, pair it with our Shopify AI customer support chatbot; this template focuses on pre-sale storefront questions.
What you need
- An n8n instance (Cloud or self-hosted, community edition is fine).
- A Shopify store and a custom app token. Follow our 2026 guide to connect Shopify to n8n using the Dev Dashboard method, with the
read_productsandread_contentscopes. - A Google Gemini API key (free tier) for embeddings and chat.
- A Supabase project (free tier) with the
pgvectorextension enabled and adocumentstable plus amatch_documentsfunction.
Enable pgvector in Supabase and create the vector table before your first run. In the Supabase SQL editor, run the standard n8n vector setup, but set the embedding column to vector(768) because Gemini’s text-embedding-004 returns 768 dimensions, not 1536.
Node-by-node list
Ingestion flow
When clicking Test workflow— Manual Trigger. Kicks off ingestion (swap for Schedule Trigger later).Get Products (Shopify)— Shopify node, product / Get All, returns your whole catalog.Get Policies (HTTP)— HTTP Request to the Admin APIpolicies.jsonendpoint for shipping, refund and privacy text.Merge Sources— Merge node in append mode, combining products and policies into one stream.Build Documents— Code node that strips HTML and formats each product and policy into a clean text block.Supabase (Insert)— Supabase Vector Store in insert mode, writing embeddings to thedocumentstable.Gemini Embeddings (Ingest)— embeddings sub-node feeding the insert step.Data Loader— Default Data Loader that reads thetextfield and attaches metadata.Text Splitter— Recursive Character Text Splitter, 1000-character chunks with 100 overlap.
Chat flow
When chat message received— Chat Trigger, the hosted storefront widget.Storefront AI Agent— AI Agent that must call the knowledge tool before answering.Gemini Chat Model—gemini-2.5-flash, the language model behind the agent.Store Knowledge (Supabase)— Supabase Vector Store in retrieve-as-tool mode, top 5 matches.Gemini Embeddings (Query)— embeds the shopper’s question so it can be matched.
Step-by-step build
- Prepare Supabase. In your Supabase project, enable the
vectorextension, then create adocumentstable and amatch_documentsfunction using the n8n template SQL, with the embedding column set tovector(768). - Add the Manual Trigger. Drop in
When clicking Test workflowas the ingestion entry point. - Pull products. Add the Shopify node, choose resource Product and operation Get All, enable Return All, and attach your Shopify credential.
- Pull policies. Add an HTTP Request node, method GET, URL
https://YOUR_STORE.myshopify.com/admin/api/2026-04/policies.json, authentication set to Predefined Credential Type, Shopify API. Connect the Manual Trigger to both this and the Shopify node. - Merge the two sources. Add the Merge node in append mode. Wire Shopify into input 1 and the HTTP node into input 2.
- Build clean documents. Add the Code node. It loops the merged items, detects the
policiesarray versus product fields, strips HTML tags, and outputs one item per document with atextfield andsource/titlemetadata. - Wire the vector store (insert). Add the Supabase Vector Store node in Insert mode, table
documents. Attach the Gemini Embeddings sub-node, a Default Data Loader reading{{ $json.text }}, and a Recursive Character Text Splitter under the loader. - Run ingestion once. Click Test workflow. Confirm rows appear in the Supabase
documentstable. - Add the chat flow. Drop in the Chat Trigger and an AI Agent. Set the agent system message so it answers only from the
store_knowledgetool and defers to support when unsure. - Attach the model and tool. Connect a Gemini Chat Model (
gemini-2.5-flash) and a second Supabase Vector Store in retrieve-as-tool mode namedstore_knowledge, with its own Gemini Embeddings sub-node. - Test the chat. Open the chat URL and ask a real question like “what is your return policy?” Confirm the agent retrieves and answers from your data.
Tip: To keep answers fresh automatically, replace the Manual Trigger with a Schedule Trigger set to run nightly, or fire ingestion from a Shopify products/create webhook so new listings are searchable within minutes.
Common mistakes
- Wrong vector size. Creating the Supabase column as
vector(1536)(the OpenAI default) breaks inserts. Geminitext-embedding-004is 768 dimensions. - Different embedding models per flow. The ingest and query embeddings must use the same model. Both nodes here use
text-embedding-004on purpose; do not change one without the other. - Skipping the “answer only from the tool” instruction. Without it the agent will invent shipping times and prices. The system message is the guardrail.
- Missing scopes. If policies come back empty, your Shopify token is missing
read_content. Products needread_products. - Never re-ingesting. RAG is only as current as your last ingestion run. Schedule it or trigger it on catalog changes.
Cost at realistic volume
For a store with a few hundred products and a handful of policy pages, this runs at or near zero. Gemini’s free tier covers the embeddings and the chat volume of a small storefront, and Supabase’s free tier holds the vectors comfortably.
| Component | Free tier covers | Cost at small volume |
|---|---|---|
| Gemini embeddings (text-embedding-004) | Re-embedding a few hundred products nightly | $0 |
| Gemini chat (gemini-2.5-flash) | Hundreds of shopper questions per day | $0 |
| Supabase (pgvector) | 500 MB database, easily thousands of chunks | $0 |
| n8n (community, self-hosted) | Unlimited executions on your own server | $0 |
At larger volume you would move Gemini to pay-as-you-go, where flash pricing keeps a busy storefront in the low single digits of dollars per month, and optionally upgrade Supabase for more storage. The architecture does not change.
🚀 Ready-to-import template
The guide above is free to follow end to end. If you would rather skip the wiring, the downloadable template is the exact validated workflow from this post, pre-built with both flows and every node connected, so you only add your credentials and the Supabase SQL. Prefer it fully done for you? Our done-for-you service installs and configures it on your instance.
Instant download · Works on n8n Cloud and self-hosted
FAQ
Do I need OpenAI for this Shopify RAG chatbot?
No. This build uses Google Gemini for both embeddings (text-embedding-004) and chat (gemini-2.5-flash), which have a free tier generous enough for most small stores. You never touch OpenAI, so there is no separate paid key to manage and the running cost at low volume is effectively zero.
How does the chatbot stay up to date when I add products?
Re-run the ingestion flow whenever your catalog changes. Swap the manual trigger for a Schedule Trigger set to run nightly, or trigger it from a Shopify products/create webhook. Each run re-embeds your products and policies into Supabase so the chatbot answers from current data.
Where does the chatbot get its answers from?
Only from your own store. The ingestion flow pulls your Shopify product catalog and shop policies (shipping, returns, refunds), embeds them, and stores them in Supabase. The agent is instructed to answer only from that knowledge and to suggest contacting support when it is unsure.
Can I embed this chatbot on my Shopify storefront?
Yes. The Chat Trigger exposes a hosted chat URL and an embeddable widget snippet you can paste into your theme. You can also point a custom front-end at the trigger webhook if you prefer to match your brand styling exactly.
Is Supabase free for this?
The Supabase free tier includes a Postgres database with the pgvector extension, which is all this workflow needs. A catalog of a few hundred products and your policy pages fits comfortably inside the free storage limit, so most stores run the whole stack at no cost.