Build a sophisticated, multi-level Telegram bot menu system using this modular n8n workflow. This n8n template uses Function nodes for configuration and routing, offering unparalleled scalability for complex chatbot logic.
Download this n8n workflow template and start using it instantly.
Developing a robust Telegram bot often requires complex, multi-level interactive menus that can respond to both text commands and inline button clicks. Traditional methods can lead to messy, hard-to-maintain flows. This specific n8n workflow solves this by implementing a powerful separation of concerns pattern.
It centralizes the entire menu structureโtext, buttons, and navigation keysโwithin a single 'Load Menu Config' n8n node, making updates extremely simple. When a user interacts, the system routes the request through an 'Action Router' to one of several dedicated 'Handler' n8n nodes. These handlers execute the specific business logic (like updating a database or fetching stats) before seamlessly returning the user to the correct menu state. This architecture ensures a highly scalable and maintainable n8n workflow, leveraging core n8n node functionality for sophisticated, stateful interactions.
The n8n workflow initiates using the Telegram Trigger n8n node, capturing both new messages and button callback queries. The flow immediately splits into two parallel paths:
These two streams merge, and the 'Process Command' n8n node checks if the requested command requires executing any external business logic (like saving a setting or fetching data). If an action is required, the flow proceeds to the 'Action Router' Switch n8n node, which routes the request to the correct 'Handler' (e.g., Rating Handler, Settings Handler). These handler n8n nodes perform the specific task and inject custom data into the workflow item.
Whether an action was performed or not, the flow converges on the 'Build Response' Function n8n node. This essential n8n node dynamically substitutes placeholders in the menu text with user data or custom data generated by the handlers. Finally, the response is formatted and sent back to Telegram via HTTP Request n8n nodes, ensuring that callback queries update the existing message rather than sending a new one, providing a smooth user experience. This robust n8n trigger system ensures quick response times.
[!!! PALCE YOUR BOT TOKEN HERE !!!] with the actual token provided by BotFather.MENU_CONFIG object to define your desired navigation hierarchy, texts, and callback data. The sticky notes in the n8n workflow provide detailed modification examples. Telegram Trigger (n8n trigger): The entry point of this n8n workflow. It initiates the automation upon receiving any Telegram message or inline button callback query.
Load Menu Config (Function n8n node): This is the core configuration n8n node. It contains the MENU_CONFIG JavaScript object, which holds all menu text, HTML formatting, and keyboard arrays, defining the entire multi-level navigation structure.
Extract Command (Function n8n node): Essential for determining the flow, this n8n node parses the incoming Telegram data to identify the specific command (callback data or text command like /start).
Merge Config & Command (Merge n8n node): Combines the menu structure data with the user input data, ensuring all necessary context is available downstream.
Needs Action? (If n8n node): A crucial flow control n8n node that directs the automation. It checks the requiresAction flag set by 'Process Command' to determine if business logic (a 'Handler') must be executed before rendering the menu.
Action Router (Switch n8n node): This dynamic n8n node routes requests based on the command type (e.g., rating, language change) to the appropriate Handler n8n node (0-6) using a complex expression.
Handler Nodes (Function n8n nodes, e.g., Rating Handler, Settings Handler): These nodes simulate business logic execution. They process the specific command, interact with external systems (in a real-world scenario), and return dynamic content via the customData object, which populates the final menu response.
Build Response (Function n8n node): Responsible for final message generation. It dynamically replaces placeholders like {status} or {userName} within the stored menu text using the data collected throughout the n8n workflow.
editMessageText method if the trigger was a callback query, or sendMessage if it was a new message.Create a robust API server using a specialized n8n trigger for AI agents. This n8n workflow provides 14 tool operations to search and download Domain Index data, utilizing dynamic parameters via the n8n node structure.

Deploy a powerful n8n workflow to create a custom AI Data Analyst chatbot. Analyze live Google Sheets data instantly using the OpenAI n8n node and LangChain agents for real-time business intelligence.

Automate your morning routine with this n8n workflow. Combine RSS news, critical Gmail messages, and Todoist tasks into a single, beautifully formatted daily email digest using a custom n8n node.

Use this professional n8n workflow template to build a secure Retrieval-Augmented Generation (RAG) system. Integrate Telegram, Google Gemini, and MongoDB Atlas to create an expert AI learning assistant based strictly on your proprietary documents.

Use this n8n workflow to automatically fetch Google Analytics (GA4) data, perform year-over-year comparison using OpenAI (GPT-4O), and instantly send professional, summarized reports via email and Telegram. Start automating routine data analysis with these powerful n8n templates.


Professional Product Director that cought vibe of Automaion and Solo Programming and Context Aware AI Vibe coding.







































