Skip to main content

Telegram bot with menu-driven commands

Workflow preview

Workflow preview
100%
Telegram bot with menu-driven commands preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

This template provides a structured way to build Telegram bots that respond to specific commands and handle user input. It allows users to interact with your bot by selecting options from a Telegra...

Best for

  • Support Chatbot automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.telegramtrigger, n8n-nodes-base.switch, n8n-nodes-base.code, n8n-nodes-base.if, n8n-nodes-base.telegram, n8n-nodes-base.stickynote, n8n-nodes-base.noop

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Daniel Jimenez.

Original n8n.io source

1.1 Workflow description

Title
Telegram bot with menu-driven commands
Workflow name
Telegram bot with menu-driven commands

This template provides a structured way to build Telegram bots that respond to specific commands and handle user input. It allows users to interact with your bot by selecting options from a Telegram bot menu, without needing to type out full instructions or rely on conversational AI. This approach offers precise control and predictable behavior for command-driven interactions.

Key Features:

  • πŸ€– Structured Command Handling: Unlike approaches that rely on conversational AI (like the "AI Agent" node), this template provides a deterministic way to handle specific commands triggered by users selecting options from a Telegram bot menu. Users do not need to write out full instructions.
  • βž• Command-Based Interaction (Extensible): Ready to process three commands (/command1, /command2, /command3), and easily extensible to support additional commands.
  • 🚦 Clear Command Routing: Employs Switch nodes to efficiently route execution based on both the initial command and the current conversation state.
  • πŸ’¬ Content Requesting: Prompts the user to provide content after a command is received. This is handled by dedicated Telegram nodes.
  • πŸ› οΈ Easy Customization: Includes placeholder (No Operation, do nothing) nodes where you can easily insert your own custom processing logic for each command.

Why This Template is Unique:

n8n currently lacks a native, built-in mechanism for handling individual Telegram commands in a structured, non-conversational way. Many users resort to "AI Agent" nodes, which are designed for open-ended conversations. This template fills that gap by providing a framework for:

  • βœ… Predefined Commands: Users interact with your bot through a menu of predefined commands, eliminating the need for complex natural language processing.
  • 🧠 Deterministic Behavior: The workflow's response is predictable and directly tied to the selected command, unlike AI-driven approaches where responses can be less consistent.
  • πŸ–±οΈ Simplified Interaction: Users simply click a button in the Telegram menu, making the interaction intuitive and user-friendly.

How to Use:

  1. Initialization (One-Time): Execute the "Temp to Initiate Static Data" node once to create the necessary telegramStates object in the workflow's static data. This is crucial for state management.
  2. Customize Processing Logic: Replace the NoOp nodes (Command1 processing, Command2 processing, Command3 processing) with your own nodes to handle the content received for each command. It is highly recommended to add input validation within your processing logic.
  3. Telegram Credentials: Configure the Telegram Trigger and Telegram nodes with your bot's API token.

Example Use Case:

This template is ideal for creating bots that require a command followed by specific input, such as:

  • πŸ“Š Data Collection: A command to initiate a form, followed by a request for the data.
  • πŸ› οΈ Service Requests: A command to request a service, followed by a request for details.
  • πŸ“š Interactive Tutorials: A command to start a tutorial, followed by a request of completion.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Telegram Trigger

Type / Role
n8n-nodes-base.telegramTrigger - telegramTrigger
Config choices
Version 1

Block 2 - Switch (Command Routing)

Type / Role
n8n-nodes-base.switch - switch
Config choices
Version 3.2

Block 3 - Temp to Initiate Static Data

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 4 - Check State

Type / Role
n8n-nodes-base.switch - switch
Config choices
Version 3.2

Block 5 - Clear State

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 6 - Set waitingForContent1

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 7 - Set waitingForContent2

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 8 - Prepare IF Value

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 9 - Command Check

Type / Role
n8n-nodes-base.if - if
Config choices
Version 1

Block 10 - Set waitingForContent3

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 11 - Send Typing action

Type / Role
n8n-nodes-base.telegram - telegram
Config choices
Version 1.2

Block 12 - Command1 content request

Type / Role
n8n-nodes-base.telegram - telegram
Config choices
Version 1

Block 13 - Command2 content request

Type / Role
n8n-nodes-base.telegram - telegram
Config choices
Version 1

Block 14 - Command3 content request

Type / Role
n8n-nodes-base.telegram - telegram
Config choices
Version 1

Block 15 - No Command check

Type / Role
n8n-nodes-base.telegram - telegram
Config choices
Version 1

Block 16 - Sticky Note5

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 17 - Command1 result

Type / Role
n8n-nodes-base.telegram - telegram
Config choices
Version 1

Block 18 - Command2 result

Type / Role
n8n-nodes-base.telegram - telegram
Config choices
Version 1

Block 19 - Command3 result

Type / Role
n8n-nodes-base.telegram - telegram
Config choices
Version 1

Block 20 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 21 - Sticky Note6

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 22 - Command1 processing

Type / Role
n8n-nodes-base.noOp - noOp
Config choices
Version 1

Block 23 - Command2 processing

Type / Role
n8n-nodes-base.noOp - noOp
Config choices
Version 1

Block 24 - Command3 processing

Type / Role
n8n-nodes-base.noOp - noOp
Config choices
Version 1

Showing the first 24 of 25 workflow blocks. Download the JSON for the full node graph.

3. Summary Table

Workflow Telegram bot with menu-driven commands
Complexity advanced
Nodes 25
Categories Support Chatbot
Author Daniel Jimenez
Published 01 Mar 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/3055/3055.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Telegram bot with menu-driven commands do?

This template provides a structured way to build Telegram bots that respond to specific commands and handle user input. It allows users to interact with your bot by selecting options from a Telegra...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Support Chatbot use case.