N
n8n Store
Workflow Market
Build a chatbot on website content and Airtable data for RAG applications

Build a chatbot on website content and Airtable data for RAG applications

by alokkumar0 views

Description

Categories

🤖 AI & Machine Learning

Nodes Used

n8n-nodes-base.setn8n-nodes-base.coden8n-nodes-base.markdownn8n-nodes-base.stickyNoten8n-nodes-base.stickyNoten8n-nodes-base.stickyNoten8n-nodes-base.stickyNoten8n-nodes-base.stickyNoten8n-nodes-base.stickyNoten8n-nodes-base.stickyNote
PriceGratuit
Views0
Last Updated11/28/2025
workflow.json
{
  "id": "vgHm3xR0KrPRtInw",
  "meta": {
    "instanceId": "70273a2379644db63ce659827cfd8abac2d0b189210eafa02dd5376e3a62cd1d",
    "templateCredsSetupCompleted": true
  },
  "name": "Build a chatbot on website content and Airtable data for RAG applications",
  "tags": [],
  "nodes": [
    {
      "id": "27b3afae-9ea4-4552-b0b0-4ab0c94b5b53",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -3872,
        1680
      ],
      "parameters": {
        "width": 832,
        "height": 1088,
        "content": "## Try It Out!  \n### This n8n workflow shows how to **extract website content, index it in Pinecone, and leverage Airtable to power a chat agent for customer Q&A**.\n\nUse cases include:  \n* Building a **knowledge base** from your website.  \n* Creating a **chatbot** that answers customer queries using your own site content.  \n* Powering **RAG workflows** for FAQs, support docs, or product knowledge.  \n\n---\n\n### How it works\n* Workflow starts with a **manual trigger** or chat message.  \n* Website content is fetched via **HTTP Request**.  \n* The **HTML body** is extracted and converted into clean **Markdown**.  \n* Text is split into chunks (~500 chars with 50 overlap) using the **Character Text Splitter**.  \n* **OpenAI embeddings** are generated for each chunk.  \n* Content and embeddings are stored in **Pinecone** with namespace separation.  \n* A **Chat Agent** (powered by OpenAI or OpenRouter) retrieves answers from Pinecone and Airtable.  \n* **Memory buffer** allows multi-turn conversations.  \n* A **billing tool** (Airtable) provides dynamic billing-related answers when needed.  \n\n---\n\n### How to use\n* Replace the sample website URL in the **HTTP Request** node with your own domain or content source.  \n* Adjust chunk size in the **Text Splitter** for your website markdown output.  \n  * In this example, the **Character Text Splitter with separator `######`** worked really well.  \n  * Always check the **Markdown output** to fine-tune your splitting logic.  \n* Update **Pinecone namespace** to match your project.  \n* Customize the **Chat Agent system prompt** to fit your brand voice and response rules.  \n* Connect to your own **Airtable schema** if you want live billing/payment data access.  \n\n---\n\n### Requirements\n* **OpenAI account** (for embeddings + chat model).  \n* **Pinecone account** (vector DB for semantic search).  \n* **Airtable account** (if using the billing tool).  \n* (Optional) **OpenRouter account** (alternative chat model provider).  \n* n8n self-hosted or cloud.  \n\n---\n\n### Need Help?  \nAsk in the [n8n Forum](https://community.n8n.io/)!  \n\nHappy Automating! 🚀\n"
      },
      "typeVersion": 1
    },
    {
      "id": "1fdfe425-b96f-47d2-80b8-faa5d9dce065",
      "name": "When clicking ‘Execute workflow’",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -2464,
        2032
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "cf71e27b-494f-4a74-a618-d17028322a98",
      "name": "HTTP Request",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -2240,
        2032
      ],
      "parameters": {
        "url": "https://content.eirevo.ie/billing-change-faqs",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "4a94dac9-191e-48a5-bce5-79d512b3308d",
      "name": "Exctract HTML Body",
      "type": "n8n-nodes-base.set",
      "position": [
        -2016,
        2032
      ],
      "parameters": {
        "include": "selected",
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "3639b76e-3ae9-4461-8d4c-552bf1c8a6bf",
              "name": "data",
              "type": "string",
              "value": "={{ $json?.data.match(/<body[^>]*>([\\s\\S]*?)<\\/body>/i)[1] }}"
            },
            {
              "id": "7be9508a-d610-4c6b-8a75-83d48393ebc9",
              "name": "",
              "type": "string",
              "value": ""
            }
          ]
        },
        "includeFields": "HTML",
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "76a93390-6175-40e0-85d1-95bf0dfdca3c",
      "name": "Markdown",
      "type": "n8n-nodes-base.markdown",
      "position": [
        -1792,
        2032
      ],
      "parameters": {
        "html": "={{ $json.data }}",
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "b52ff3af-8e86-4f8e-884c-8815177aa49e",
      "name": "Default Data Loader1",
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "position": [
        -1440,
        2256
      ],
      "parameters": {
        "options": {},
        "textSplittingMode": "custom"
      },
      "typeVersion": 1.1
    },
    {
      "id": "db318cd8-dc79-4686-9bb4-5d1cc6656e6c",
      "name": "Generate Embeddings1",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "position": [
        -1568,
        2256
      ],
      "parameters": {
        "options": {
          "dimensions": 1536
        }
      },
      "credentials": {
        "openAiApi": {
          "id": "Yj4Rt75fspowAEru",
          "name": "nextweb-openai"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "712d2bc5-06ac-4d8b-893e-d8b7828be2ef",
      "name": "Store in Pinecone1",
      "type": "@n8n/n8n-nodes-langchain.vectorStorePinecone",
      "position": [
        -1440,
        2032
      ],
      "parameters": {
        "mode": "insert",
        "options": {
          "pineconeNamespace": "eirevo"
        },
        "pineconeIndex": {
          "__rl": true,
          "mode": "list",
          "value": "eirevo",
          "cachedResultName": "eirevo"
        }
      },
      "credentials": {
        "pineconeApi": {
          "id": "uo1lZDPNWTsMAeOC",
          "name": "learnby-PineconeApi-account"
        }
      },
      "notesInFlow": false,
      "typeVersion": 1.3
    },
    {
      "id": "b006e7c3-5ebd-424c-9a55-e0544a810e9c",
      "name": "Character Text Splitter",
      "type": "@n8n/n8n-nodes-langchain.textSplitterCharacterTextSplitter",
      "position": [
        -1360,
        2464
      ],
      "parameters": {
        "chunkSize": 500,
        "separator": "######",
        "chunkOverlap": 50
      },
      "typeVersion": 1
    },
    {
      "id": "6796e1a2-c3a0-404e-972e-8e752a34f92c",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2704,
        1872
      ],
      "parameters": {
        "color": 3,
        "width": 1776,
        "height": 784,
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "c3ea00db-8ee3-4f31-83f0-aa26cf083bab",
      "name": "When chat message received",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        -2784,
        2752
      ],
      "webhookId": "1fd84973-a289-41fb-a542-50ad752bdc14",
      "parameters": {
        "public": true,
        "options": {},
        "initialMessages": "Hi how I can help you."
      },
      "typeVersion": 1.1
    },
    {
      "id": "40130b72-e833-4692-bc16-7e62204832b2",
      "name": "Pinecone Store (Q&A)",
      "type": "@n8n/n8n-nodes-langchain.vectorStorePinecone",
      "position": [
        -1968,
        3232
      ],
      "parameters": {
        "options": {
          "pineconeNamespace": "eirevo"
        },
        "pineconeIndex": {
          "__rl": true,
          "mode": "list",
          "value": "eirevo",
          "cachedResultName": "eirevo"
        }
      },
      "credentials": {
        "pineconeApi": {
          "id": "uo1lZDPNWTsMAeOC",
          "name": "learnby-PineconeApi-account"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "3a2ae554-76f4-4a7c-8c6a-e608c18b4330",
      "name": "Chat Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -2256,
        2752
      ],
      "parameters": {
        "options": {
          "systemMessage": "=You are an AI-powered assistant designed to support customers with **Billing System Upgrades** and related queries for a data services provider.\n\n---\n\n### Tools\n\n** Knowledge Tool**\n\n* Use the provided FAQ knowledge base (stored in Pinecone) as your **primary source of truth**.\n\n** Billing Tool**\n\n* Use this tool to access **customer billing-related information** when needed.\nfind by \"Billing Account\"\n\n---\n\n### Guidelines for Responding\n\n1. **When the knowledge base has a complete answer**\n\n   * Provide the information clearly, concisely, and in a professional yet friendly tone.\n\n2. **When the knowledge base does not contain the answer**\n\n   * Politely let the user know.\n   * Direct them to **[https://www.eirevo.ie/contact-us/](https://www.eirevo.ie/contact-us/)** for further assistance.\n   * Do **not** invent or guess answers. Only rely on verified sources.\n\n3. **If the user’s query is incomplete**\n\n   * Ask for clarification or request the missing context before responding.\n\n4. **User message style**\n\n   * Customers may send messages in fragments. Only respond when:\n\n     * The message ends with punctuation, or\n     * There is silence for more than 5 seconds.\n\n---\n\n### Formatting Rules\n\n* Always be **professional, friendly, and easy to understand**.\n* Provide **only the necessary details**—avoid unnecessary elaboration.\n* Include the contact link **only when no relevant information is available**.\n\n---\n\n### Example Behavior\n\n**Case 1: Answer Found**\n\n* **User:** “How do I upgrade my billing system?”\n* **Chatbot:** “You can upgrade your billing system by logging into the portal, selecting *Billing Settings*, and following the upgrade wizard.”\n\n**Case 2: Answer Not Found**\n\n* **User:** “Can I integrate with a third-party CRM?”\n* **Chatbot:** “I don’t have that information available right now. For further assistance, please visit [our contact page](https://www.eirevo.ie/contact-us/).”\n\n---\n"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "9188796b-01c2-423a-a626-fbcfd9ebc43f",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -2336,
        3248
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini",
          "cachedResultName": "gpt-4o-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "Yj4Rt75fspowAEru",
          "name": "nextweb-openai"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "63f460ed-8cec-437c-9fb6-d4e7a63e103b",
      "name": "Embeddings OpenAI",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "position": [
        -1968,
        3440
      ],
      "parameters": {
        "options": {
          "dimensions": 1536
        }
      },
      "credentials": {
        "openAiApi": {
          "id": "Yj4Rt75fspowAEru",
          "name": "nextweb-openai"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "e44a1ff9-7a33-422a-ba26-cf790f4836bc",
      "name": "Simple Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        -2160,
        2976
      ],
      "parameters": {
        "contextWindowLength": 10
      },
      "typeVersion": 1.3
    },
    {
      "id": "b757b8fb-ba9c-4ab1-aafb-2aea307dd90b",
      "name": "billing-airtable",
      "type": "n8n-nodes-base.airtableTool",
      "position": [
        -1040,
        3120
      ],
      "parameters": {
        "base": {
          "__rl": true,
          "mode": "list",
          "value": "app7MGZeNugq1poRI",
          "cachedResultUrl": "https://airtable.com/app7MGZeNugq1poRI",
          "cachedResultName": "Phone Billing System"
        },
        "table": {
          "__rl": true,
          "mode": "list",
          "value": "tblRlXjQdqLGmiPXR",
          "cachedResultUrl": "https://airtable.com/app7MGZeNugq1poRI/tblRlXjQdqLGmiPXR",
          "cachedResultName": "Payments"
        },
        "options": {},
        "operation": "search",
        "returnAll": false,
        "filterByFormula": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Filter_By_Formula', ``, 'string') }}"
      },
      "credentials": {
        "airtableTokenApi": {
          "id": "qEkCmZ9UDGwuUyvG",
          "name": "learnbyalok-airtable"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "4065d14f-1aa2-4363-995f-d90d41ac0e77",
      "name": "OpenRouter Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        -1440,
        3120
      ],
      "parameters": {
        "model": "openai/o4-mini",
        "options": {}
      },
      "credentials": {
        "openRouterApi": {
          "id": "brVP9oNL9perdfeq",
          "name": "learnby-openrouther"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "813997ef-26ba-4748-817a-8256e30b42a0",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -3088,
        2688
      ],
      "parameters": {
        "color": 4,
        "width": 2368,
        "height": 928,
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "59383996-42dc-4151-8316-22655c35f430",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1248,
        2448
      ],
      "parameters": {
        "width": 304,
        "height": 192,
        "content": "* Adjust chunk size in the **Text Splitter** for website markdown output.\n  * In this example, the **Character Text Splitter with separator `######`** worked really well.  \n  * Always check the **Markdown output** to fine-tune your splitting logic."
      },
      "typeVersion": 1
    },
    {
      "id": "59eacbc5-efb4-4267-a870-5cbaaac8ac9e",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1504,
        3280
      ],
      "parameters": {
        "width": 576,
        "height": 656,
        "content": "## AI Tool Usage  \n### Using a separate tool with a cheaper model for simple use cases  \n\nIn this workflow, we combine different tools and models to balance **cost** and **performance**:  \n\n* **Knowledge Tool** → Uses Pinecone vector search to fetch relevant website/FAQ content.  \n* **Billing Tool** → Queries Airtable for live billing/payment details.  \n* **Cheaper Chat Model (e.g., OpenRouter o4-mini)** → Handles simpler queries (like small talk or direct lookups) at a lower cost.  \n* **Premium Chat Model (e.g., OpenAI GPT-4o-mini)** → Handles more complex reasoning or nuanced customer support.  \n\n---\n\n### Why use this approach?  \n* **Cost optimization** → Simple queries don’t always need the most powerful model.  \n* **Scalability** → Split responsibilities across tools and models for efficiency.  \n* **Flexibility** → You can add/remove tools as business needs change.  \n\n---\n\n### How to customize  \n* Map **specific queries** (e.g., billing-related vs. knowledge lookups) to different tools.  \n* Experiment with **smaller/cheaper models** for lightweight tasks.  \n* Keep **complex reasoning** tasks for more advanced models.  \n"
      },
      "typeVersion": 1
    },
    {
      "id": "bef5b610-b1ab-4064-a999-4348e3c49dfb",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2288,
        2208
      ],
      "parameters": {
        "width": 224,
        "height": 192,
        "content": "Replace the sample website URL in the **HTTP Request** node with your own domain or content source. \n\nFor this template I am using : https://content.eirevo.ie/billing-change-faqs"
      },
      "typeVersion": 1
    },
    {
      "id": "a648f5aa-4629-4192-878e-7c70f2e72b7c",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -912,
        3120
      ],
      "parameters": {
        "width": 320,
        "height": 368,
        "content": "sample airtable record : https://airtable.com/app7MGZeNugq1poRI/shrciMZuk1dao46uo\n\n* Use Airtable table **Payments** with columns:\n\nName, Payment Date, Amount Paid, Payment Method, Payment Confirmation Photo, Invoice, Customer, Billing Account, Notes, Invoice Amount Due, Invoice Status, Payment vs Invoice Difference, Is Full Payment?, Customer Account Status, Payment Summary (AI), Payment Risk Assessment (AI)."
      },
      "typeVersion": 1
    },
    {
      "id": "00cdca07-736d-4a85-ae32-7b6735b387f9",
      "name": "Billing Tool",
      "type": "@n8n/n8n-nodes-langchain.agentTool",
      "position": [
        -1440,
        2880
      ],
      "parameters": {
        "text": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Prompt__User_Message_', ``, 'string') }}",
        "options": {
          "systemMessage": "Use Airtable table Payments with columns:\nName, Payment Date, Amount Paid, Payment Method, Payment Confirmation Photo, Invoice, Customer, Billing Account, Notes, Invoice Amount Due, Invoice Status, Payment vs Invoice Difference, Is Full Payment?, Customer Account Status, Payment Summary (AI), Payment Risk Assessment (AI)."
        },
        "toolDescription": "Call this tool for billing and payment related query"
      },
      "typeVersion": 2.2
    },
    {
      "id": "7881abc5-89fc-43e6-b3dd-5e2024472457",
      "name": "Knowledge Tool",
      "type": "@n8n/n8n-nodes-langchain.toolVectorStore",
      "position": [
        -1952,
        2992
      ],
      "parameters": {
        "description": "This tool is used for knowledge. "
      },
      "typeVersion": 1.1
    },
    {
      "id": "29ab13b8-0932-421a-900a-0d8b426ba5c0",
      "name": "Normalize Text",
      "type": "n8n-nodes-base.code",
      "position": [
        -1616,
        2032
      ],
      "parameters": {
        "mode": "runOnceForEachItem",
        "jsCode": "// Get the input text from the previous node\nconst input = $json.data || $json.text || \"\";\n\n// Remove \"Page X\" markers\nlet text = input.replace(/Page\\s*\\d+/gi, \"\");\n\n// Remove all occurrences of double newlines\ntext = text.replace(/\\n\\n+/g, \" \");\n\n// Remove all occurrences of single newlines\ntext = text.replace(/\\n+/g, \" \");\n\n// Step 5: Trim\ntext = text.trim();\n\n// Output for next node\nreturn { json: { normalizedText: text } };\n"
      },
      "typeVersion": 2
    },
    {
      "id": "94674863-6c4e-43e8-94be-901caf74a4de",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1632,
        1664
      ],
      "parameters": {
        "width": 288,
        "height": 352,
        "content": "## Normalized Content\n\n* Removes noise\n* Reduces duplication\n* Improves retrieval quality \n* Preserves context \n* Consistent format \n* Prevents wasted tokens \n\n**Note : Update the code based in your requirement**"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "52811ce1-6835-41ab-94bd-befcacc0fce8",
  "connections": {
    "Markdown": {
      "main": [
        [
          {
            "node": "Normalize Text",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Billing Tool": {
      "ai_tool": [
        [
          {
            "node": "Chat Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request": {
      "main": [
        [
          {
            "node": "Exctract HTML Body",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "Chat Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Knowledge Tool": {
      "ai_tool": [
        [
          {
            "node": "Chat Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Normalize Text": {
      "main": [
        [
          {
            "node": "Store in Pinecone1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "billing-airtable": {
      "ai_tool": [
        [
          {
            "node": "Billing Tool",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings OpenAI": {
      "ai_embedding": [
        [
          {
            "node": "Pinecone Store (Q&A)",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Chat Agent",
            "type": "ai_languageModel",
            "index": 0
          },
          {
            "node": "Knowledge Tool",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Exctract HTML Body": {
      "main": [
        [
          {
            "node": "Markdown",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Default Data Loader1": {
      "ai_document": [
        [
          {
            "node": "Store in Pinecone1",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    },
    "Generate Embeddings1": {
      "ai_embedding": [
        [
          {
            "node": "Store in Pinecone1",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Pinecone Store (Q&A)": {
      "ai_vectorStore": [
        [
          {
            "node": "Knowledge Tool",
            "type": "ai_vectorStore",
            "index": 0
          }
        ]
      ]
    },
    "OpenRouter Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Billing Tool",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Character Text Splitter": {
      "ai_textSplitter": [
        [
          {
            "node": "Default Data Loader1",
            "type": "ai_textSplitter",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "Chat Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Execute workflow’": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

相关工作流