AutomationFlowsSlack & Telegram › Telegram Bot with Menu-driven Commands

Telegram Bot with Menu-driven Commands

ByDaniel Jimenez @ldaniel-jmz on n8n.io

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…

Event trigger★★★★☆ complexity25 nodesTelegram TriggerTelegram
Slack & Telegram Trigger: Event Nodes: 25 Complexity: ★★★★☆ Added:

This workflow corresponds to n8n.io template #3055 — we link there as the canonical source.

This workflow follows the Telegram → Telegram Trigger recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "id": "eEmBseW5YPdHz35S",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "AA - Telegram bot 3 commands (for template)",
  "tags": [],
  "nodes": [
    {
      "id": "b45285b7-5d2e-4f87-b796-b4db51416dcb",
      "name": "Telegram Trigger",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -460,
        200
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "bcdab8f6-7844-45b9-a4b1-6c7b4e7db34e",
      "name": "Switch (Command Routing)",
      "type": "n8n-nodes-base.switch",
      "position": [
        -40,
        160
      ],
      "parameters": {},
      "typeVersion": 3.2
    },
    {
      "id": "f355edc9-07f7-409f-9f03-6d2895b49a53",
      "name": "Temp to Initiate Static Data",
      "type": "n8n-nodes-base.code",
      "notes": "You only need to run the initialization step once per workflow, regardless of the number of Telegram chat IDs. The initialization creates the telegramStates object within the global static data of the workflow. Once that object exists, the workflow will use it to store the state for any chat ID.",
      "position": [
        -460,
        -300
      ],
      "parameters": {},
      "notesInFlow": false,
      "typeVersion": 2
    },
    {
      "id": "c99b639e-d184-481d-9871-7dd4416836d2",
      "name": "Check State",
      "type": "n8n-nodes-base.switch",
      "position": [
        -20,
        880
      ],
      "parameters": {},
      "typeVersion": 3.2
    },
    {
      "id": "a9d01dd0-0927-4c58-9866-1230af22e965",
      "name": "Clear State",
      "type": "n8n-nodes-base.code",
      "position": [
        920,
        760
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "6389f680-fa93-4e8f-95ff-0e21f11af087",
      "name": "Set waitingForContent1",
      "type": "n8n-nodes-base.code",
      "position": [
        240,
        -340
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "549abb7a-c688-4cc1-91e1-cb34d13b9700",
      "name": "Set waitingForContent2",
      "type": "n8n-nodes-base.code",
      "position": [
        240,
        -120
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "d2f98541-2150-4472-8ae8-f698257a8258",
      "name": "Prepare IF Value",
      "type": "n8n-nodes-base.code",
      "position": [
        -180,
        900
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "ae7a40ca-55eb-478d-8bde-c23cfdf3d85e",
      "name": "Command Check",
      "type": "n8n-nodes-base.if",
      "position": [
        -240,
        200
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "aa197f22-5a55-4883-a852-bed4f0919baa",
      "name": "Set waitingForContent3",
      "type": "n8n-nodes-base.code",
      "position": [
        240,
        100
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "7c5803ba-f704-4664-983e-6534742d9c4a",
      "name": "Send Typing action",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -240,
        -60
      ],
      "parameters": {},
      "typeVersion": 1.2
    },
    {
      "id": "7c32f9b4-b9ae-48e3-aede-c8c304167c43",
      "name": "Command1 content request",
      "type": "n8n-nodes-base.telegram",
      "position": [
        500,
        -340
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "b09fdfed-e95c-4e0e-ae34-cbecf552585c",
      "name": "Command2 content request",
      "type": "n8n-nodes-base.telegram",
      "position": [
        500,
        -120
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "d402d0e1-2afb-4c10-95af-4db1058e6036",
      "name": "Command3 content request",
      "type": "n8n-nodes-base.telegram",
      "position": [
        500,
        100
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "ffac12bc-ec49-474d-ac4b-6a401433cad3",
      "name": "No Command check",
      "type": "n8n-nodes-base.telegram",
      "position": [
        240,
        1280
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "81dd8b62-e5fb-487e-86dd-f69a72dd261c",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        160,
        400
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "3ec1c4cc-c9e0-4c4e-b56c-e733bc853270",
      "name": "Command1 result",
      "type": "n8n-nodes-base.telegram",
      "position": [
        520,
        500
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "1b9114f0-e7ee-43fa-ba9d-536429f926e2",
      "name": "Command2 result",
      "type": "n8n-nodes-base.telegram",
      "position": [
        520,
        760
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "f5c30793-59fc-4070-91cb-5ca20aeb2431",
      "name": "Command3 result",
      "type": "n8n-nodes-base.telegram",
      "position": [
        520,
        1020
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "c8bab9d3-f159-44a1-868b-d194e4c05c7e",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -560,
        -580
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "2e3ee128-2c7c-4662-bf2e-6ba518743feb",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        160,
        -440
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "bef8cc55-9f19-47d2-826b-41512c90964e",
      "name": "Command1 processing",
      "type": "n8n-nodes-base.noOp",
      "position": [
        240,
        500
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "9b766ceb-dfd1-47b5-a9f8-148fbd79d1d2",
      "name": "Command2 processing",
      "type": "n8n-nodes-base.noOp",
      "position": [
        240,
        760
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "40902676-eb28-46a7-bad4-c11075979c5d",
      "name": "Command3 processing",
      "type": "n8n-nodes-base.noOp",
      "position": [
        240,
        1020
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "42462e2d-8536-4509-a2aa-851f40ae6c1e",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        160,
        1480
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "aa1ed21d-c431-4866-ac73-9f21d69a28cf",
  "connections": {
    "Check State": {
      "main": [
        [
          {
            "node": "Command1 processing",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Command2 processing",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Command3 processing",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "No Command check",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Command Check": {
      "main": [
        [
          {
            "node": "Switch (Command Routing)",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Prepare IF Value",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Command1 result": {
      "main": [
        [
          {
            "node": "Clear State",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Command2 result": {
      "main": [
        [
          {
            "node": "Clear State",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Command3 result": {
      "main": [
        [
          {
            "node": "Clear State",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare IF Value": {
      "main": [
        [
          {
            "node": "Check State",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "Command Check",
            "type": "main",
            "index": 0
          },
          {
            "node": "Send Typing action",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Command1 processing": {
      "main": [
        [
          {
            "node": "Command1 result",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Command2 processing": {
      "main": [
        [
          {
            "node": "Command2 result",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Command3 processing": {
      "main": [
        [
          {
            "node": "Command3 result",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set waitingForContent1": {
      "main": [
        [
          {
            "node": "Command1 content request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set waitingForContent2": {
      "main": [
        [
          {
            "node": "Command2 content request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set waitingForContent3": {
      "main": [
        [
          {
            "node": "Command3 content request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Command2 content request": {
      "main": [
        []
      ]
    },
    "Switch (Command Routing)": {
      "main": [
        [
          {
            "node": "Set waitingForContent1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Set waitingForContent2",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Set waitingForContent3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

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…

Source: https://n8n.io/workflows/3055/ — original creator credit. Request a take-down →

More Slack & Telegram workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

Slack & Telegram

This workflow contains community nodes that are only compatible with the self-hosted version of n8n.

Telegram Trigger, n8n, Telegram +4
Slack & Telegram

This template is ideal for users managing Telegram channels who want to automate the process of posting messages, including text and images, directly from an bot.

Telegram Trigger, Postgres, Telegram
Slack & Telegram

This template is for developers and automation specialists looking to create a Telegram bot that enables users to select items from a predefined list and save their choices to a Postgres database.

Telegram, Postgres, Telegram Trigger
Slack & Telegram

This workflow is for Telegram bot developers or marketers who want to verify user subscriptions to specific Telegram channels and optionally reward them with downloadable files.

Telegram, Postgres, Google Drive +1
Slack & Telegram

This workflow is ideal for businesses or individuals who want to run Telegram-based giveaways that require users to subscribe to certain channels in order to participate.

Telegram, Postgres, Telegram Trigger