Templates / πŸ”„ Async Video Polling Engine - Background Job Handler for AI Video Generation

πŸ”„ Async Video Polling Engine - Background Job Handler for AI Video Generation

Ready for 3.0

by Joe V βœ“ Β· 220 views Β· created 2026-01-13 Β· Content Creation, Multimodal AI

Ready for 3.0. This template uses no nodes that n8n 3.0 removes. No removed nodes, versions or helpers found. Static check, last run 2026-10-19.

Nodes used (10)

RedisS3Telegram

What it does

πŸ”„ AI Video Polling Engine - Long-Running Job Handler for Veo, Sora & Seedance The async backbone that makes AI video generation production-ready ⚑🎬 !LinkedIn!Telegram --- πŸŽ₯ See It In Action !Watch the Demo πŸ”— Full Demo: youtu.be/OIoJ2F1O0 --- ⚠️ Must Read First This is a companion workflow for the main AI Shorts Generator: πŸ”— Main Workflow: AI Shorts Reactor This workflow handles the "waiting game" so your main bot stays fast and responsive. Think of it as the backstage crew that handles the heavy lifting while your main workflow performs on stage. --- πŸ€” The Problem This Solves Without This Workflow: User sends message ↓ Bot calls AI API ↓ ⏳ Bot waits 2-5 minutes... (BLOCKED) ↓ ❌ Timeout errors ❌ Execution limits exceeded ❌ Users think bot is broken ❌ Can't handle multiple requests With This Workflow: User sends message ↓ Bot calls AI API ↓ βœ… Bot responds instantly: "Video generating..." ↓ πŸ”„ This webhook polls in background ↓ ⚑ Main bot handles other users ↓ βœ… Video ready β†’ Auto-sends to user Result: Your bot feels instant, scales infinitely, and never times out πŸš€ --- πŸ” What This Workflow Does This is a dedicated polling webhook that acts as the async job handler for AI video generation. It's the invisible worker that: 1️⃣ Receives the Job json POST /webhook/poll-video { "sessionId": "user123", "taskId": "veoabc456", "model": "veo3", "attempt": 1 } 2️⃣ Responds Instantly 200 OK - "Polling started" (Main workflow never waits!) 3️⃣ Polls in Background Wait 60s β†’ Check status β†’ Repeat - ⏱️ Waits 1 minute between checks (API-friendly) - πŸ”„ Polls up to 15 times (~15 minutes max) - 🎯 Supports Veo, Sora, and Seedance APIs 4️⃣ Detects Completion Handles multiple API response formats: javascript // Veo format { status: "completed", videoUrl: "https://..." } // Market format (Sora/Seedance) { job: { status: "success", result: { url: "..." } } } // Legacy format { data: { videourl: "..." } } (No matter how the API responds, this workflow figures it out) 5️⃣ Delivers the Video Once ready: - πŸ“₯ Downloads video from AI provider - ☁️ Uploads to your S3 storage - πŸ’Ύ Restores user session from Redis - πŸ“± Sends Telegram preview with buttons - πŸ”„ Enables video extension (Veo only) - πŸ“Š Logs metadata for analytics --- βš™οΈ Technical Architecture The Flow: Main Workflow Polling Webhook β”‚ β”‚ β”œβ”€β”€Trigger AI Job─────────── β”‚ "Task ID: abc123" β”‚ β”‚ β”‚ β”œβ”€β”€Return Instantly β”‚ β”‚ "Generating..." β”‚ β”‚ β”‚ β”œβ”€β”€Handle New User β”‚ β”‚ β”œβ”€β”€Wait 60s β”‚ β”‚ β”‚ β”œβ”€β”€Check Status β”‚ β”‚ "Processing..." β”‚ β”‚ β”‚ β”œβ”€β”€Wait 60s β”‚ β”‚ β”‚ β”œβ”€β”€Check Status β”‚ β”‚ "Completed!" β”‚ β”‚ β”‚ β”œβ”€β”€Download Video β”‚ β”‚ β”‚ β”œβ”€β”€Upload to S3 β”‚ β”‚ β”‚ └──Send to User β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ "Your video is ready!" --- πŸš€ Key Features ⚑ Non-Blocking Architecture - Main workflow never waits - Handle unlimited concurrent jobs - Each user gets instant responses πŸ”„ Intelligent Polling - Respects API rate limits (60s intervals) - Auto-retries on transient failures - Graceful timeout handling (15 attempts max) 🎯 Multi-Provider Support Handles different API formats: - Veo - record-info endpoint - Sora - Market job status - Seedance - Market job status πŸ›‘οΈ Robust Error Handling javascript βœ… Missing video URL β†’ Retry with fallback parsers βœ… API timeout β†’ Continue polling βœ… Invalid response β†’ Parse alternative formats βœ… Max attempts reached β†’ Notify user gracefully πŸ’Ύ Session Management - Stores state in Redis - Restores full context when video is ready - Supports video extension workflows - Maintains user preferences πŸ“Š Production Features - Detailed logging at each step - Metadata tracking (generation time, model used, etc.) - S3 storage integration - Telegram notifications - Analytics-ready data structure --- 🧩 Integration Points Works Seamlessly With: | Use Case | How It Helps | |----------|--------------| | πŸ€– Telegram Bots | Keeps bot responsive during 2-5 min video generation | | πŸ“Ί YouTube Automation | Polls video, then triggers auto-publish | | 🎬 Multi-Video Pipelines | Handles 10+ videos simultaneously |

View the original on n8n.io β†’ Check your own copy

Get the weekly β€œwhat broke” email

New templates, newly broken ones, and n8n release changes. One short email a week.

Form not loading? Subscribe here.