Customer Query & Response Automation using N8N

Customer Query & Response Automation using N8N

Share this post on:

Objective:
Build a RAG-based Automation workflow using N8N that processes customer queries for the XSound Pro Headphones, and provide responses based on the product document.

Problem Statement:
Organizations often receive a large number of queries from customers, requiring staff to
manually search knowledge bases, draft responses, and maintain records.
This manual process is time-consuming, error-prone, and inconsistent, leading to delays in
customer communication and poor service experience.

To address these challenges, an automated Retrieval-Augmented Generation (RAG) pipeline is required that:

● Instantly captures customer queries.
● Retrieves relevant context from structured/unstructured knowledge sources (retriever component).
● Generates accurate, context-aware answers using AI (generator component).
● Stores the query–answer pair in a structured format for traceability.
● Sends personalized responses without human intervention.

By leveraging N8N for workflow automation, Telegram for capturing queries & sending back responses, Google Sheets for data capture and storage, and AI integrated in a RAG pipeline for retrieval + generation, this project demonstrates how businesses can streamline customer support operations, ground responses in reliable knowledge sources, and deliver faster, more consistent,
and reliable query resolution.

User Scenario:
Consider a customer support team that wants to handle repetitive queries efficiently.
A Telegram Bot is created and shared with customers where they can submit their queries and get the response.
As soon as a customer submits a query:
● A N8N workflow initiates a RAG pipeline:
○ Retriever step: searches uploaded knowledge sources (e.g., company FAQs, policy documents, PDFs) to fetch the most relevant

context.
○ Generator step: an AI model uses this retrieved context to generate a precise,grounded answer.
● The customer query and the generated response is appended into the Google Sheet,
forming a traceable Query–Response pair.
● The customer automatically receives the AI-generated response via Telegram Bot.
This RAG-based no-code workflow ensures that queries are resolved instantly with knowledge-grounded responses, support staff workload is reduced, and customer satisfaction improves through consistent and reliable communication.

Steps to Build the workflow

Step 1: Start Self-hosted N8N instance on GitHub Codespaces
● Go to GitHub and login: https://github.com/
● Access GitHub Codespaces by going to this page: https://github.com/codespaces
● Start a Blank codespace by going to Blank >> Use this template

● Your Codespace should be created.

  • Prerequisite to set up N8N using NPM:
    • You must have Node.js installed. N8N requires a Node.js version between 20.19 and 24.x, inclusive.
  • To check the Node.js version installed on your GitHub Codespace, run the below command:
    • node -v

●To install n8n globally, use the below command:
npm install n8n -g
(This command might take 4-5 minutes to execute.)

●Go to the Ports tab, showing beside the Terminal tab, then forward the port number 5678

● Copy the Forwarded Address to be provided in the .env file. Hover over the Forwarded
Address link, and select the first icon saying “Copy Local Address”

● Create a new file in codespace with name .env and add the below content to it.
Make sure to provide your port’s forwarded address without any additional space or
character.

n8n environment variables

N8N_HOST=0.0.0.0
N8N_PORT=5678
N8N_PROTOCOL=https
WEBHOOK_URL=ADD_YOUR_FORWARDED_ADDRESS_HERE
N8N_EDITOR_BASE_URL=ADD_YOUR_FORWARDED_ADDRESS_HERE

N8N_WEBHOOK_TUNNEL_URL=ADD_YOUR_FORWARDED_ADDRESS_HERE

After that, load the environment variables and start n8n by running the below 2 commands:
source .env
n8n start – login -N8N should be visible.

1, Google Drive Nodes

Create a new folder in your Google Drive, say DOCS_FIle_RAG
● Download the product document from here (Product XSound Pro Headphones.pdf) and
upload it in your Google Drive folder
● Edit the Google Drive File Created node
● Credential to connect with >> Create new credential
● Connect using >> OAuth2
● To get the Client ID and Client Secret follow the steps shown in this video reference
● Once Client ID and Client Secret are added, the button will appear – Sign in with Google
● Once signed in, select your drive folder, do Fetch Text Event
● Add credentials and test the Google Drive File Updated node as well
● Test the Download File From Google Drive node as well


2 Add API key to OpenAI Nodes
● Add your OpenAI API key to below nodes:
○ Embedding OpenAI (text-embedding-3-small; Dimensions=512)
○ OpenAI Chat Model (gpt-4o-mini)

3. Pinecone Vector Store Node
● Access the Pinecone at: https://www.pinecone.io/
● Login
● After login, create an index by going to your Default project >> Database >> Indexes –

Create index
[Note that: With the free Pinecone account only a single index is allowed.]
● Fill details:
○ Index Name: my-product-files
○ Configuration: text-embedding-3-small (Dimension=512)
○ Capacity mode: Serverless
○ Cloud Provider: aws
○ Region: Virginia
○ Click Create index
● To get the API key, go to API keys >> Create API key
● Give a name and generate the key
● Add your Pinecode API key to the Pinecone Vector Store node
● Ensure below field data:
○ Operation Mode: Insert Documents
○ Pinecone index: my-product-files
● Test and Execute the node
● The vectors must be stored on Pinecone

4. Create a Telegram Bot

Go to https://web.telegram.org/k/ and login either by scanning the QR code on your Telegram app, or by providing your cell number. You might need to install the Telegram App on your cell phone.

● Search for BotFather and select it. BotFather is used to create and manage bot accounts.

● Click on Start

● Type /newbot and enter. Then provide details like
○ Name for your bot (example: Customer Support Bot)
○ Username for your bot
(example: Grp18CustomerSupportBot <– change to your group number )

● Once your Telegram bot is ready, you will see the below details:
○ Bot URL
○ API Access Token

● Click on the Bot URL (t.me/GrpXXCustomerSupportBot) and click on Start

● Your Telegram Bot should be ready

5,Telegram Trigger Node

● Edit the Telegram Trigger node
● Add new credentials and paste your Telegram Bot Access Token
● Trigger on: Message
● Click Execute step, then go to the Telegram Bot and enter some text for testing
● It might give the below error message first, but it should execute successfully after few
seconds.

● After successful step execution, pin the data to use the same record to test other nodes

6. Pinecone Vector Store (Retrieval) Node

● Edit the Pinecone Vector Store (Retrieval) node
● Add your Pinecode API key
● Ensure below field data:
○ Operation Mode: Retrieve Documents
○ Pinecone index: my-product-files
● No need to test and Execute the node separately
● Test this node later by Executing the Agent node

7. AI Agent Node
● Edit the AI Agent node
● Review the System Message
“You are a helpful Product Support Assistant designed to answer customer queries based
on XSound Pro Headphones Product documentation.
Retrieve relevant information from the provided internal document and provide a concise,
accurate, and informative answer to the customer’s query.
Use the tool called “company_documents_tool” to retrieve any information from the
product’s document.
If the answer cannot be found in the provided document, respond with “I couldn’t find this
information in the product documentation. Please reach out to
xsound.support@abccompany.com”
Do not invent features or details outside the knowledge base.
If asked about unrelated topics, respond: “I can only answer questions about XSound Pro
Headphones.”

● Test and Execute the node

8. Google Sheet Node

Create a new Google Sheet
○ Name: Product Query Responses
○ Fields:
■ Query: User text message from Telegram Bot
■ Response: AI generated response from AI Agent node

● Edit the Append row in sheet node
● Click on Create new credential
● Add the same Client ID and Client Secret used in the Google Drive nodes
● Complete the fields:

○ Resource: Sheet with Document ○ Operation: Append Row ○ Document: ○ Sheet: ○ Mapping

Column Mode: Map Each Column Manually ○ Map your columns

● Test and Execute the node

9 Send a text message Telegram Node

● Edit the Send a text message Telegram node
● For connection credentials, use the existing one from Telegram Trigger node
● Ensure below field data:

○ Resource: Message ○ Operation: Send Message ○ Chat ID: (Value taken from telegram)

○ Text: (Value from AI agent)

Additional Fields:

■ Append n8n Attribution:(button in switched off state)

● Test and Execute the node

10 .Activate and Test the workflow

● Save and Activate the workflow
● Access your Telegram Bot URL and start asking questions like:

○ What colors are available?
○ What modes of noise cancellation are available?
○ How long does the battery last with ANC on and off?
○ What ANC modes are available?

● Check the Query-Response pairs being added to the Google sheet, and response being
sent to Telegram Bot
● Try it with your cell phone also
● Debug if issue persists

Frequently Asked Questions

What is an n8n RAG workflow used for in customer support?

An n8n RAG (Retrieval-Augmented Generation) workflow automatically captures customer queries, retrieves relevant answers from your product documents, and sends a grounded, accurate response without a human manually searching knowledge bases or drafting replies.

What tools do you need to build this n8n customer support automation?

This workflow uses n8n for automation, a Telegram Bot to capture and send messages, Google Drive to store source documents, Pinecone as the vector database, OpenAI for embeddings and chat generation, and Google Sheets to log every query-response pair.

How does the AI agent avoid making up answers in this n8n workflow?

The AI Agent node is instructed to answer only using content retrieved from the product documentation via the company_documents_tool. If the answer is not in the retrieved document, it responds that it couldnot find the information instead of guessing.

Can this n8n RAG automation work with channels other than Telegram?

This tutorial uses Telegram as the trigger and response channel, but the same RAG pipeline (Pinecone retrieval + OpenAI generation) can be connected to other n8n-supported channels such as WhatsApp, Slack, or a website chat widget with minimal changes.

Do you need to know how to code to build this workflow?

No. This is a no-code RAG automation built entirely with n8n visual workflow nodes. Google Drive, Pinecone, OpenAI, Telegram, and Google Sheets connected together without writing custom code.

Where are customer queries and AI responses stored for tracking?

Every customer query and its AI-generated response are appended as a new row in a connected Google Sheet, creating a traceable, searchable record of every conversation handled by the automation.

Which AI models power this n8n customer query automation?

The workflow uses OpenAI text-embedding-3-small model to convert documents into vectors stored in Pinecone, and gpt-4o-mini to generate the final grounded response to each customer query.

 

Author: Khyati Agrawal

Khyati Agrawal is a Content Writer at Digital AI SEO, covering Agentic AI, automation workflows, and AI-driven SEO strategy.

View all posts by Khyati Agrawal >
Digital AI SEO AssistantAsk about our agentic AI services