n8n Q&A Telegram Bot with Human-in-the-Loop


2 August 2026

This n8n project is a human-in-the loop Telegram bot which routes questions to a Telegram group in the event the bot cannot answer them directly from its knowledge base in Google Sheets. The human can provide the answer to the new question and the new question and answer is inserted into the Google Sheets knowledge base. In a way, the bot has learned the new Q&A.

Workflow

The workflow is triggered when someone asks a question to the Telegram bot. The question would be passed to the AI agent for processing, referencing the Google Sheets for answers, and generating a response using the configured Large Language Model (LLM). If the bot is able to find an answer from the Google Sheets knowledge base, it responds directly; otherwise, it routes the question to Telegram group for assistance. The Telegram group has two members; the human and the bot.

The human would proceed to reply to the question, which would trigger another workflow execution in n8n to return the human response and update the Google Sheets knowledge base accordingly. The new question and answer stored in Google Sheets is 'learned' by the bot as it doesn't have to redirect the same question back to the human in the Telegram group.

Chatbot overview
Workflow overview of the chatbot and how messages flow through the n8n workflow

Normal workflow where the bot can answer directly from Google Sheets

When the answer can be found directly in Google Sheets, the bot responds to the user without involving the human in the Telegram group. This ensures a seamless and efficient interaction for questions that the bot can handle autonomously.

AI agent
Normal workflow where the bot can answer directly from Google Sheets.

Human-in-the-loop workflow

Now it gets interesting when the answer is not found in Google Sheets. In this case, it routes to the 'Escalate to Staff' Telegram node, which notifies the human staff in the Telegram group for resolution. The staff would provide the answer by replying to the question. The reply would trigger the Telegram workflow again, this time traversing the bottom workflow. n8n is able to route it to the bottom workflow as the 'Route by Chat Type' routes by checking whether the trigger is coming from a group or a direct message.

Bot response
Question that cannot be answered directly by the bot
Telegram output
Question is routed to Telegram group for human staff resolution

Bot response
Reply by the human in Telegram group
Telegram output
Reply by the bot back to the person who asked the question

n8n is able to route it to the bottom workflow as the 'Route by Chat Type' routes by checking whether the trigger is coming from a group or a direct message.

Chatbot overview
Routing by chat type configuration

Learning capacity

It would not be an intelligent workflow if the bot routes a question which has already been answered to the human staff again. So after providing reply, n8n would store the new question and its answer in Google Sheets. In a way, it has 'learned' from the interaction.

Bot response
Configuration for storing learned Q&A in Google Sheets
Telegram output
Stored in Google Sheets

When a previously asked question is repeated by another user, the bot can directly provide the answer from the stored Q&A in Google Sheets, without involving human staff again.

Trigger creds
Direct answer without involving human staff again.


This is a simple Human-in-the-Loop (HITL) system that demonstrates how human intervention can be integrated into automated workflows to improve the accuracy and reliability of AI-driven responses. It is important to emphasise in the AI agent's system prompt that it should not hallucinate. The routing in 'Can Answer' node is configured such that it outputs a keyword 'ESCALATE', which would route to the 'Escalate to Staff' Telegram n8n node. Overall, it was a good learning on both n8n and Telegram. It is up to our creativity on what we wish to automate. Most of the time, it can be done.