Telegram Bot Dynamic Inline Menu & Rating System - n8n Workflow

Deploy an advanced Telegram bot using this n8n workflow template. Implement dynamic inline keyboards, multi-level navigation, and a 5-star feature rating system using custom n8n nodes and HTTP requests.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • Technical users needing a powerful, stateful Telegram bot.

  • Developers looking for advanced n8n templates demonstrating dynamic keyboard generation.

  • Businesses requiring interactive user feedback and rating systems via Telegram.

  • n8n specialists who need examples of replacing native n8n nodes with direct HTTP API calls for complex functionality.

Overview

Building highly interactive chat interfaces, such as those with multi-level inline keyboards and feedback forms, often pushes the limits of standard integration tools. This specialized n8n workflow solves this by utilizing custom code and direct Telegram API calls to overcome the limitations of the standard Telegram n8n node, enabling truly dynamic interactivity.

This n8n template provides a complete framework for handling both new messages and button click events (callback queries) within a single flow. It includes logic for personalized greetings, dynamic menu switching (e.g., Settings, Features, Stats), and a fully functional 1-5 star feature rating mechanism, all managed seamlessly within the core Function n8n node. This approach makes scaling your bot logic easy and efficient using n8n.

How it Works

The entire flow of this advanced n8n workflow is initiated by the TG Trigger node, which serves as the primary n8n trigger, listening for both standard messages (like '/start') and user interactions via inline button clicks (callbackquery).


  1. Trigger & Data Reception: The Telegram Trigger n8n node captures the event and passes the data to the Prepare Magic Response Function n8n node.

  2. Dynamic Menu Logic: This Function n8n node acts as the brain of the system. It analyzes whether the input is a new message or a callback query. It extracts the user's name for personalization and uses conditional logic (a large switch statement) based on the input text or callbackdata (e.g., 'rate_5', 'feature1') to construct a customized text response and the corresponding JSON structure for the next inline keyboard.

  3. Token Injection: The Set Bot Token API KEY n8n node ensures the necessary Telegram Bot token is appended to the data stream.

  4. Flow Routing: The Is CALLBACK? If n8n node checks the isCallback flag generated by the Function n8n node. If TRUE (a button was clicked), the flow proceeds down the branch designed to edit the existing message. If FALSE (a new message was sent), it proceeds to send a brand new message.

  5. API Interaction (Message Handling): The Send to Telegram API HTTP Request n8n node executes the core communication. It dynamically switches between the sendMessage and editMessageText Telegram API methods based on the apiMethod property determined in the Function n8n node, sending the dynamically generated inline keyboard.

  6. Callback Acknowledgment: Crucially, if the interaction was a button click (TRUE branch), the Answer Callback HTTP Request n8n node runs immediately after the message is updated. This secondary n8n node sends a quick acknowledgment to Telegram to dismiss the 'loading' state on the user's client, providing a smooth user experience within this complex n8n workflow.

Installation Guide

To utilize this powerful n8n workflow template, follow these steps:


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

  2. Set Telegram Credentials: In the TG Trigger node, configure your Telegram API Credentials. You must link the webhook ID to your bot via BotFather.

  3. Insert Bot Token: Open the Set Bot Token API KEY n8n node. Replace the placeholder text with your actual Telegram bot token (obtained from @BotFather).

  4. Activate HTTP Request Credentials: Since this n8n template uses HTTP Request n8n nodes for API calls, no dedicated credentials are required for those nodes, but ensure your n8n instance has external access to the Telegram API endpoints.

  5. Testing: Once credentials are set and the n8n workflow is active (toggle ON), message your Telegram bot to trigger the dynamic menu.

Node Details

TG Trigger node (Telegram Trigger): The starting n8n trigger point. Configured to listen for both message (new command/text) and callbackquery (button clicks) events.
Prepare Magic Response (Function node): This is the custom code that contains the entire dynamic menu structure, including multi-level navigation logic, name extraction, and the 1-5 star rating system. It sets the appropriate apiMethod (sendMessage or editMessageText) and constructs the full Telegram API request body with the inline
keyboard structure.
Set Bot Token API KEY (Set node): Centralizes the Telegram API key (botToken) so it can be easily accessed by downstream HTTP Request n8n nodes for constructing the API URLs.
Is CALLBACK? (If node): A flow control n8n node that routes the execution based on whether the input event was a button press (isCallback = TRUE) or a new text message (isCallback = FALSE).
Send to Telegram API (HTTP Request node): This n8n node executes the main task of sending the dynamic message/keyboard. The URL is dynamically built using the botToken and the required apiMethod (sendMessage or editMessageText).
Answer Callback (HTTP Request node): A critical n8n node in the TRUE branch. It sends an API call using the callbackqueryid to acknowledge the button click, which stops the loading indicator in the user's Telegram client.

Related n8n Workflows

Free

Nodes: 6 Nodes
Updated: December 26 2025
View all
Created by
Ruslan Elishev
Ruslan Elishev

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

Featured*