Telegram AI Customer Support with Google Docs RAG - n8n Workflow

Build an intelligent 24/7 Telegram customer support bot using an n8n workflow, OpenAI (GPT-4o-mini), and a Google Docs knowledge base for instant Retrieval-Augmented Generation (RAG) responses.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • E-commerce Businesses: Who need round-the-clock support for common product inquiries and order status questions.

  • SaaS Companies: Seeking to automate onboarding guidance and answer FAQs based on live documentation.

  • Automation Developers: Looking for advanced n8n templates integrating Langchain agents, memory, and RAG techniques.

  • Technical Teams: Wanting an internal helpdesk bot that references SOPs stored in Google Docs.

Overview

Managing customer support across multiple channels can be resource-intensive. This robust n8n workflow solves that problem by turning a Telegram bot into a sophisticated AI customer support agent. Unlike basic chatbots, this agent utilizes Retrieval-Augmented Generation (RAG) by referencing a dedicated Google Doc, ensuring all responses are accurate and grounded in your business documentation.

This specific n8n workflow utilizes the powerful Langchain integration, combining the reasoning ability of the gpt-4o-mini model with context retention (Simple Memory) and external knowledge (Google Docs). By using this n8n template, businesses can guarantee consistent, friendly, and immediate support 24 hours a day without writing a single line of code. Every n8n node is configured to maximize efficiency, delivering fast responses directly back to the user via Telegram.

How it Works

The entire process is streamlined through a sequence of interconnected n8n nodes, beginning the moment a user sends a message to your Telegram bot.


  1. Incoming Message: The Telegram n8n trigger is the starting point, listening for new user messages and extracting the chat ID and message text.

  2. AI Processing: The message is passed to the Customer Support AI Agent n8n node. This Langchain agent acts as the brain, receiving instructions to be a 'Helpful Customer Support Agent'.

  3. Knowledge Retrieval (RAG): When processing the query, the AI Agent uses the Google Docs n8n node as a tool to search the specified document for relevant context, ensuring the answer is accurate and based on the provided knowledge base.

  4. Context Maintenance: The Simple Memory n8n node keeps track of previous exchanges within the same chat session (identified by the Telegram chat ID), allowing for human-like, continuous conversations.

  5. Language Generation: The agent leverages the connected OpenAI Chat Model (gpt-4o-mini) to generate a friendly, casual, and helpful response based on the retrieved knowledge and conversational context.

  6. Final Response: The resulting AI output ($json.output) is immediately sent back to the user's chat session using the final Telegram n8n node.

Installation Guide

To deploy this expert n8n workflow, follow these setup steps:


  1. Import: Copy the provided JSON and import it directly into your n8n instance as a new n8n workflow.

  2. Telegram Credentials: You must configure credentials for the Telegram n8n node and the Telegram Trigger n8n trigger. This requires a bot token obtained from BotFather on Telegram.

  3. OpenAI Credentials: Set up your API key within the credentials for the OpenAI Chat Model n8n node.

  4. Google Docs Setup: Ensure the Google Docs n8n node uses a document URL that is publicly accessible or linked to the correct Google Sheets credentials. Update the document URL to point to your specific customer support documentation.

  5. Agent Configuration: Review the System Message within the Customer Support AI Agent n8n node parameters to fine-tune the AI's persona and tone.

  6. Activation: Once all credentials are set and the custom Google Doc link is updated, save and activate the n8n workflow. The Telegram n8n trigger will immediately begin listening for requests.

Node Details

This advanced n8n workflow utilizes several specialized n8n nodes:

Telegram Trigger: This n8n trigger starts the execution flow upon receiving any new message on the configured Telegram bot. Key configuration is listening specifically for updates: [message].
Customer Support AI Agent (Langchain Agent): The central orchestration n8n node. It manages the conversation, decides whether to use the tools (Google Docs) or memory, and sends the prompt to the LLM. The crucial configuration is the detailed System Message defining the agent's role and RAG instructions.
OpenAI Chat Model: Configured to use gpt-4o-mini, providing high-quality, cost-effective language generation capabilities to the agent.
Simple Memory (Buffer Window): A crucial Langchain n8n node that maintains conversational history using the Telegram chat ID as the sessionKey. This allows the AI agent to remember context across multiple messages.
Google Docs Tool: This RAG n8n node fetches the content of the specified Google Doc URL. It serves as the business's knowledge base, which the AI Agent cross-references to generate accurate responses.
Telegram: The final action n8n node, responsible for sending the AI-generated response ($json.output) back to the originating user's chat ID.

Related n8n Workflows

Free

Nodes: 7 Nodes
Updated: December 26 2025
View all
Created by

Automating Start-Up and Business processes. Helping non-techies understand and leverage Agentic AI with easy to understand step-by-step tutorials. Check out my educational content: https://www.youtube.com/@Automatewithmarc

Featured*