Conversational AI Chatbot Agent using Gemini, Google Sheets, and LangChain - n8n Workflow

Create a powerful n8n workflow using Google Gemini (LangChain Agents) to automate chat replies, read Google Docs, and log all conversations directly into Google Sheets. Leverage this robust n8n template for conversational AI.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • Technical content writers and developers building custom AI tools.

  • Businesses needing an automated, context-aware customer service chatbot.

  • Users wanting to log and audit all interactions with their AI agent.

  • Anyone seeking robust n8n templates for advanced LangChain integration.

Overview

This n8n workflow template provides a foundation for building custom, highly functional AI chatbots that go beyond simple Q&A. It solves the critical challenge of integrating advanced conversational AI (using Google Gemini via the LangChain framework) directly into messaging platforms while ensuring perfect persistence and auditing by logging all interactions to Google Sheets. Using a powerful n8n node combination, including the crucial AI Agent n8n node, this n8n template allows the bot to not only answer standard questions but also utilize external resources. The agent can automatically access tools like the Docs n8n node to read Google Docs content or perform live web lookups via the Request n8n node, dramatically increasing the agent’s utility and real-time knowledge base. This complete end-to-end n8n workflow demonstrates best practices for building scalable AI agents.

How it Works

The process is initiated by the Chat message n8n trigger, which is a public webhook that starts the entire n8n workflow upon receiving a message from a connected chat system (like Telegram or Slack). This user input is passed immediately to the central AI Agent n8n node.


  1. AI Processing: The AI Agent n8n node uses the powerful Gemini Chat node as its Language Model. The agent analyzes the user's request and decides whether to invoke any specialized tools connected to it.

  2. Tool Utilization: If the user references a document, the agent can call the Docs n8n node to fetch and simplify the content of a Google Doc. General web searches or API interactions can be handled by the Request n8n node.

  3. Response Generation: The agent generates a contextual, human-friendly response.

  4. Delivery & Logging: The final output from the AI Agent n8n node is executed in two parallel paths. First, the response is delivered back to the user immediately via the Store in Your Chat (Telegram) n8n node. Second, the response is processed by the Crypto n8n node (likely for data manipulation or simple data structure preparation) and then logged into the Store in sheet n8n node, appending the AI reply message and related data to a specified Google Sheet. This comprehensive n8n workflow ensures every user interaction is contextually handled and permanently recorded.

Installation Guide


  1. Import the n8n workflow: Copy the provided JSON data and paste it into your n8n instance using the 'New' -> 'Import from JSON' function.

  2. Configure Credentials: This n8n workflow requires multiple credentials:

- Google Gemini (PaLM) API Key: Configure this for both the Gemini Chat and Gemini tool nodes.
- Google Docs OAuth2: Set up credentials for the Docs n8n node to allow the agent to read documents.
- Google Sheets OAuth2: Set up credentials for the Store in sheet n8n node and specify the target Spreadsheet ID and Sheet Name where conversations will be logged.
- Telegram API: Configure the account for the Store in Your Chat n8n node and set the correct Chat ID for message delivery.

  1. Activate the n8n Trigger: Activate the workflow. The Chat message n8n trigger will generate a public webhook URL. Share this URL with your desired chat platform to start listening for messages.

Node Details

This advanced n8n workflow relies on several specialized nodes:

Chat message (n8n trigger):
Function: The primary n8n trigger, initiating the automation when a new chat message is received on the public webhook endpoint.
Key Configuration: Set up as a public webhook to receive incoming chat messages.
AI Agent (n8n node):
Function: The core orchestration engine. This LangChain n8n node processes user input, leverages the configured tools, and formulates the final AI response.
Key Configuration: Links the Language Model (Gemini Chat) and all available tools (Docs, Request, Gemini).
Gemini Chat (n8n node):
Function: Serves as the large language model (LLM) backend for the AI Agent, providing contextual reasoning and text generation capabilities using the Google Gemini model.
Key Configuration: Requires Google Gemini API credentials.
Docs (Google Docs Tool n8n node):
Function: An optional tool available to the AI agent. When called, it retrieves the content of a specified Google Docs document, enabling the agent to incorporate external document knowledge.
Key Configuration: Uses OAuth2 credentials for Google Docs; input document URL/ID is dynamically supplied by the AI Agent logic.
Store in Your Chat (Telegram n8n node):
Function: Handles the final delivery of the AI-generated reply back to the user via Telegram.
Key Configuration: Requires Telegram API credentials and a valid Chat ID.
Store in sheet (Google Sheets n8n node):
Function: Ensures data persistence by appending the user input and the AI-generated response to a Google Sheet, creating a comprehensive log of the n8n workflow activity.
Key Configuration: Operation set to append; maps replay message and processed data to sheet columns.

Related n8n Workflows

Free

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

I build intelligent systems that automate tasks, streamline workflows, and enhance user experiences using tools like n8n, AI chatbots, and modern automation platforms. With a passion for solving real-world problems through smart technology, I create custom solutions that help individuals and businesses save time, scale faster, and work smarter. Whether it's integrating APIs, building no-code/low-code automations, or developing conversational AI, I'm always exploring the edge of what's possible.

Featured*