Back to Templates

Poll KIE.ai video generation status and send results via Telegram

Created by

Created by: JoeVenner || joevenner

JoeVenner

Last update

Last update 11 hours ago

Share


Must Read First

🎥 DEMO: https://www.youtube.com/watch?v=5ZE7mBozaZ4

This workflow is the polling webhook used by the main Telegram AI Shorts Generator workflow published here:
https://creators.n8n.io/workflows/12682

It is responsible for handling long-running AI video generation tasks, including polling Veo, Sora, and Seedance APIs, waiting between attempts, detecting completion or failure, retrieving the final video, and returning the result back to the main workflow for preview, publishing, or extension. Separating this logic into a dedicated webhook keeps the main workflow fast, reliable, and production-ready.

🔁 What this workflow does

This workflow is a dedicated polling webhook designed to handle long-running AI video generation jobs for Veo, Sora, and Seedance when using n8n.

It is intended to be used as a companion workflow to a main video generation workflow (for example, a Telegram-based AI Shorts generator).

The webhook repeatedly checks the status of an AI video task, waits between attempts, and continues polling until the video is either completed, failed, or times out.

⚙️ How it works

  1. Receives a POST webhook call with:
    • session ID
    • task ID
    • model type (Veo or Market models)
    • polling attempt number
  2. Immediately responds 200 OK to avoid blocking the calling workflow
  3. Waits 1 minute between polls to respect API limits
  4. Calls the appropriate KIE.ai status endpoint depending on model type:
    • Veo record-info endpoint
    • Market job status endpoint (Sora / Seedance)
  5. Parses multiple response formats to reliably extract:
    • generation status
    • final video URL (supports several API variations)

📥 When a video is ready

Once generation is complete, the workflow automatically:

•	Downloads the final video
•	Uploads it to S3-compatible storage
•	Restores the original session from Redis
•	Merges video data with session metadata
•	Sends a Telegram video preview with publishing options
•	Supports video extension workflows (Veo only)

• Saves detailed generation metadata alongside the video

🔄 Retry & timeout handling

•	Polls up to 15 attempts (≈15 minutes total)
•	Gracefully handles:
•	API failures
•	missing URLs
•	unexpected response formats
•	Notifies the user on timeout with task details

🧠 Why this workflow is useful

•	Keeps main workflows fast and responsive
•	Handles async AI jobs without blocking executions
•	Centralizes polling logic for multiple AI providers
•	Makes long-running video generation production-ready
•	Cleanly separates orchestration from user interaction

🧩 Designed to work with

•	Telegram AI video bots
•	YouTube Shorts automation workflows
•	AI content farms
•	Multi-model video pipelines
•	Any workflow using Veo, Sora, or Seedance APIs

⚠️ Important notes

•	This workflow is not standalone
•	It must be triggered by another workflow via HTTP Request
•	Requires shared Redis and S3 configuration with the parent workflow

🛠️ Requirements

You will need credentials for:

•	KIE.ai API
•	Redis
•	S3-compatible storage
•	Telegram Bot API (for previews)

⸻ Tags

webhook
ai-video
polling
long-running-jobs
content-automation
telegram
youtube
redis
s3
async