Chapter 12: Image-to-Video Workflow with Google Drive and Telegram Integration¶
Video: Watch this chapter on YouTube (2:25:12)
Overview¶
This chapter builds a sophisticated image-to-video workflow that combines multiple triggers and integrations. When an image is uploaded to Google Drive, a Telegram notification is sent asking for video instructions. The user's response triggers video generation from the uploaded image.
Detailed Summary¶
Workflow Architecture (Dual Trigger)¶
This workflow has two distinct trigger paths in one worksheet:
Path 1: Image Upload Flow
Path 2: Video Generation Flow
Telegram Trigger → Video Prompt Agent → Seedance POST → Wait → GET → If Loop → Telegram (send video)
Multi-Input Requirements¶
Image-to-video generation needs two inputs: 1. Base Image: The starting point for the video 2. Video Prompt: Description of desired video motion/action
Telegram serves as the communication hub for both inputs.
Part 1: Image Upload Detection¶
Step 1: Google Drive Trigger¶
- Add Google Drive trigger node
- Select "Watch for changes in a folder"
- Choose your target folder (e.g., "Image to Video CodeCloud")
- Watch for: "File created"
- Test by uploading an image to the folder
Important: Make sure the folder/file is publicly accessible (or has proper sharing settings).
Key output: webContentLink - public URL to the uploaded image
Step 2: Telegram Bot Setup¶
Creating the Bot¶
- Open Telegram
- Search for BotFather (verify blue checkmark)
- Start conversation:
/start - Create new bot:
/newbot - Enter bot name (e.g., "n8n Test Demo 1")
- Enter bot username (must end in "bot")
- Copy the API token provided
Connecting to n8n¶
- Add Telegram node (not trigger)
- Operation: Send Photo
- Create new credential:
- Paste API token
- Click Save
- Chat ID: Will be configured from trigger
Step 3: Getting Chat ID¶
- Add Telegram Trigger node (separate trigger)
- Select "On message"
- Execute step (listening mode)
- Send a message to your bot in Telegram
- Check n8n for captured message
- Copy the
chat.idvalue
Use this chat ID for all Telegram nodes in the workflow.
Step 4: Configure Photo Notification¶
- In Telegram send photo node:
- Chat ID: Paste the chat ID (can be hardcoded)
- Photo: Drag
webContentLinkfrom Google Drive - Caption: "You've uploaded this photo to the Google folder. Kindly provide the video idea you want to generate from this image."
Step 5: Log Image to Google Sheets¶
- Add Google Sheets node
- Operation: Append Row
- Select your logging spreadsheet
- Map fields:
- Image URL: Drag
webContentLink - Date: Drag
$nowvariable
This creates a log of uploaded images for the video generation path to reference.
Part 2: Video Generation Flow¶
Step 1: Configure Telegram Response Handler¶
Use Telegram node with "Send message and wait for response":
- Chat ID: Same as before
- Message: "Could you provide the video idea you want to generate from this image?"
- Response type: Free text
This pauses the workflow until the user responds.
Step 2: Video Prompt Agent¶
- Add OpenAI node (Message Model)
- User prompt: Drag
textfrom Telegram response - System prompt: Video prompt engineer instructions
- Add Google Sheets tool to fetch latest image URL
System Prompt Configuration¶
Your tasks:
1. Create an effective video prompt for a video generation model based on user input
2. Output two JSON objects:
- "prompt": The generated video prompt (string)
- "image_url": Fetch from last row of attached Google Sheets log tool
Enable "Output content as JSON" in node options.
Step 3: Seedance POST Request¶
- Add HTTP Request node
- Go to WaveSpeed → Models → Filter "image-to-video"
- Select "Seedance V1"
- Copy and import cURL
Body Configuration¶
{
"prompt": "{{ $json.prompt }}",
"image_url": "{{ $json.image_url }}",
"duration": 5,
"aspect_ratio": "16:9"
}
Step 4: Wait and Poll Pattern¶
Same as previous chapters:
1. Wait 15 seconds
2. GET request with request ID
3. If node checking status == completed
4. False branch: Wait 15s → Loop back to GET
Step 5: Telegram Video Delivery¶
Instead of Gmail, send video via Telegram:
- Add Telegram node
- Operation: Send Video
- Chat ID: From trigger or hardcoded
- Video: Drag output URL from If node
Complete Dual-Trigger Architecture¶
[Google Drive Trigger] [Telegram Trigger]
↓ ↓
[Telegram: Send Photo] [Telegram: Wait for response]
↓ ↓
[Google Sheets: Log] [Video Prompt Agent + Sheets Tool]
↓ ↓
[Execute [Seedance POST]
Subworkflow] ←--optional--→ ↓
[Wait 15s]
↓
[GET Request]
↓
[If: completed?]
├── True → [Telegram: Send Video]
└── False → [Wait] → Loop
Best Practice: Split into Subworkflows¶
The chapter notes that having two triggers in one workflow can complicate troubleshooting. Consider:
- Workflow 1: Image upload → Notification → Log
- Workflow 2: Message trigger → Video generation → Delivery
Use Execute Subworkflow node to connect them.
End-to-End Testing¶
- Upload image to Google Drive folder
- Receive Telegram notification with image
- Reply with video idea
- Wait for video generation
- Receive video in Telegram
Alternative Configurations¶
- Replace Seedance with VO3, Kling, or other models
- Use Gmail instead of Telegram for delivery
- Add Slack notifications
- Store videos in Google Drive instead of sending links
Key Takeaways¶
-
Multi-trigger workflows are possible: Two separate trigger paths can coexist in one workflow.
-
Telegram enables interactive workflows: Send-and-wait creates conversational automation.
-
Google Sheets as a bridge: Log data in sheets, then retrieve in another path using tools.
-
BotFather creates Telegram bots: Simple setup for custom automation bots.
-
Chat ID is essential: Every Telegram operation needs the correct chat ID.
-
Image-to-video needs both inputs: Base image + motion description.
-
JSON output mode helps: When multiple values needed, output as structured JSON.
-
Consider splitting workflows: Dual triggers can be separated for easier maintenance.
-
Publicly accessible images required: Video APIs need accessible image URLs.
-
Same polling pattern applies: POST → Wait → GET → Check → Loop or deliver.
Conclusion¶
The image-to-video workflow showcases n8n's ability to orchestrate complex, multi-step processes across multiple services. By combining Google Drive for image intake, Telegram for user interaction, Google Sheets for data persistence, and WaveSpeed for video generation, the workflow demonstrates enterprise-level automation patterns. The dual-trigger architecture, while functional, also illustrates the importance of workflow organization—a theme expanded in the subworkflow chapter. This real-world use case applies to marketing automation, content creation pipelines, and any scenario requiring human input mid-workflow.