Build a Telegram Bot with n8n: Automate Messages, Commands & Replies [2026]

Create a fully automated Telegram bot using n8n. Handles incoming messages, slash commands, file sending, and AI responses — step-by-step with examples.
telegramTrigger
telegram
switch
+5
Workflow Identifier: 2082
NODES in Use: telegramTrigger, set, telegram, stickyNote, switch, if, googleSheets, executeWorkflow
Automate Telegram bot with n8n and telegram

Press CTRL+F5 if the workflow didn't load.

Learn how to Build this Workflow with AI:

What This Automation Does

This workflow listens to all kinds of messages and actions sent to a Telegram bot.
It sorts them by type, such as texts, photos, voice notes, files, commands, payments, and group joins.
The main problem solved is saving time and preventing mistakes by processing everything automatically.
The result is faster replies and accurate status tracking for users and payments.


How the Workflow Works: Input → Process → Output

Inputs

  • Telegram updates: Messages, files, callback queries, payments, and membership events.

Processing Steps

  • A Telegram Trigger node receives all updates.
  • A Set node prepares data.
  • A main Switch node sorts input into categories: Message, Callback, System, Payment.
  • Within Message, another Switch finds if it is text, photo, file, or voice.
  • An IF node checks if text is a command starting with a slash.
  • A command Switch directs known commands to workflows; unknown commands get a fallback reply.
  • System inputs check for new member events; if found, an Execute Workflow updates Google Sheets to register the user.
  • Payment data triggers payment-related workflows after tagging action identifiers.

Outputs

  • Replies sent back to Telegram chats confirming message types.
  • Google Sheets updated with user status.
  • Triggered workflows handle payments and invoices.

Tools and Services Used

  • n8n platform: For building and running automation workflows.
  • Telegram Bot API: Receives user messages and sends responses.
  • Google Sheets API: Stores and updates user info and payment status.

Who Should Use This Workflow

This workflow fits community managers handling large Telegram groups.
It helps with automatic message sorting, fast replies, user membership tracking, and payment processing.
Anyone needing to reduce manual tasks and improve Telegram chat management will find it useful.


Beginner Step-by-Step: How to Use This Workflow in Production

Import Workflow

  1. Download the workflow file using the Download button on this page.
  2. In the n8n editor, click the top-left menu and choose “Import from File”.
  3. Select the downloaded workflow file to load it.

Configure Credentials

  1. Add Telegram Bot API credentials in n8n’s credentials manager.
  2. Set up Google Sheets OAuth credentials with write permissions.

Update IDs & Parameters

  1. Edit any IDs, emails, Google Sheet names, or folder references in nodes if required.
  2. Make sure the Telegram webhook URL is properly set in the Telegram Bot settings.

Test Workflow

  1. Send test messages to the Telegram bot: texts, photos, or commands like /pay.
  2. Check if replies come back correctly.
  3. Verify Google Sheets update on membership changes.

Activate Workflow

  1. Turn the workflow on by toggling it in n8n editor to run live.
  2. Monitor executions in the n8n UI for any errors.
  3. Optionally consider self-host n8n for better control and privacy.

Customizations

  • Add new command words in the existing command Switch node for more bot features.
  • Change texts sent back in Telegram send nodes to match preferred wording.
  • Extend the Google Sheets schema to track more user fields like subscription or last active date.
  • Add new message types like video in the message type Switch for broader media support.
  • Connect more sub-workflows for registrations, payments, or special events.

Troubleshooting

  • Webhook not triggering: Check correct webhook URL and Telegram permissions.
  • Google Sheets update issues: Confirm sheet name, ID, and OAuth access rights.
  • Commands ignored: Ensure commands start with slash and IF node conditions are right.

Pre-Production Checklist

  • Verify Telegram API credentials and webhook setup.
  • Confirm Google Sheets OAuth is authorized.
  • Test each message type and feedback response.
  • Simulate members joining/leaving to check sheet updates.
  • Try payment commands and verify workflows trigger.

Deployment Guide

Activate the workflow on the n8n editor to start.

Use execution logs to watch for errors.

Monitor Telegram bot dashboard for webhook hits.

Regularly check Google Sheets for correct user data.

Summary

✓ Automates sorting of Telegram messages by type and command.

✓ Tracks user memberships and payment events in Google Sheets.

✓ Saves hours by removing manual message handling.

✓ Sends quick, clear replies to users based on their input.

→ You get a more responsive Telegram bot and cleaner community management.

→ Payment processing and user registration happen without delay.


Automate Telegram bot with n8n and telegram

Visit through Desktop to Interact with the Workflow.

Frequently Asked Questions

The Telegram Trigger node listens to all incoming Telegram updates including messages, payments, and member status changes to start the workflow.
After import, add Telegram API credentials, configure Google Sheets API credentials, update any IDs or sheet names, then test the workflow before activating.
Payment commands such as /pay are detected in the command Switch node and trigger dedicated payment workflows automatically.
System nodes detect member status changes and invoke a registration workflow that updates the Google Sheets with the new user’s status.

Promoted by BULDRR AI

Related Workflows

Automate Twist Channel Creation and Messaging with n8n

This workflow automates creating and updating a channel in Twist and sending a personalized message to specific users. It eliminates manual setup errors and saves time managing Twist communications.

Automate Ideogram Image Generation with Google Sheets & Gmail

This workflow automates graphic design image generation via Ideogram AI, storing image data in Google Sheets and Google Drive, with email alerts via Gmail. It saves designers hours by automating image creation, remixing, review, and record-keeping.

Automate IT Support with Slack and OpenAI in n8n

Streamline IT support by automating Slack message handling using n8n and OpenAI. This workflow handles Slack DMs, filters bots, queries a Confluence knowledge base, and delivers AI-generated responses, improving support efficiency and response time.

Automate Crypto Analysis with CoinMarketCap & n8n AI Agent

Discover how this unique n8n workflow leverages CoinMarketCap’s multi-agent AI to deliver precise, real-time cryptocurrency insights directly via Telegram. Manage crypto data analysis efficiently with automated multi-source API integration.

Automate Gumroad to Beehiiv Subscriber Sync with n8n

Learn how to automatically add new Gumroad sales customers as Beehiiv newsletter subscribers using n8n automation. This workflow saves time by syncing sales data to Google Sheets CRM and notifying your Telegram channel instantly.

Generate On-Brand Blog Articles Using n8n and OpenAI

This workflow automates the creation of on-brand blog articles by analyzing existing company content using n8n and OpenAI. It extracts article structures and brand voice to produce consistent draft articles, saving significant content creation time.
1:1 Free Strategy Session
Your competitors are already automating. Are you still paying for it manually?

Do you want to adopt AI Automation?

Every hour your team does repetitive work, you're burning real money.
While you wait, faster businesses are cutting costs and moving quicker.
AI and automations aren't the future anymore — they're the present.

Book a live 1-on-1 session where we show you exactly which of your daily tasks can be automated — and what it’s costing you not to.