Convert LLM output into rich Telegram messages Auto Media sm
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...
🔌 Nodes & Integrations Used (3)
📖 Implementation & Setup Guide
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**
- A Telegram bot created with **@BotFather**.
- The bot’s HTTP API token saved as a *Telegram API* credential in n8n.
- n8n ≥ 1.0 with the built‑in **Telegram** node still installed.
- 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
- **Extract Links** – A JavaScript Code node scans `output`, deduplicates URLs, and classifies each by file extension.
- **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.
- **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.
- 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.
⚡ How to import this workflow into n8n:
- Click the Direct Download JSON button above to save
Convert_LLM_output_into_rich_Telegram_messages_Auto_Media_sm.json. - Log in to your n8n Cloud or self-hosted n8n instance.
- In your workflow canvas, click the menu in top-right and select Import from File (or paste the JSON directly).
- Configure your credentials (e.g. API keys, database URLs) in the corresponding node settings.
- Click Execute Workflow to test and switch to Active!
Related Messaging & Chat Workflows
View All in Messaging & Chat →Add a bug to Linear via Slack command
Use Case When building a product it's important to discover and eliminate bugs as quickly as possible. Since we're using our product at n8n a lot, we wanted ...
AI Children s Storytelling on Telegram
Production-ready n8n automation template for AI Children s Storytelling on Telegram built by AhiXLight. Seamlessly connects Lm Chat Open Ai, Chain Summarization, Text Splitter Recursive Character Text Splitter with 14 configured nodes.
AI Event Banner Generator with BannerBear
Production-ready n8n automation template for AI Event Banner Generator with BannerBear built by AhiXLight. Seamlessly connects Form Trigger, HTTP Request, Bannerbear with 16 configured nodes.
AI Event Banner Generator with n8n
Production-ready n8n automation template for AI Event Banner Generator with n8n built by AhiXLight. Seamlessly connects Form Trigger, HTTP Request, Bannerbear with 16 configured nodes.