# Build a Website RAG Chatbot with Gemini

> Two n8n sub-workflows keep a Gemini chatbot grounded in your website: one scrapes and embeds pages into Pinecone, the other answers visitor questions from that vector store.

- URL: https://www.automongo.com/automations/website-rag-chatbot-gemini/
- Summary: Train a Gemini chatbot on your website using Apify and Pinecone RAG.
- Tools: n8n
- Difficulty: Advanced
- Category: Development
- Tags: rag, chatbot, pinecone, gemini, apify
- Published: 2026-11-04
- External resource: https://n8n.io/workflows/14157-build-a-company-website-rag-chatbot-using-apify-pinecone-and-gemini/?ref=ez5zfu33yh5f&utm_source=affiliate

## How It Works

Large language models only know what they were trained on, so a chatbot that answers questions about your business needs an outside source of truth. This n8n template wires that source of truth to Gemini using a retrieval-augmented generation pattern: a scheduled job scrapes your website with the Apify Website Content Crawler, pushes the text into a Pinecone vector index, and a separate chat agent retrieves the most relevant chunks before each response. The workflow is split into two sub-logics, flagged in the canvas with green sticky notes, so the ingestion pipeline and the live agent can be edited independently.

### Setup Steps

1. **Create a Google Cloud project**: Enable the Vertex AI API and generate a Google AI API key from Google AI Studio.
2. **Create an Apify account**: Sign up at apify.com; the Apify node uses the Website Content Crawler actor to pull every page from your site.
3. **Create a Pinecone index**: On the Pinecone free tier, create an index named company-website and copy the API key from the dashboard.
4. **Add credentials in n8n**: Configure the Google Gemini (PaLM) API and Pinecone API credentials so both the embedding and vector store nodes can authenticate.
5. **Set the schedule frequency**: Edit the Schedule Trigger to match how often your site content changes; swap it for a click trigger if the chatbot only needs to be trained once.
6. **Configure the Apify node**: Authenticate the Apify node (OAuth or API token) and set the target website URL inside the JSON input before the first run.

### Automation Workflow

```
Schedule Trigger → Apify Website Content Crawler → Embeddings Gemini → Pinecone Vector Store (insert)
                                                                            ↓
Chat Trigger → AI Agent → Vector Store Tool → Pinecone Vector Store (query)
                   ↓
          Google Gemini Chat Model (gemini-pro) → Chat response
```

### Benefits

- **Grounded answers**: Every reply is built from the exact text chunks retrieved from Pinecone, so the chatbot cites what your site actually says rather than guessing.
- **Fresh index**: The Schedule Trigger reruns the crawl on your cadence, so content changes on the website propagate into the vector store without manual work.
- **Model portability**: The Gemini chat node can be swapped for another LLM; only the embedding step needs to stay aligned with the index.
- **Reusable across sites**: The Website Content Crawler accepts any URL, so the same template can index a competitor site, a help center, or a mix of sources.
- **Clear separation**: Ingestion and chat live in two distinct sub-workflows, which makes it easy to pause one while editing the other.

### Advanced Features

- Two independent sub-workflows for ingestion and chat, sharing only the Pinecone index.
- Scheduled re-crawl that updates embeddings for pages that have changed since the last run.
- AI Agent node that chains a Vector Store Tool with the Gemini chat model, so retrieval and generation are orchestrated inside one agent step.
- JSON-driven Apify input, which lets you extend the crawl to multiple start URLs or combine several websites into one knowledge base.

### Use Cases

- Answer product questions on a marketing site using the latest copy from the product pages.
- Build an internal help desk bot that stays in sync with a documentation portal.
- Give sales reps a chat interface over a competitor's public knowledge base.
- Power an onboarding assistant that pulls policies and procedures from an intranet.
- Combine several domains into one chatbot so visitors can ask about parent and subsidiary brands in a single thread.
