Skip to main content

Convert LLM output into rich Telegram messages — Auto-Media & smart chunking

Workflow preview

Workflow preview
100%
Convert LLM output into rich Telegram messages — Auto-Media & smart chunking preview
Open on n8n.io

Important notice

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

1. Workflow Overview

Telegram Rich Output Helper Workflow Who is this for? Builders of Telegram chat‑bots, AI assistants, or notification services who already run n8n and need to convert long, mixed‑media answers from ...

Best for

  • Engineering automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.telegram, n8n-nodes-base.if, n8n-nodes-base.executeworkflowtrigger, n8n-nodes-base.splitinbatches, n8n-nodes-base.splitout, n8n-nodes-base.code, n8n-nodes-base.limit, 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 Dmitry Mikheev.

Original n8n.io source

1.1 Workflow description

Title
Convert LLM output into rich Telegram messages — Auto-Media & smart chunking
Workflow name
Convert LLM output into rich Telegram messages — Auto-Media & smart chunking

Telegram Rich Output Helper Workflow

Who is this for?
Builders of Telegram chat‑bots, AI assistants, or notification services who already run n8n and need to convert long, mixed‑media answers from an LLM (or any upstream source) into Telegram‑friendly messages.

Prerequisites

  1. A Telegram bot created with @BotFather.

  2. The bot’s HTTP API token saved as a Telegram API credential in n8n.

  3. n8n ≥ 1.0 with the built‑in Telegram node still installed.

  4. A parent workflow that calls this one via Execute Workflow and passes:

    • chatId — the destination chat ID (integer).
    • output — a string that can contain plain text and HTTP links to images, audio, or video.

What the workflow does

  1. Extract Links – A JavaScript Code node scans output, deduplicates URLs, and classifies each by file extension.
  2. Link Path
    • If no media links exist, the text path is used.
    • Otherwise, each link is routed through a Switch node that triggers the correct Telegram call (sendPhoto, sendAudio, sendVideo) so users get inline previews or players.
  3. Text Path
    • An IF node checks whether the remaining text exceeds Telegram’s 1 000‑character limit.
    • When it does, a Code node slices the text at line boundaries; SplitInBatches then sends the chunks sequentially so nothing is lost.
  4. All branches converge, keeping the whole exchange inside one execution.

Customisation tips

  • Adjust the character limit – edit the first expression in “If text too long”.
  • Filter/enrich links – extend the regex or add MIME checks before dispatch.
  • Captions & keyboards – populate additionalFields in the three “Send back” nodes.
  • Throughput vs. order – tweak the batch size in both SplitInBatches nodes.

With this template in place, your users receive the complete message, playable media, and zero manual formatting – all within Telegram’s API limits.

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 - Send back an image

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

Block 2 - Send back an audio

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

Block 3 - Send back a video

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

Block 4 - Send Text

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

Block 5 - If text too long

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

Block 6 - When Executed by Another Workflow

Type / Role
n8n-nodes-base.executeWorkflowTrigger - executeWorkflowTrigger
Config choices
Version 1.1

Block 7 - Loop Over Links

Type / Role
n8n-nodes-base.splitInBatches - splitInBatches
Config choices
Version 3

Block 8 - If no links

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

Block 9 - Split Out the Links

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

Block 10 - Split large text by chunks

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

Block 11 - Split Out the Chunks

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

Block 12 - Loop Over Text Chunks

Type / Role
n8n-nodes-base.splitInBatches - splitInBatches
Config choices
Version 3

Block 13 - Send Text Chunk

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

Block 14 - Limit

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

Block 15 - Extract Links

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

Block 16 - Sticky Note

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

Block 17 - Sticky Note1

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

Block 18 - Sticky Note2

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

Block 19 - Check Link Type

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

3. Summary Table

Workflow Convert LLM output into rich Telegram messages — Auto-Media & smart chunking
Complexity advanced
Nodes 19
Categories Engineering
Author Dmitry Mikheev
Published 09 May 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/3961/3961.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 Convert LLM output into rich Telegram messages — Auto-Media & smart chunking do?

Telegram Rich Output Helper Workflow Who is this for? Builders of Telegram chat‑bots, AI assistants, or notification services who already run n8n and need to convert long, mixed‑media answers from ...

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 Engineering use case.