Skip to main content

Automate Telegram message processing - separate text and files πŸ’¬πŸ“

Workflow preview

Workflow preview
100%
Automate Telegram message processing - separate text and files πŸ’¬πŸ“ preview
Open on n8n.io

Important notice

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

1. Workflow Overview

Introduction Tired of manually downloading a file through different Telegram messages? This workflow acts as a smart receptionist for your Telegram bot, automatically processing incoming messages t...

Best for

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

Tools used

n8n-nodes-base.telegramtrigger, n8n-nodes-base.set, n8n-nodes-base.switch, n8n-nodes-base.splitout, n8n-nodes-base.telegram, n8n-nodes-base.noop, n8n-nodes-base.stickynote

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by EoCi - Mr.Eo.

Original n8n.io source

1.1 Workflow description

Title
Automate Telegram message processing - separate text and files πŸ’¬πŸ“
Workflow name
Automate Telegram message processing - separate text and files πŸ’¬πŸ“

Introduction

Tired of manually downloading a file through different Telegram messages? This workflow acts as a smart receptionist for your Telegram bot, automatically processing incoming messages to cleanly separate text from file attachments, getting them ready for any automation you can dream up! πŸ“₯


🎯 What This Does

This workflow solves the challenge of handling varied Telegram messages within a single automation workflow. Incoming messages can be just text, just a file, or a file with a caption. This template intelligently identifies the message type and routes it down the correct path, isolating the text content and downloading the file attachment. It's perfect for community managers, support teams, or anyone building a Telegram-powered chatbot.


πŸ”„ How It Works

  1. Listens for New Messages: The workflow starts the moment a new message is sent to your connected Telegram bot.
  2. Checks Message Content: A Switch node instantly determines if the message contains:
    • Text only
    • Attachment only
    • Attachment with a message (text caption)
  3. Separates Message and File: Based on the content, the workflow isolates the text (from the message or caption) and the file's metadata (file_id, file_name).
  4. Downloads the Attachment: For any message containing a file, the workflow automatically downloads it, making the binary data available for the next steps in your automation.

🧩 Nodes Used

  • Telegram Trigger
  • Telegram
  • Switch
  • Set
  • Split Out
  • No Operation - NoOp (as a placeholder for your next steps)

πŸš€ Setup Requirements

  • Credentials: You'll need a Telegram Bot API Token (Key) and Chat ID.
  • Accounts: A Telegram account.
  • Setup Time: Less than 5 minutes.

Set up steps

  1. Create a Telegram Bot:
    • First, you need a bot. Open Telegram and send a message to the official @BotFather.
    • Send the command /newbot.
    • Follow the prompts to choose a name and username for your bot.
    • BotFather will provide you with a unique API Token. Copy this token, it's what you'll need for the next step.
  2. Add Credentials to n8n:
    • In your n8n workflow, navigate to the Credentials section in the left panel.
    • Click Add credential, search for "Telegram," and select it.
    • Paste the API Token you copied from BotFather into the Access Token field.
    • Click Save to create your credential.
  3. Connect Your Bot to the Workflow:
    • Back on the canvas, open the Waiting For Message (Telegram Trigger) node.
    • In the Credential for Telegram API dropdown, select the credential you just created.
    • Open the Get & Download Attachment (Telegram) node and select the same credential.
  4. Activate and Test!
    • Click the Activate toggle in the top right corner of your screen.
    • Now, send a few different messages to your new bot on Telegram to test all the paths:
      • A simple text message (e.g., "Hello!").
      • A file (like a PDF or Notepad) with no text.
      • A file with a caption(message).
    • You can check the Executions tab in n8n to see each test run successfully! The NoOp nodes at the end of each path show you the final, cleanly separated data.

πŸ’Ž Benefits / Why It Matters

This template provides a robust and reliable foundation for any Telegram automation. By neatly separating text from files, you can seamlessly connect Telegram to any other service whether you're archiving documents to Google Drive, analyzing feedback with Gemini, or logging support requests in a database. It saves development time and ensures your automations run smoothly

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 - Waiting For Message

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

Block 2 - Get Chat Message Only

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 3 - Switch

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

Block 4 - Split Out

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

Block 5 - Get Attachment Only

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 6 - Get & Download Attachment

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

Block 7 - Get Attachment

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 8 - Next Step !

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

Block 9 - Next Step !

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

Block 10 - Next Step !

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

Block 11 - Get Chat Message Content

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 12 - Sticky Note3

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

Block 13 - Sticky Note

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

Block 14 - Sticky Note1

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

Block 15 - Sticky Note2

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

Block 16 - Sticky Note4

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

Block 17 - Sticky Note5

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

3. Summary Table

Workflow Automate Telegram message processing - separate text and files πŸ’¬πŸ“
Complexity advanced
Nodes 17
Categories Support Chatbot, AI Chatbot
Author EoCi - Mr.Eo
Published 03 Oct 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/9254/9254.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 Automate Telegram message processing - separate text and files πŸ’¬πŸ“ do?

Introduction Tired of manually downloading a file through different Telegram messages? This workflow acts as a smart receptionist for your Telegram bot, automatically processing incoming messages t...

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, AI Chatbot use case.