HomeShopify & E-commerceBuild a Shopify Storefront FAQ RAG…

Build a Shopify Storefront FAQ RAG Chatbot with n8n, Gemini and Supabase

Build a Shopify Storefront FAQ RAG Chatbot with n8n, Gemini and Supabase











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_products and read_content scopes.
  • A Google Gemini API key (free tier) for embeddings and chat.
  • A Supabase project (free tier) with the pgvector extension enabled and a documents table plus a match_documents function.
📌

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

  1. When clicking Test workflow — Manual Trigger. Kicks off ingestion (swap for Schedule Trigger later).
  2. Get Products (Shopify) — Shopify node, product / Get All, returns your whole catalog.
  3. Get Policies (HTTP) — HTTP Request to the Admin API policies.json endpoint for shipping, refund and privacy text.
  4. Merge Sources — Merge node in append mode, combining products and policies into one stream.
  5. Build Documents — Code node that strips HTML and formats each product and policy into a clean text block.
  6. Supabase (Insert) — Supabase Vector Store in insert mode, writing embeddings to the documents table.
  7. Gemini Embeddings (Ingest) — embeddings sub-node feeding the insert step.
  8. Data Loader — Default Data Loader that reads the text field and attaches metadata.
  9. Text Splitter — Recursive Character Text Splitter, 1000-character chunks with 100 overlap.

Chat flow

  1. When chat message received — Chat Trigger, the hosted storefront widget.
  2. Storefront AI Agent — AI Agent that must call the knowledge tool before answering.
  3. Gemini Chat Modelgemini-2.5-flash, the language model behind the agent.
  4. Store Knowledge (Supabase) — Supabase Vector Store in retrieve-as-tool mode, top 5 matches.
  5. Gemini Embeddings (Query) — embeds the shopper’s question so it can be matched.

Step-by-step build

  1. Prepare Supabase. In your Supabase project, enable the vector extension, then create a documents table and a match_documents function using the n8n template SQL, with the embedding column set to vector(768).
  2. Add the Manual Trigger. Drop in When clicking Test workflow as the ingestion entry point.
  3. Pull products. Add the Shopify node, choose resource Product and operation Get All, enable Return All, and attach your Shopify credential.
  4. 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.
  5. Merge the two sources. Add the Merge node in append mode. Wire Shopify into input 1 and the HTTP node into input 2.
  6. Build clean documents. Add the Code node. It loops the merged items, detects the policies array versus product fields, strips HTML tags, and outputs one item per document with a text field and source/title metadata.
  7. 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.
  8. Run ingestion once. Click Test workflow. Confirm rows appear in the Supabase documents table.
  9. 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_knowledge tool and defers to support when unsure.
  10. 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 named store_knowledge, with its own Gemini Embeddings sub-node.
  11. 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. Gemini text-embedding-004 is 768 dimensions.
  • Different embedding models per flow. The ingest and query embeddings must use the same model. Both nodes here use text-embedding-004 on 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 need read_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.

Download the template ($19) →

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.

Related guides