{
  "name": "Generate UGC product video ads from a reference image with OpenAI and Kie.ai",
  "nodes": [
    {
      "id": "51750529-e61f-4f6c-aa4b-20b4694a3988",
      "name": "When clicking ‘Execute workflow’",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -768,
        432
      ]
    },
    {
      "id": "c8a90a2e-d9b8-4543-881f-6b93c891b456",
      "name": "Analyze image",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        -96,
        432
      ]
    },
    {
      "id": "a9442908-6903-4be5-b1a4-b81b02b1da5e",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        144,
        656
      ]
    },
    {
      "id": "02f750e9-a228-44ec-ba78-b46108dadf2b",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        400,
        656
      ]
    },
    {
      "id": "8ebbe123-b5f9-4f0f-abc2-f15c4910ef60",
      "name": "Upload a file",
      "type": "n8n-nodes-base.box",
      "position": [
        3072,
        336
      ]
    },
    {
      "id": "f4273123-8b1c-4826-874a-8148adb7087e",
      "name": "Upload file",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        3072,
        528
      ]
    },
    {
      "id": "291deead-2116-4d0f-99f4-1f68979a6962",
      "name": "Image Generation Loop",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        560,
        320
      ],
      "parameters": {
        "width": 1104,
        "height": 432,
        "content": "## Image Generation Loop\n\nGenerates keyframe images using Kie.ai API. Each image serves as the first frame for video generation."
      }
    },
    {
      "id": "630b4978-8274-453b-880d-01318e7380c3",
      "name": "Video Generation Loop",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1664,
        320
      ],
      "parameters": {
        "width": 1296,
        "height": 432,
        "content": "## Video Generation Loop\n\nGenerates AI videos using the keyframes and dialogue. Downloads final video files."
      }
    },
    {
      "id": "ad9ce726-c70c-48c7-947d-fb6ebc19e2e7",
      "name": "Validate prompt generation",
      "type": "@n8n/n8n-nodes-langchain.toolThink",
      "position": [
        272,
        672
      ]
    },
    {
      "id": "56674795-213e-421d-ab61-5df97b8161c5",
      "name": "📋 Overview: Scale product videos with AI-generated UGC content",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1392,
        -128
      ],
      "parameters": {
        "width": 480,
        "height": 752,
        "content": "## Scale product videos with AI-generated UGC content\n\nThis workflow automates the creation of UGC-style product videos at scale. It analyzes a reference image, generates AI prompts for image and vide"
      }
    },
    {
      "id": "ed6ed6e3-6d78-4e6e-938d-f8445fbdc1df",
      "name": "Stage 1: Setup and image analysis",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -800,
        160
      ],
      "parameters": {
        "width": 832,
        "height": 464,
        "content": "## Stage 1: Setup and image analysis\n\nConfigures workflow variables and analyzes reference product image using OpenAI vision to extract brand, colors, and visual elements."
      }
    },
    {
      "id": "71c48a15-5b09-4b9f-8f8f-017dc2e117ff",
      "name": "Stage 2: Prompt generation",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        32,
        160
      ],
      "parameters": {
        "width": 528,
        "height": 656,
        "content": "## Stage 2: Prompt generation\n\nUses AI agent to generate UGC-style prompts for image and video creation based on analysis, user preferences, and dialogue script."
      }
    },
    {
      "id": "65015456-f371-403a-b301-bf2850102abc",
      "name": "Stage 3: Media generation and polling",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        560,
        176
      ],
      "parameters": {
        "width": 2400,
        "height": 704,
        "content": "## Stage 3: Media generation and polling\n\nCalls image and video generation APIs with generated prompts. Polls for completion status and retrieves generated media files."
      }
    },
    {
      "id": "2145cd6c-fa93-45ce-9e98-d6edd79283db",
      "name": "Stage 4: Upload and tracking",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2960,
        176
      ],
      "parameters": {
        "width": 1264,
        "height": 704,
        "content": "## Stage 4: Upload and tracking\n\nUploads generated videos to Box and Google Drive. Logs all generation results and file locations to Google Sheets for tracking."
      }
    },
    {
      "id": "ca10a0e9-310d-4d32-8964-5eb00536a4a5",
      "name": "Video script",
      "type": "n8n-nodes-base.set",
      "position": [
        -544,
        432
      ]
    },
    {
      "id": "94078249-6e86-4ef7-995e-971b91d055f6",
      "name": "Setup (Image & Video settings)",
      "type": "n8n-nodes-base.set",
      "position": [
        -320,
        432
      ]
    },
    {
      "id": "0b1d9845-f41d-4d03-a52c-0019caf7fa56",
      "name": "Generate UGC prompts with AI agent1",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        192,
        432
      ]
    },
    {
      "id": "166b7a05-5f56-4151-bef3-b0b5895bdcb7",
      "name": "Process image prompts1",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        608,
        432
      ]
    },
    {
      "id": "e3b037c6-4ca0-4ce3-95b4-7edf9bff39c4",
      "name": "Call image generation API1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        832,
        432
      ]
    },
    {
      "id": "9c2ad1c9-879f-4d51-9c0c-be35aff3dd1f",
      "name": "Wait for image generation1",
      "type": "n8n-nodes-base.wait",
      "position": [
        1056,
        432
      ]
    },
    {
      "id": "0e7e4399-ae1e-47a3-b981-d7da900e1700",
      "name": "Retrieve generated image1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1280,
        368
      ]
    },
    {
      "id": "3aef6c2b-3741-403f-9698-739afa74f25d",
      "name": "Check if image is ready1",
      "type": "n8n-nodes-base.if",
      "position": [
        1504,
        432
      ]
    },
    {
      "id": "2d32c267-4a3c-47b2-b46f-cdfc01e9a4c9",
      "name": "Call video generation API1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1728,
        432
      ]
    },
    {
      "id": "dc567de4-bc01-4a54-bd09-8e70028af0b9",
      "name": "Wait for video generation1",
      "type": "n8n-nodes-base.wait",
      "position": [
        1952,
        432
      ]
    },
    {
      "id": "6f7e23a3-0098-4fc5-b5b2-a5ffce9d6e20",
      "name": "Retrieve generated video1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2176,
        368
      ]
    },
    {
      "id": "b3da9556-94e0-43e7-858d-b6886d43920f",
      "name": "Check if video is ready1",
      "type": "n8n-nodes-base.if",
      "position": [
        2400,
        432
      ]
    },
    {
      "id": "77c153b3-376e-480d-813d-7e644f147662",
      "name": "Process video files1",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        2624,
        432
      ]
    },
    {
      "id": "61bddfc7-7ff8-4ddf-ab59-d65db0a8dc79",
      "name": "Retrieve video file list1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2848,
        432
      ]
    },
    {
      "id": "695c971a-bbdd-44b0-8b93-f64ae4ece9e4",
      "name": "Put files together",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        3296,
        528
      ]
    },
    {
      "id": "81a58d54-1062-4315-b676-605695d04266",
      "name": "Fetch video generation logs1",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        3520,
        528
      ]
    },
    {
      "id": "3e9a5688-4f9c-4daa-bd1e-b0bc551c2854",
      "name": "Route based on output type1",
      "type": "n8n-nodes-base.switch",
      "position": [
        3744,
        512
      ]
    },
    {
      "id": "6c37808a-8a80-4fdb-b606-ac25cc7cc216",
      "name": "Log image generation status1",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        3968,
        336
      ]
    },
    {
      "id": "bafaabe7-d221-437a-9209-ac729c90613e",
      "name": "Log video generation status1",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        3968,
        528
      ]
    },
    {
      "id": "e7a2c585-4921-4bc0-9bac-b3bdf1d83c07",
      "name": "Update final results1",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        3968,
        720
      ]
    }
  ],
  "connections": {
    "Upload file": {
      "main": [
        [
          {
            "node": "Put files together",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Video script": {
      "main": [
        [
          {
            "node": "Setup (Image & Video settings)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Analyze image": {
      "main": [
        [
          {
            "node": "Generate UGC prompts with AI agent1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Generate UGC prompts with AI agent1",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Put files together": {
      "main": [
        [
          {
            "node": "Fetch video generation logs1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Process video files1": {
      "main": [
        [
          {
            "node": "Retrieve video file list1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Process image prompts1": {
      "main": [
        [
          {
            "node": "Call image generation API1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check if image is ready1": {
      "main": [
        [
          {
            "node": "Call video generation API1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait for image generation1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check if video is ready1": {
      "main": [
        [
          {
            "node": "Process video files1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait for video generation1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Generate UGC prompts with AI agent1",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Retrieve generated image1": {
      "main": [
        [
          {
            "node": "Check if image is ready1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Retrieve generated video1": {
      "main": [
        [
          {
            "node": "Check if video is ready1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Retrieve video file list1": {
      "main": [
        [
          {
            "node": "Upload a file",
            "type": "main",
            "index": 0
          },
          {
            "node": "Upload file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Call image generation API1": {
      "main": [
        [
          {
            "node": "Wait for image generation1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Call video generation API1": {
      "main": [
        [
          {
            "node": "Wait for video generation1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Validate prompt generation": {
      "ai_tool": [
        [
          {
            "node": "Generate UGC prompts with AI agent1",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Wait for image generation1": {
      "main": [
        [
          {
            "node": "Retrieve generated image1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait for video generation1": {
      "main": [
        [
          {
            "node": "Retrieve generated video1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Route based on output type1": {
      "main": [
        [
          {
            "node": "Log image generation status1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Log video generation status1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Update final results1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch video generation logs1": {
      "main": [
        [
          {
            "node": "Route based on output type1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Setup (Image & Video settings)": {
      "main": [
        [
          {
            "node": "Analyze image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate UGC prompts with AI agent1": {
      "main": [
        [
          {
            "node": "Process image prompts1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Execute workflow’": {
      "main": [
        [
          {
            "node": "Video script",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}