AI Schedule Assistant for Telegram using Google Sheets - n8n Workflow

Deploy an advanced AI chatbot using this n8n workflow. Connect Google Sheets data via a RAG system to answer schedule questions instantly in Telegram using a custom n8n node.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

Event organizers managing schedules in spreadsheets.
Community managers needing an automated Q&A tool.
Developers looking for advanced Langchain and n8n templates integrating RAG.
Users seeking to deploy an intelligent n8n workflow for live chat support.

Overview

This robust n8n workflow solves the problem of providing instant, intelligent answers to frequently asked questions about an event schedule. Instead of manually answering queries, this system automatically retrieves the latest schedule data from a Google Sheet, converts it into structured context using a custom n8n node, and feeds it into an advanced AI Agent (powered by Langchain and OpenRouter). The resulting AI bot is accessible directly through Telegram, offering a seamless user experience. This powerful n8n automation eliminates manual lookup time and ensures that users always receive information based on the most current data available in your source Google Sheets. This is a perfect example of utilizing custom logic within an n8n workflow to create practical, real-world solutions. You can easily adapt this n8n template for any data source.

How it Works


  1. Trigger and Initialization: The n8n workflow is activated either by a new message received via the telegramInput n8n trigger or internally via the n8nInput chat trigger (for testing). For Telegram inputs, the SendTyping n8n node provides immediate feedback to the user.

  2. Input Normalization: The telegramChatSettings or n8nChatSettings nodes standardize the user's message and chat ID, setting a unified context variable, including the mode (telegram or n8n).

  3. Data Retrieval: The core logic uses the Google Sheets n8n node (Schedule) to fetch the entire schedule document referenced in the Settings n8n node.

  4. Context Formatting: The ScheduleToMarkdown n8n node executes custom JavaScript code, converting the spreadsheet rows into a clean Markdown table format. This structured data is optimal for providing accurate context to the Large Language Model (LLM).

  5. AI Processing: The ScheduleBot Langchain Agent n8n node receives the user query, the context (the Markdown schedule), and leverages the Memory n8n node to recall previous conversation turns. It uses the LLM (configured via OpenRouter) to generate a relevant, informed answer about the schedule.

  6. Response Routing: The generated response is set in the SetResponse n8n node. The Switch n8n node checks the stored mode variable to determine the final destination, routing the n8n workflow appropriately.

  7. Final Delivery: If the mode is 'telegram', the telegramResponse n8n node sends the AI-generated message back to the user's Telegram chat. If the mode is 'n8n', the response is simply displayed via the n8nResponse n8n node (a NoOp).

Installation Guide

To install this n8n workflow template and begin utilizing this powerful automation, follow these steps:


  1. Import the n8n Workflow: Copy the provided JSON data and import it directly into your n8n instance via the Workflows section -> New -> Import from JSON.

  2. Set up Credentials:

Telegram: You will need a Telegram Bot token. Set up the Telegram API credentials within n8n and link them to the telegramInput, SendTyping, and telegramResponse n8n nodes.
Google Sheets: Set up Google Sheets OAuth2 API credentials. Ensure the service account linked to your n8n account has read access to the Google Sheet containing your schedule. Link these credentials to the Schedule n8n node.
* OpenRouter/LLM: Configure the OpenRouter API credentials (or switch the LLM n8n node to use OpenAI or another supported model) to provide the AI processing power.

  1. Configure Schedule URL: In the Settings n8n node, update the scheduleURL variable with the public or private sharing URL of your Google Sheets schedule.

  2. Activate: Ensure the n8n workflow is active. Test the flow by sending a message to your configured Telegram bot or by running a test chat through the n8nInput trigger.

Node Details

Telegram Trigger (telegramInput): The starting point for the live chat, serving as the primary n8n trigger. It listens for incoming messages from Telegram users.
Google Sheets (Schedule): Reads all relevant schedule data from the specific Google Sheets document URL defined upstream. Essential for feeding current data into the n8n workflow.
Code (ScheduleToMarkdown): A custom n8n node that uses JavaScript to transform the raw spreadsheet data items into a structured Markdown table string, perfect for context insertion into the LLM system message.
Agent (ScheduleBot): The core AI engine. This Langchain Agent n8n node integrates the user query, the schedule context, and chat history (via the Memory n8n node) to generate intelligent responses. Its system message is dynamically populated with the Google Sheets data.
Memory (Buffer Window Memory): An n8n node that maintains conversation continuity, using the Telegram chat ID (chatId) as the session identifier.
LM Chat (LLM) (OpenRouter): Specifies the large language model used for processing the queries. Configured here via OpenRouter credentials.
Set (SetResponse): Formats the output from the AI agent into a standardized variable (responseMessage) before routing.
Switch: Determines whether the final response should be sent back to Telegram or kept within the n8n environment for testing, routing the n8n workflow appropriately.


  • Telegram (telegramResponse): The final action n8n node that sends the AI's generated response back to the user on Telegram. This is the ultimate output of this powerful n8n workflow.

Related n8n Workflows

Free

Nodes: 12 Nodes
Updated: December 26 2025
View all
Created by
Daniel Nolde
Daniel Nolde

Featured*