A personal Telegram bot that instantly summarizes YouTube videos using n8n workflow automation, Azure OpenAI, and a custom Flask API—with built-in authentication for cost control.
Requirements
Users should be able to:
- Send YouTube links to a Telegram bot and receive AI-powered summaries
- Get concise 3-5 point summaries of video content without watching
- Benefit from authentication that ensures only authorized users can access the bot
- Handle various YouTube URL formats (youtube.com, youtu.be, embeds, etc.)
- Receive summaries powered by Azure OpenAI
Built with
Project Highlights
- Automated Workflow: Orchestrates multiple services using n8n's visual workflow builder for seamless integration
- AI-Powered Summaries: Leverages Azure OpenAI GPT-4o-mini to generate intelligent, concise summaries from video transcripts
- Custom Transcript API: Flask-based API using yt-dlp for reliable YouTube transcript extraction, containerized with Docker
- Authentication System: Chat ID-based authentication prevents unauthorized access and controls API costs
- Docker Networking: Services communicate through Docker's internal networking without exposing unnecessary ports
- URL Format Handling: Robust regex-based extraction supports all common YouTube URL patterns
- Cost Efficient: Self-hosted solution with pay-per-use AI costs, controlled by authentication
Architecture
The system consists of four main components:
- Telegram Bot: User interface for sending YouTube links and receiving summaries
- n8n Workflow: Central orchestration connecting Telegram, transcript API, and Azure OpenAI
- YouTube Transcript API: Custom Flask API extracting video transcripts with yt-dlp
- Azure OpenAI: GPT-4o-mini model generating 3-5 point summaries from transcripts
The workflow validates authentication, extracts video IDs, fetches transcripts, generates AI summaries, and delivers results—all in seconds.
Key Features
- Personal Authentication: Ensures only authorized Telegram chat IDs can trigger the workflow
- Multi-Format Support: Handles youtube.com, youtu.be, embed URLs, and more
- Cookie-Based Extraction: Bypasses YouTube's bot detection by mounting browser cookies into Docker
- Error Handling: Graceful handling of missing transcripts, API failures, and invalid URLs
- Real-Time Responses: Instant feedback via Telegram with formatted summary results



