Multi-User Telegram Bot for YouTube Summarization with GPT-4o - n8n Workflow

Use this comprehensive n8n workflow to create a multi-user Telegram bot. It automatically fetches YouTube transcripts via RapidAPI and uses GPT-4o to generate dynamic summaries and personalized chat replies. Integrate this powerful n8n template today.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • Content consumers and students who need quick, AI-generated summaries of video content.

  • Developers looking for advanced n8n templates integrating external APIs (RapidAPI) with LLMs.

  • Users needing a persistent, multi-user chatbot solution built on the n8n platform.

  • Anyone seeking a robust n8n workflow demonstrating complex conditional logic and context management.

Overview

This sophisticated n8n workflow establishes a powerful, context-aware Telegram bot capable of two primary functions: standard conversation and automated YouTube video summarization. It solves the challenge of handling multiple users concurrently by using the user's chat ID as a session key for persistent memory, ensuring each conversation remains private and contextual. When a user pastes a YouTube link, the n8n workflow immediately extracts the video ID and uses an HTTP Request n8n node to fetch the raw transcript through RapidAPI. The core intelligence lies within the AI Chat & Summarizer Agent, which uses GPT-4o-mini. This single n8n node handles both the processing of lengthy transcripts for summarization and normal chat queries, making this an extremely versatile n8n template. Finally, a custom Code n8n node ensures the AI output is perfectly cleaned of markdown symbols before being sent back to the user via Telegram.

How it Works

The operation of this n8n workflow begins with the 'Trigger: Telegram Bot Message' n8n trigger, which listens for incoming messages.


  1. Trigger & Check: The workflow starts upon receiving a message. The 'Check: Is YouTube Link?' IF n8n node determines if the message contains a URL.

  2. Transcript Fetch (If Link Found): If a link is detected, the 'Extract Chat & Video ID' n8n node pulls the necessary video ID. The 'Fetch YouTube Transcript (via RapidAPI)' n8n node then retrieves the entire video transcript.

  3. Cleaning: The 'Clean Transcript Symbols' SET n8n node prepares the raw transcript data by joining text segments and replacing HTML escape characters, making the data ready for the LLM.

  4. AI Processing: The flow merges back into the LangChain Agent n8n node, 'AI Chat & Summarizer Agent'. This agent utilizes the 'Simple Memory' n8n node, tied to the user's chat ID, and the 'OpenAI Chat Model' (GPT-4o-mini) to generate a summarized response based on the transcript, or a conversational reply if no link was provided. This unified approach makes the n8n workflow efficient.

  5. Output Cleaning: The 'Clean AI Output Formatting' Code n8n node strips the AI's response of common markdown symbols (like asterisks and backticks) to ensure clean rendering in the Telegram chat.

  6. Reply: The final output is sent back to the user instantly using the 'Send Reply to Telegram' n8n node.

Installation Guide

To set up this powerful n8n workflow, follow these steps:


  1. Import: Download the provided JSON and import it into your self-hosted or cloud n8n instance.

  2. Telegram Credentials: Set up credentials for the Telegram n8n node using a bot token obtained from BotFather.

  3. OpenAI Credentials: Create and configure your OpenAI API Key credentials for the 'OpenAI Chat Model' n8n node.

  4. RapidAPI Configuration: This n8n template relies on a third-party service (RapidAPI, specifically the youtube-transcript3 endpoint) for transcript fetching. You must manually update the Fetch YouTube Transcript (via RapidAPI) HTTP Request n8n node with your personal X-RapidAPI-Key and X-RapidAPI-Host.

  5. Activate: Ensure all credentials are linked correctly to their respective n8n node instances and activate the workflow to set up the webhook for the Telegram n8n trigger.

Node Details


  • Trigger: Telegram Bot Message (n8n trigger): Initiates the entire n8n workflow whenever a new message is posted to the linked Telegram bot.

  • Check: Is YouTube Link? (IF n8n node): Determines the path of the execution flow based on whether the input message contains "https" (indicating a potential link).

  • Fetch YouTube Transcript (via RapidAPI) (HTTP Request n8n node): Critically responsible for integrating external data. It dynamically constructs the URL using the video ID extracted earlier to retrieve the full video transcript.

  • Clean Transcript Symbols (SET n8n node): Pre-processes the API response, joining the fragmented transcript text into a single string and resolving troublesome HTML entities like " and '.

  • Simple Memory (LangChain Memory n8n node): Essential for multi-user support. It uses the chat ID as the session key, allowing the AI agent to retain context across follow-up messages.

  • AI Chat & Summarizer Agent (LangChain Agent n8n node): The core processing unit. It dynamically switches context based on input: summarizing the transcript or engaging in chat, leveraging the memory for continuous conversation. It uses the gpt-4o-mini model within this n8n template.

  • Clean AI Output Formatting (Code n8n node): A vital cleanup step using JavaScript to remove various Markdown formatting characters (like *, , _) generated by the LLM, ensuring the final message delivered via Telegram is visually clean.

  • Send Reply to Telegram (Telegram n8n node): The final action, sending the processed and cleaned AI response back to the user's specific Telegram chat ID.

Related n8n Workflows

Free

Nodes: 10 Nodes
Updated: December 26 2025
View all
Created by

Featured*