GeminiCreativeWritingAI score · PendingAI-assisted edit · no obvious prompt-injection riskn8n.io

n8n AI Telegram Bot: Smart Assistant & Content Summarizer

Turn Telegram messages into input, route commands to article summarization or image generation branches, and return results via Telegram

Some experienceStepsWorkflowPrompt
Who
Teams, content creators, and researchers who need quick article summaries or image prompts inside Telegram
You get
Deploy a 24/7 Telegram bot supporting /help, /summary <URL>, and /img <prompt> commands
You need
n8n · telegram

Constraints

Prerequisites: n8n Cloud or self-hosted instance; Telegram Bot Token from @BotFather (free); OpenAI API key (pay-per-use). Import n8n template 4457 into your workspace, configure credentials and parameters per node, save and activate the workflow. Telegram users trigger the bot by sending commands.

What they did

Author yaron-nofluff published template 4457 on n8n, building a Telegram bot workflow. The workflow listens for messages via Telegram Trigger, routes commands with If nodes, calls HTTP Request to fetch articles, extracts text with HTML node, generates 10-12 bullet summaries via OpenAI, and returns results; for /img it calls OpenAI image resource and sends an acknowledgment; for /help it returns instructions.

How it went

The source describes 24/7 operation with multi-user concurrency, producing professional bullet-point summaries (author-reported, unverified). Template page shows 29,183 total views.

Worth knowing

The Summarizer node's modelId is empty in the template and must be manually selected after import (e.g., gpt-4o). The Fetcher node depends on link_preview_options.url from Telegram messages; fetching may fail if link preview is absent. The Image Generator node only sets resource=image without full parameters shown; the Image Acknowledger explicitly states Gemini does not return images directly, requiring additional configuration with APIs like Stability. OpenAI API is pay-per-use; Telegram Bot is free. This site has not imported or run this workflow.

n8n workflow template

Structure checked · Not run-tested

Use “Import from File” in n8n, or copy the JSON and paste it into the editor. Connect your own accounts, then try test data. The template is inactive by default.

Setup and test checklist

Credentials to connect

  • After import, connect your own credentials on auth-required nodes; author secrets are not included.

Configuration to replace

  • Source template is n8n public workflow #4457 (~24 nodes). Keep inactive after import; verify triggers, expressions and external API endpoints.
  • Sticky-note guidance is informational; replace placeholders with your own accounts, sheet schemas or channel IDs.

Test input and expected output

  • Manually run the main path once in a test workspace and confirm credentialed nodes authenticate without errors.
  • Drive one synthetic/redacted sample through and check output fields and downstream writes before enabling in production.

Template changes

  • Author credential bindings, webhookId and execution data are removed; the workflow is inactive. Nodes, connections and original prompts are preserved. Not run-tested in n8n.
  • No business-logic edits; verify keys, quotas and privacy compliance before use.

Template retrieved: 2026-10-24

Steps

  1. Prepare credentials and n8n environment

    Ensure you have access to an n8n instance (Cloud or self-hosted). Contact @BotFather in Telegram to create a bot and obtain the Bot Token. Get your OpenAI API key from the OpenAI platform.

  2. Import the workflow template

    In n8n, open Templates, search for ID 4457 or title 'AI Telegram bot agent', then click Use this workflow to import it into your workspace.

  3. Configure Telegram Trigger (Listener)

    Locate the Listener node (Telegram Trigger). Select or create Telegram credentials and enter the Bot Token. Confirm Updates includes 'message'. Saving automatically registers the webhook.

  4. Configure Command Router

    Locate the Command Router node (If node). Check the condition: message.text startsWith '/help'. If true, route to Help Responder; if false, proceed to Summary Checker.

  5. Configure Help Responder

    Locate the Help Responder node (Telegram node). Confirm it uses the same Telegram credentials. This node sends a Markdown-formatted help menu.

    Execution prompt · Source text。Help Responder node text parameter

    🤖 *Help Menu*
    
    Use `/summary <link>` to summarize an article.
    Use `/img <prompt>` to generate an image.
    
    _Example:_
    /summary https://example.com
    /img a futuristic cityscape
  6. Configure summary check and fetch (Summary Checker → Fetcher → Text Extractor)

    Summary Checker (If node) checks if message.text startsWith '/summary'. The true branch goes to Fetcher (HTTP Request node), which retrieves webpage HTML from the Telegram message's link_preview_options.url with User-Agent: Mozilla/5.0. Then Text Extractor (HTML node) extracts body content using cssSelector=body and skipSelectors=svg,a.

  7. Configure AI summarizer (Summarizer)

    Summarizer is an OpenAI node (typeVersion=1.8). You must manually select a model in modelId (currently empty). The messages field contains the system prompt with injected article text.

    Execution prompt · Source text。Summarizer node messages.values[0].content parameter

    =Summarize the entire content provided below into 10–12 concise bullet points. Ensure each point captures a unique and important aspect of the information, covering the core ideas, key facts, major findings, and essential takeaways. Avoid repetition and use clear, professional language suitable for quick understanding by a decision-maker.
    
    Content:
     {{ $json.text }}
  8. Configure summary sender (Summary Sender)

    Summary Sender (Telegram node) returns the Summarizer output to the user. The text field references candidates[0].content.parts[0].text from Summarizer; chatId references Listener's message.chat.id.

    Execution prompt · Source text。Summary Sender node text parameter (expression)

    ={{$json["candidates"][0]["content"]["parts"][0]["text"]}}
  9. Configure image command branch (Image Prompt Checker → Image Generator → Image Acknowledger)

    Image Prompt Checker (If node) checks if message.text startsWith '/img'. The true branch goes to Image Generator (OpenAI node, resource=image), which submits the prompt to an image generation API. Then Image Acknowledger (Telegram node) sends a confirmation message. Note: In this template, the Gemini image model does not return image URLs directly; actual image generation requires additional configuration with APIs like Stability.

    Execution prompt · Source text。Image Acknowledger node text parameter

    🖼️ Generated image prompt submitted! Gemini image model doesn't return images directly. Use image generation APIs like Stability for actual image URLs.

Prompt you can copy

Setup guidance · Editorial suggestion。Give to setup assistant; confirm inputs and permissions first

This block is the prompt. Ads are never placed here.

Build a Telegram AI bot in n8n using the following materials:
1. Prepare Telegram Bot Token (@BotFather) and OpenAI API key;
2. Import template 4457;
3. Configure Listener trigger, Command Router, and Help Responder;
4. Configure summary branch: Summary Checker → Fetcher (HTTP Request, url=$json.message.link_preview_options.url) → Text Extractor (HTML, body) → Summarizer (OpenAI, select model, enter prompt) → Summary Sender;
5. Configure image branch: Image Prompt Checker → Image Generator (OpenAI resource=image) → Image Acknowledger;
6. Save and activate the workflow, then test /help, /summary <URL>, and /img <prompt> in Telegram.

Before building, confirm you have an n8n instance, Telegram Bot Token, and OpenAI API key; the Summarizer node requires manual model selection.

Source

AI Telegram bot agent: smart assistant & content summarizer · yaron-nofluff · n8n.io · 2025-05-28

Comments & feedback

Tried this method? Share results, problems or improvements. Comments appear after moderation. Please avoid sensitive information.

Loading…

    Related