{
  "id": "TSFFd1ASpZ68AGua",
  "meta": {
    "instanceId": "REDACTED"
  },
  "name": "Combined Image-to-video Agent",
  "tags": [],
  "nodes": [
    {
      "id": "REDACTED",
      "name": "Telegram Trigger",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -980,
        660
      ],
      "webhookId": "REDACTED",
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "typeVersion": 1.2
    },
    {
      "id": "REDACTED",
      "name": "If",
      "type": "n8n-nodes-base.if",
      "position": [
        -740,
        660
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "REDACTED",
              "operator": {
                "type": "array",
                "operation": "notExists",
                "singleValue": true
              },
              "leftValue": "={{ $json.message.photo }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "REDACTED",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -360,
        560
      ],
      "parameters": {
        "text": "={{ $('Telegram Trigger').item.json.message.text }}",
        "options": {
          "systemMessage": "=You are an assistant for video prompt and image-to-video generation.\n\nYour task is to:\n\n1. Create an effecgive Video Prompt to prompt a video generation model based on user's input\n\n2.Output only the following two values in JSON format:\nprompt: The text prompt for the video.\nimage_url: The URL of the image to generate the video from. Fetch this value from the last row of the attached Google Sheet tool.\nReturn only these two fields in your response, formatted as a JSON object."
        },
        "promptType": "define"
      },
      "typeVersion": 2
    },
    {
      "id": "REDACTED",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -440,
        740
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {}
      },
      "typeVersion": 1.2
    },
    {
      "id": "REDACTED",
      "name": "Simple Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        -280,
        740
      ],
      "parameters": {
        "sessionKey": "={{ $json.message.chat.id }}",
        "sessionIdType": "customKey"
      },
      "typeVersion": 1.3
    },
    {
      "id": "REDACTED",
      "name": "Telegram",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -540,
        1000
      ],
      "webhookId": "REDACTED",
      "parameters": {
        "fileId": "={{ $('Telegram Trigger').item.json.message.photo[3].file_id }}",
        "resource": "file"
      },
      "typeVersion": 1.2
    },
    {
      "id": "REDACTED",
      "name": "Google Drive",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        -320,
        1000
      ],
      "parameters": {
        "name": "=Image Upload - {{ $now }}",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "list",
          "value": "REDACTED",
          "cachedResultUrl": "REDACTED",
          "cachedResultName": "Telegram Image Upload n8n"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "REDACTED",
      "name": "Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -100,
        1000
      ],
      "parameters": {
        "columns": {
          "value": {
            "Date": "={{ $now }}",
            "Image Uploaded on Google Drive": "={{ $json.webContentLink }}"
          },
          "schema": [
            {
              "id": "Image Uploaded on Google Drive",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Image Uploaded on Google Drive",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Date",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "REDACTED",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "REDACTED",
          "cachedResultUrl": "REDACTED",
          "cachedResultName": "Image to Video Log Sheet"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "REDACTED",
      "name": "Think",
      "type": "@n8n/n8n-nodes-langchain.toolThink",
      "position": [
        0,
        740
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "REDACTED",
      "name": "Wait 15",
      "type": "n8n-nodes-base.wait",
      "position": [
        360,
        560
      ],
      "webhookId": "REDACTED",
      "parameters": {
        "amount": 15
      },
      "typeVersion": 1.1
    },
    {
      "id": "REDACTED",
      "name": "Wavespeed Get",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        560,
        560
      ],
      "parameters": {
        "url": "=https://api.wavespeed.ai/api/v3/predictions/{{ $json.data.id }}/result",
        "options": {
          "redirect": {
            "redirect": {}
          }
        },
        "authentication": "REDACTED",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": "REDACTED",
      "typeVersion": 4.2
    },
    {
      "id": "REDACTED",
      "name": "Wavespeed Post",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        180,
        560
      ],
      "parameters": {
        "url": "https://api.wavespeed.ai/api/v3/bytedance/seedance-v1-pro-i2v-480p",
        "method": "POST",
        "options": {
          "redirect": {
            "redirect": {}
          }
        },
        "sendBody": true,
        "authentication": "REDACTED",
        "bodyParameters": {
          "parameters": [
            {
              "name": "camera_fixed",
              "value": "false"
            },
            {
              "name": "duration",
              "value": "5"
            },
            {
              "name": "image",
              "value": "={{ $json.message.content.image_url }}"
            },
            {
              "name": "prompt",
              "value": "={{ $json.message.content.prompt }}"
            },
            {
              "name": "seed",
              "value": "-1"
            }
          ]
        },
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": "REDACTED",
      "typeVersion": 4.2
    },
    {
      "id": "REDACTED",
      "name": "Wait another 15 Seconds",
      "type": "n8n-nodes-base.wait",
      "position": [
        380,
        760
      ],
      "webhookId": "REDACTED",
      "parameters": {
        "amount": 15
      },
      "typeVersion": 1.1
    },
    {
      "id": "REDACTED",
      "name": "Google Sheets1",
      "type": "n8n-nodes-base.googleSheetsTool",
      "position": [
        -140,
        740
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "Google_sheet_name"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "REDACTED"
        }
      },
      "credentials": "REDACTED",
      "typeVersion": 4.6
    },
    {
      "id": "REDACTED",
      "name": "Telegram2",
      "type": "n8n-nodes-base.telegram",
      "position": [
        900,
        800
      ],
      "webhookId": "REDACTED",
      "parameters": {
        "file": "={{ $json.data.outputs[0] }}",
        "chatId": "Redacted",
        "operation": "sendVideo",
        "additionalFields": {}
      },
      "credentials": "REDACTED",
      "typeVersion": 1.2
    },
    {
      "id": "REDACTED",
      "name": "If1",
      "type": "n8n-nodes-base.if",
      "position": [
        620,
        820
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "REDACTED",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.data.status }}",
              "rightValue": "completed"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "REDACTED",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1040,
        400
      ],
      "parameters": {
        "width": 420,
        "height": 880,
        "content": "Telegram Trigger & IF Node"
      },
      "typeVersion": 1
    },
    {
      "id": "REDACTED",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -600,
        400
      ],
      "parameters": {
        "color": 4,
        "width": 720,
        "height": 500,
        "content": "Video Prompt & Image URL Agent"
      },
      "typeVersion": 1
    },
    {
      "id": "REDACTED",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -600,
        920
      ],
      "parameters": {
        "color": 3,
        "width": 720,
        "height": 360,
        "content": "Upload Image URL"
      },
      "typeVersion": 1
    },
    {
      "id": "REDACTED",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        140,
        400
      ],
      "parameters": {
        "color": 2,
        "width": 660,
        "height": 880,
        "content": "Wavespeed (Seedance, Veo3 Image-to-text API"
      },
      "typeVersion": 1
    },
    {
      "id": "REDACTED",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        820,
        400
      ],
      "parameters": {
        "color": 6,
        "width": 280,
        "height": 880,
        "content": "Telegram Output"
      },
      "typeVersion": 1
    },
    {
      "id": "REDACTED",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2080,
        400
      ],
      "parameters": {
        "color": 5,
        "width": 1020,
        "height": 1320,
        "content": "🎥 Telegram Image-to-Video Generator Agent (Veo3 / Seedance Integration)\n⚠️ This template uses [community nodes] and some credential-based HTTP API calls (e.g. Seedance/Wavespeed). Ensure proper credentials are configured before running.\n\n🛠️ In the accompanying video tutorial, this logic is built as two separate workflows:\n\nTelegram → Image Upload + Prompt Agent\nPrompt Output → Video Generation via API\n\n✨ Watch Full Tutorial Video Here: https://youtu.be/iaZHef5bZAc&list=PL05w1TE8X3baEGOktlXtRxsztOjeOb8Vg&index=1\nThis powerful automation allows you to generate short-form videos from a Telegram image input and user prompt — perfect for repurposing content into engaging reels.\n\nFrom the moment a user sends a photo with a caption to your Telegram bot, this n8n workflow:\n\n📸 Captures the image and saves it to Google Drive\n🧠 Uses an AI Agent (via LangChain + OpenAI) to craft a Seedance/Veo3-compatible video prompt\n📑 Logs the interaction to a Google Sheet\n🎞️ Sends the prompt + image to the Seedance (Wavespeed) API to generate a video\n🚀 Sends the resulting video back to the user on Telegram — fully automated\n\n🔗 How It Works (Step-by-Step)\nTelegram Bot Trigger\nListens for incoming images and captions\nConditional Logic\nFilters out invalid inputs\nAI Agent (LangChain)\n\nUses OpenAI GPT to:\nGenerate a video prompt\nAttach the most recent image URL (from Google Sheet)\nGoogle Drive Upload\nSaves the Telegram image and logs the share link\nGoogle Sheets Logging\nAppends a new row with date + file link\nWavespeed (Seedance/Veo3) API\nCalls the /bytedance/seedance-v1-pro-i2v-480p endpoint with image and prompt\nVideo Polling & Output\nWaits for generation completion\nSends back final video file to Telegram user\n\n🛠️ Tools & APIs Used\nTelegram Bot (Trigger + Video Reply)\nLangChain Agent Node\nOpenAI GPT-4.1-mini for Prompt Generation\nSimple Memory & Tools (Google Sheets)\nGoogle Drive (Image upload)\nGoogle Sheets (Log prompts + image URLs)\nWavespeed / Seedance API (Image-to-video generation)\n\n🧩 Requirements\nBefore running this workflow:\n✅ Set up a Telegram Bot and configure credentials\n✅ Connect your Google Drive and Google Sheets credentials\n✅ Sign up for Wavespeed / Seedance and generate an API key\n✅ Replace placeholder values in:\n\nHTTP Request nodes\n\nGoogle Drive folder ID\nGoogle Sheet document ID\n\n📦 Suggested Use Cases\nGenerate short-form videos from image ideas\nReformat static images into dynamic reels\nRepurpose visual content for TikTok/Instagram"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {
    "Wavespeed Post": [
      {
        "json": {
          "code": 200,
          "data": {
            "id": "REDACTED",
            "urls": {
              "get": "https://api.wavespeed.ai/api/v3/predictions/b533d7993aed4eb2b5ebf95e4f811663/result"
            },
            "error": "",
            "model": "bytedance/seedance-v1-pro-i2v-480p",
            "status": "created",
            "outputs": [],
            "timings": {
              "inference": 0
            },
            "created_at": "2025-08-04T07:16:15.18Z",
            "executionTime": 0,
            "has_nsfw_contents": []
          },
          "message": "success"
        }
      }
    ]
  },
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "REDACTED",
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Telegram",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If1": {
      "main": [
        [
          {
            "node": "Telegram2",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait another 15 Seconds",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Think": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Wait 15": {
      "main": [
        [
          {
            "node": "Wavespeed Get",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Wavespeed Post",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram": {
      "main": [
        [
          {
            "node": "Google Drive",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Drive": {
      "main": [
        [
          {
            "node": "Google Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Wavespeed Get": {
      "main": [
        [
          {
            "node": "If1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets1": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Wavespeed Post": {
      "main": [
        [
          {
            "node": "Wait 15",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Wait another 15 Seconds": {
      "main": [
        [
          {
            "node": "Wavespeed Get",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}