{
  "nodes": [
    {
      "parameters": {
        "mode": "everyTime",
        "interval": "5"
      },
      "name": "Manual Trigger / Schedule",
      "type": "n8n-nodes-base.trigger",
      "typeVersion": 1,
      "uuid": "start"
    },
    {
      "parameters": {
        "content": "Generate a short video about a futuristic city."
      },
      "name": "Set Video Prompt",
      "type": "n8n-nodes-base.set",
      "typeVersion": 1,
      "uuid": "setPrompt",
      "coordinates": [
        400,
        150
      ]
    },
    {
      "parameters": {
        "model": "gpt-4o",
        "temperature": 0.7,
        "maxTokens": 500,
        "messages": [
          {
            "role": "system",
            "content": "You are a creative video script writer. Generate a script for a short video based on the user's prompt, suitable for TikTok/Instagram Reels. Include visual cues and a clear narrative. Keep it concise."
          },
          {
            "role": "user",
            "content": "Generate a script for: {{ $json.content }}"
          }
        ]
      },
      "name": "Generate Video Script (OpenAI)",
      "type": "n8n-nodes-base.openAi",
      "typeVersion": 1,
      "uuid": "generateScript",
      "coordinates": [
        650,
        150
      ]
    },
    {
      "parameters": {
        "url": "https://api.heygen.com/v1/video/generate",
        "method": "POST",
        "jsonBody": true,
        "headers": [
          {
            "name": "X-Api-Key",
            "value": ""
          }
        ],
        "body": {
          "text": "This is a placeholder for the script content.",
          "voice_id": "YOUR_HEYGEN_VOICE_ID",
          "avatar_id": "YOUR_HEYGEN_AVATAR_ID"
        },
        "responseContentType": "json"
      },
      "name": "Generate AI Video (HeyGen)",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "uuid": "generateVideo",
      "coordinates": [
        900,
        150
      ]
    },
    {
      "parameters": {
        "url": "https://api.dumpling.ai/get-tiktok-trends",
        "method": "GET",
        "qs": [
          {
            "name": "api_key",
            "value": ""
          },
          {
            "name": "limit",
            "value": "10"
          }
        ],
        "responseContentType": "json"
      },
      "name": "Get TikTok Trends (Dumpling AI)",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "uuid": "getTikTokTrends",
      "coordinates": [
        400,
        400
      ]
    },
    {
      "parameters": {
        "url": "https://api.dumpling.ai/get-instagram-reels-trends",
        "method": "GET",
        "qs": [
          {
            "name": "api_key",
            "value": ""
          },
          {
            "name": "limit",
            "value": "10"
          }
        ],
        "responseContentType": "json"
      },
      "name": "Get Instagram Trends (Dumpling AI)",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "uuid": "getInstagramTrends",
      "coordinates": [
        650,
        400
      ]
    },
    {
      "parameters": {
        "model": "gpt-4o",
        "temperature": 0.7,
        "maxTokens": 500,
        "messages": [
          {
            "role": "system",
            "content": "Analyze the following social media trends and provide suggestions for enhancing a video based on these trends. Focus on audio, visual styles, and common themes."
          },
          {
            "role": "user",
            "content": "TikTok Trends: [Placeholder for TikTok Trends]\nInstagram Reels Trends: [Placeholder for Instagram Trends]"
          }
        ]
      },
      "name": "Analyze Trends & Suggest (OpenAI)",
      "type": "n8n-nodes-base.openAi",
      "typeVersion": 1,
      "uuid": "analyzeTrends",
      "coordinates": [
        900,
        400
      ]
    },
    {
      "parameters": {
        "conditions": [
          {
            "value1": "success",
            "operator": "equalTo",
            "value2": "success"
          }
        ]
      },
      "name": "Check Video Generation Status",
      "type": "n8n-nodes-base.if",
      "typeVersion": 1,
      "uuid": "checkVideoStatus",
      "coordinates": [
        1150,
        150
      ]
    },
    {
      "parameters": {
        "model": "gpt-4o",
        "temperature": 0.7,
        "maxTokens": 200,
        "messages": [
          {
            "role": "system",
            "content": "Write a compelling caption and relevant hashtags for a short video based on the following video topic and trend suggestions. Keep it engaging and concise for TikTok and Instagram Reels."
          },
          {
            "role": "user",
            "content": "Video Topic: [Placeholder for Video Prompt]\nTrend Suggestions: [Placeholder for Trend Suggestions]"
          }
        ]
      },
      "name": "Generate Caption & Hashtags (OpenAI)",
      "type": "n8n-nodes-base.openAi",
      "typeVersion": 1,
      "uuid": "generateCaption",
      "coordinates": [
        1400,
        150
      ]
    },
    {
      "parameters": {
        "url": "https://api.upload-post.com/upload",
        "method": "POST",
        "jsonBody": true,
        "headers": [
          {
            "name": "Authorization",
            "value": "Bearer "
          }
        ],
        "body": {
          "video_url": "PLACEHOLDER_VIDEO_URL",
          "platforms": [
            "tiktok",
            "instagram"
          ],
          "title": "AI Generated Video",
          "description": "AI Generated Video",
          "hashtags": ""
        },
        "responseContentType": "json"
      },
      "name": "Upload to TikTok & Instagram (Upload-Post.com)",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "uuid": "uploadVideo",
      "coordinates": [
        1650,
        150
      ]
    },
    {
      "parameters": {},
      "name": "Merge Trend Data",
      "type": "n8n-nodes-base.merge",
      "typeVersion": 1,
      "uuid": "mergeTrends",
      "mode": "passThrough",
      "coordinates": [
        775,
        400
      ]
    }
  ],
  "connections": {
    "start": [
      {
        "node": "setPrompt",
        "type": "main",
        "index": 0
      },
      {
        "node": "getTikTokTrends",
        "type": "main",
        "index": 0
      }
    ],
    "setPrompt": [
      {
        "node": "generateScript",
        "type": "main",
        "index": 0
      }
    ],
    "generateScript": [
      {
        "node": "generateVideo",
        "type": "main",
        "index": 0
      }
    ],
    "generateVideo": [
      {
        "node": "checkVideoStatus",
        "type": "main",
        "index": 0
      }
    ],
    "getTikTokTrends": [
      {
        "node": "mergeTrends",
        "type": "main",
        "index": 0
      }
    ],
    "getInstagramTrends": [
      {
        "node": "mergeTrends",
        "type": "main",
        "index": 1
      }
    ],
    "mergeTrends": [
      {
        "node": "analyzeTrends",
        "type": "main",
        "index": 0
      }
    ],
    "checkVideoStatus": [
      {
        "node": "generateCaption",
        "type": "main",
        "index": 0
      }
    ],
    "generateCaption": [
      {
        "node": "uploadVideo",
        "type": "main",
        "index": 0
      }
    ]
  },
  "active": false,
  "settings": {
    "workflowMetaData": {
      "name": "AI Video Creator & Social Media Publisher",
      "description": "Generates AI videos with voice, analyzes TikTok/Instagram trends, and publishes to social media.",
      "tags": [
        "AI",
        "Video",
        "Social Media",
        "TikTok",
        "Instagram",
        "Automation"
      ]
    }
  },
  "versionId": "your_version_id"
}