Ruslan Elishev
Professional Product Director that cought vibe of Automaion and Solo Programming and Context Aware AI Vibe coding.
Templates by Ruslan Elishev
Telegram bot inline keyboard with dynamic menus & rating system
š¤ Telegram Bot with Dynamic Menus & Rating System What It Does This n8n workflow creates an interactive Telegram bot with: Dynamic inline keyboards that respond to user clicks 5-star rating system for collecting feedback Personalized responses using the user's actual name Multi-level menu navigation (Main ā Settings ā Profile, etc.) Real-time message updates when buttons are clicked How It Works Receives messages via Telegram webhook trigger node Extracts user data (name, ID, message type) Builds dynamic menus based on user actions Sends/updates messages with inline keyboards Handles button clicks without page refresh š Setup Instructions Get Your Bot Credentials Configure Workflow Open "Set Bot Token" node Replace token with yours Save and activate workflow (Active) Test Your Bot Message your bot on Telegram Click the buttons to navigate menus Try the rating system on Feature 1 šØ Customization Guide Add New Menu Items In the "Prepare Response" Function node, add new cases: case 'your_feature': responseText = 'Your feature description'; keyboard = [ [{ text: 'šÆ Button 1', callback_data: 'action1' }], [{ text: 'š Back', callback_data: 'main' }] ]; break; Modify Rating Options Change star buttons to numbers or emojis: // Current: āāā // Alternative: 1ļøā£ 2ļøā£ 3ļøā£ or š š Change Bot Responses Edit responseText for message content Modify keyboard arrays for button layout Add HTML formatting: <b>bold</b>, <i>italic</i> š” ++Key Features Demonstrated++ HTTP Request workaround for dynamic keyboards (n8n Telegram node limitation) Callback query handling to prevent loading animations Message editing vs sending new messages User data extraction from Telegram API Switch-case menu routing for scalable navigation ā ļø ++Important Notes++ Limitation: n8n's native Telegram node doesn't support dynamic inline keyboards, this is why need to use HTTP nodes. Solution demonstrated: Use HTTP Request node with Telegram Bot API directly
Create a dynamic Telegram bot menu system with multi-level navigation
š¤ Telegram Bot with Dynamic Multi-Level Menu System What This Workflow Does Ever wanted to build a Telegram bot with professional-looking menus that actually work? This n8n workflow creates an interactive bot with dynamic inline keyboards, multi-level navigation, and smart button routing - all without writing complex code from scratch. The bot features a clean separation between your menu structure and business logic. This means you can change your menus anytime without breaking the underlying functionality. Think of it like WordPress menus but for Telegram bots - you define the navigation, and the workflow handles everything else. Your bot will respond with personalized messages, remember user context, handle button clicks smoothly (no annoying loading spinners!), and route different actions to specialized handlers. Whether users are rating your service, checking their subscription status, or navigating through settings, everything just works. š Getting Started in 3 Minutes Step 1: Get Your Bot Token Head over to Telegram and chat with @BotFather. Create a new bot (or use an existing one) and grab that token. In the workflow, find the purple "Set Bot Token" node and replace [!!! YOURBOTTOKEN_HERE !!!] with your actual token. Step 2: Activate the Magic Save the workflow, click on "Production" tab, and you'll see a webhook URL. Toggle the workflow to Active. That's it - your bot is live! Step 3: See It In Action Message your bot on Telegram. Type /start and watch your beautiful menu appear. Click around, explore the buttons - everything is already set up and working. šØ Making It Yours Want to Add Your Own Menus? Open the workflow and look for the sticky note titled "š COMPLETE GUIDE: ADDING MENUS & ACTIONS". I've written step-by-step instructions right there in the workflow. You'll find exact examples showing how to add a contact menu, subscription status checker, or whatever you need. The beauty is in the simplicity - menus are just text and buttons. No complicated logic mixed in. Check the "š REAL EXAMPLES" sticky note for copy-paste templates you can modify. Need Custom Actions? When a button needs to actually DO something (save data, call an API, send an email), that's where handlers come in. The workflow includes 7 pre-built handlers for common tasks like ratings, language switching, and analytics. Want to add your own? The "š” ADDING HANDLERS" sticky note walks you through it. š” Why This Workflow Is Different Most Telegram bot tutorials have you mixing menu code with business logic, making changes a nightmare. This workflow separates everything cleanly. Your menus live in one place, your logic in another. It's like having a control panel for your bot. The workflow also solves a common n8n limitation - the native Telegram node doesn't support dynamic inline keyboards. Instead of giving up, this workflow uses HTTP requests directly to the Telegram API, giving you full control over every feature. š§ Pro Tips from the Trenches After building dozens of Telegram bots, here's what I've learned: Always include a "Back" button - users panic without an escape route Use emojis in your buttons - they make everything friendlier Test each menu path after changes - one typo can break navigation Keep action handlers focused - one handler, one job Hit a snag? Check the "š TROUBLESHOOTING & TIPS" sticky note in the workflow. I've documented all the common "gotchas" and their fixes. š¦ What's Included This workflow comes with everything you need: Centralized menu configuration system Smart routing that automatically detects which button was pressed 7 ready-to-use action handlers (modify or replace as needed) Parallel processing for lightning-fast responses Built-in error handling with fallback menus Comprehensive documentation right in the workflow via sticky notes š Taking It Further Once you're comfortable with the basics, this architecture scales beautifully. Connect a database to remember user preferences. Integrate with your CRM to pull customer data. Add payment processing for a shopping bot. The modular design means you can enhance one part without touching the others. The workflow sticky notes contain advanced examples for multi-language support, user authentication, and API integrations. Everything is explained in plain English with code examples you can actually use. š¤ One Last Thing This workflow started as a simple dynamic menu with rating workflow and evolved into something much more powerful through community feedback. If you build something cool with it, I'd love to hear about it. And if you get stuck, remember - all the answers are in those sticky notes. I spent way too much time making them ridiculously detailed so you wouldn't have to struggle like I did. Happy bot building! šÆ --- Version: 1.0 - Centralized Menu System with Branching Author: Ruslan Elishev
Add user authorization layer to your Telegram bot with admin alerts
š”ļø BotGuard - Telegram Bot Authorization Layer What This Workflow Does Ever noticed how most Telegram bot tutorials assume everyone can just... use your bot? No questions asked, no protection, nothing. That's fine for a simple "Hello World" bot, but the moment you connect AI APIs, paid services, or sensitive operations - you're in trouble. Anyone who discovers your bot can drain your API credits, overload your systems, or access things they shouldn't. BotGuard fixes this in the simplest way possible: a whitelist. Only User IDs you explicitly allow can interact with your bot. Everyone else gets a polite "access denied" message. Plus, you get instant notifications when someone unauthorized tries to use your bot - complete with their User ID, so you can add them if they're legit. Think of it as a bouncer for your bot. No fancy authentication flows, no databases, no complexity. Just a clean authorization check that sits between the Telegram trigger and your actual workflow. Your expensive AI calls, paid API requests, and sensitive operations stay protected. š Getting Started in 2 Minutes Step 1: Import and Configure Import this workflow into n8n and connect your Telegram bot credentials. You'll see a clean workflow with sticky notes explaining everything. Step 2: Add Your User ID Don't know your Telegram User ID? No problem. Just message your bot - you'll get denied, but the message will show: Your User ID: 123456789. Copy that number. Open the "BotGuard Authorization" node and add yourself: javascript const AllowedUsers = [ { userId: 222222222, userName: 'allowedusername', subscriptionType: 'admin' }, { userId: YOURUSERIDHERE, userName: 'yourusername', subscriptionType: 'premium' } ]; Step 3: Test It Save, activate the workflow, and message your bot again. You're in! Try from another account - denied. Check your admin account for the unauthorized access notification. šØ Making It Yours Want to Change the Messages? All user-facing messages are in the BotGuard Authorization node. Look for these lines: authorizedMessage - What approved users see (default: "ā Authorization Successful...") userMessage - What denied users see (default: "š« Access Denied...") adminMessage - What you receive for each unauthorized attempt Make them friendlier, add your support contact, suggest a /request command - whatever fits your bot's personality. Need Subscription Tiers? The workflow already supports it! Each user has a subscriptionType field (basic/premium/admin). Use this in your main workflow to enable/disable features based on their tier. The BotGuard passes all this data forward in the botGuard object. Want Multiple Admins? Just add more entries to the Administrators array. Every admin receives notifications when unauthorized users attempt access: javascript const Administrators = [ { userId: 111111111, userName: 'adminusername', chatId: 111111111 }, { userId: 333333333, userName: 'your_cofounder', chatId: 333333333 } ]; š” Why This Workflow Exists I built this after watching someone's OpenAI credits get drained in 3 hours because their bot went viral on a Telegram group. No authorization, no rate limiting, nothing. Just a helpful bot that cost them $200 before they noticed. Most tutorials skip authorization entirely - it's not sexy, not what people want to learn. But the moment you deploy something real, you need it. Instead of everyone reinventing the wheel with complex databases and auth systems, here's a simple pattern you can copy-paste into any bot workflow. The multi-admin notification system came from needing to know WHO was trying to access our bots. Sometimes it's legitimate users who found your bot organically. Sometimes it's automated scanners. Either way, if you want to know, now you can. š§ Real-World Tips After protecting dozens of production bots: Do: Keep the User ID list in code for small teams (5-50 users) - it's simple and works Set up admin notifications - you'll catch legitimate users before they give up Include the User ID in denial messages - makes it easy for users to request access Test with an unauthorized account first - make sure the denial flow is clear Don't: Hard-code thousands of users - if you're that big, use a database instead Skip the admin notifications - they're your early warning system Forget to update the placeholder IDs (111111111, etc.) - those won't work! Share your workflow publicly with real User IDs - privacy matters