{
  "id": "PLACEHOLDER_WORKFLOW_ID",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "08 - AI Video generation",
  "tags": [
    {
      "id": "PLACEHOLDER_TAG_ID",
      "name": "Sample Tag",
      "createdAt": "2025-09-08T06:03:03.283Z",
      "updatedAt": "2025-09-08T06:03:03.283Z"
    }
  ],
  "nodes": [
    {
      "id": "ae08743a-ff04-4daf-85fc-a8c91dcb8c34",
      "name": "Status",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        896,
        736
      ],
      "parameters": {
        "url": "=https://generativelanguage.googleapis.com/v1beta/{{ $json.name }}",
        "options": {},
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "key"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "d25f07e3-e6bf-4973-94ba-d90fd3eff5ab",
      "name": "Send a message",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1712,
        720
      ],
      "parameters": {
        "sendTo": "YOUR_EMAIL_HERE",
        "message": "=Description:{{ $json.message.content }}",
        "options": {
          "attachmentsUi": {
            "attachmentsBinary": [
              {}
            ]
          }
        },
        "subject": "The video is ready to share on social media."
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "1bfc7578-fe4a-4028-b442-bce9be1f9d8c",
      "name": "Social Media Description",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        160,
        432
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini",
          "cachedResultName": "GPT-4.1-MINI"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "content": "={\n  \"prompt\": \"You are a social media content assistant. Take the following 8-second financial news script and create an engaging, SEO-friendly social media description suitable for LinkedIn, Instagram, and YouTube. The description should summarize the key points of the script, be concise, and written in a professional yet approachable tone. Include relevant hashtags for finance, stock market, and trading trends. Make it attention-grabbing to encourage viewers to watch the video. Keep the description between 50-150 words. Here is the script: {{ $json.message.content }}\"\n}\n"
            }
          ]
        }
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "e21f4324-6f82-453d-96db-12d7ea124cdf",
      "name": "Generate News Script",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        -256,
        592
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini",
          "cachedResultName": "GPT-4.1-MINI"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "content": "={\n  \"prompt\": \"You are a financial news assistant. Create an 8-second spoken-style script that delivers the latest globally trending stock market and trading news. Focus on the most impactful and recent global market movements such as major index shifts (S&P 500, Nasdaq, Dow Jones, FTSE, Nikkei), commodities (oil, gold), forex, or crypto. The script should be concise, engaging, and easy for a general audience to understand. Keep the tone urgent and informative, suitable for a quick news reel. Limit output to 3-4 short sentences, no bullet points.\"\n}\n"
            }
          ]
        }
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "21f202fd-c92f-4adb-944d-3a791af6edcc",
      "name": "Generate Veo3 Prompt",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        160,
        736
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini",
          "cachedResultName": "GPT-4.1-MINI"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "content": "={\n  \"prompt\": \"You are a video prompt generator for Veo 3. Convert the following financial news script into a clear, descriptive video generation prompt. The goal is to help Veo 3 create an engaging 8-second news-style video. Translate the spoken script into visuals: describe a professional news anchor, newsroom or studio setting, relevant background visuals (stock tickers, charts, global maps, trading floors), and overall mood (urgent, professional, engaging). Ensure the prompt is cinematic, easy for Veo 3 to understand, and matches the script's content and tone. Do not repeat the script text, only describe the visuals and style. Here is the script:{{ $json.message.content }} \"\n}\n"
            }
          ]
        }
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "e34f64e6-eb4d-4ac4-8897-65bce3e05800",
      "name": "Create Video",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        496,
        736
      ],
      "parameters": {
        "url": "https://generativelanguage.googleapis.com/v1beta/models/veo-3.0-fast-generate-preview:predictLongRunning",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"instances\": [\n    { \"prompt\":{{ $json.message.content }}  }\n  ],\n  \"parameters\": { \"aspectRatio\": \"16:9\" }\n}",
        "sendBody": true,
        "sendQuery": true,
        "specifyBody": "json",
        "queryParameters": {
          "parameters": [
            {
              "name": "key"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "37ad9efc-e986-46c8-ae27-ea51c7135c1b",
      "name": "Wait for Video",
      "type": "n8n-nodes-base.wait",
      "position": [
        704,
        736
      ],
      "parameters": {
        "amount": 30
      },
      "typeVersion": 1.1
    },
    {
      "id": "efb7c8d0-2177-4864-acdf-bc7cbe69d193",
      "name": "If",
      "type": "n8n-nodes-base.if",
      "position": [
        1136,
        736
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "a978781f-9dfc-4220-8b30-aafa1d6b9f6f",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{ $json.done }}",
              "rightValue": "true"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "cb6f8d34-5b14-4c30-9a75-47c4a78d97b6",
      "name": "Download Video",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1408,
        720
      ],
      "parameters": {
        "url": "={{ $json.response.generateVideoResponse.generatedSamples[0].video.uri }}",
        "options": {},
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "key"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "e5bcc0b4-ae94-4c1b-bead-7e748dffcb3f",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -608,
        272
      ],
      "parameters": {
        "width": 320,
        "height": 720,
        "content": "## Step 1: Trigger Workflow  \n- Node: Daily Trigger  \n- Starts the workflow automatically every day.  "
      },
      "typeVersion": 1
    },
    {
      "id": "6130da6c-80d7-45a6-9d5b-1e1355bf2b54",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -272,
        272
      ],
      "parameters": {
        "color": 4,
        "width": 752,
        "height": 720,
        "content": "## Step 2: Generate Content \n- Nodes: Generate News Script, Generate Veo3 Prompt, Social Media Description  \n- Creates 8-sec financial news script, video prompt for Veo3, and social media description.  "
      },
      "typeVersion": 1
    },
    {
      "id": "d8aa7775-279f-40a8-9c47-f4eebd044bf4",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        496,
        272
      ],
      "parameters": {
        "color": 3,
        "width": 816,
        "height": 720,
        "content": "## Step 3: Generate Video \n- Nodes: Create Video, Wait for Video, Status, If  \n- Generates the video, waits for it to finish, checks status, and loops if not ready.  \n"
      },
      "typeVersion": 1
    },
    {
      "id": "403a21d2-0fe9-4d13-b187-bd321b5effea",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1328,
        272
      ],
      "parameters": {
        "color": 6,
        "width": 560,
        "height": 720,
        "content": "## Step 4: Download and Share Video \n- Nodes: Download Video, Send a message  \n- Downloads the generated video and sends an email with description and attachment."
      },
      "typeVersion": 1
    },
    {
      "id": "942eb771-663a-4109-bb45-fba71caf29fa",
      "name": "Daily Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -480,
        592
      ],
      "parameters": {
        "rule": {
          "interval": [
            {}
          ]
        }
      },
      "typeVersion": 1.2
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "PLACEHOLDER_VERSION_ID",
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "Download Video",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait for Video",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Status": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Video": {
      "main": [
        [
          {
            "node": "Wait for Video",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Daily Trigger": {
      "main": [
        [
          {
            "node": "Generate News Script",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download Video": {
      "main": [
        [
          {
            "node": "Send a message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait for Video": {
      "main": [
        [
          {
            "node": "Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate News Script": {
      "main": [
        [
          {
            "node": "Generate Veo3 Prompt",
            "type": "main",
            "index": 0
          },
          {
            "node": "Social Media Description",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Veo3 Prompt": {
      "main": [
        [
          {
            "node": "Create Video",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Social Media Description": {
      "main": [
        [
          {
            "node": "Send a message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}