{
  "id": "",
  "meta": {
    "templateCredsSetupCompleted": false
  },
  "name": "HeyGen AI Video Generation with Social Media Publishing",
  "tags": [],
  "nodes": [
    {
      "id": "12077b84-937a-4317-a126-80aab5b2311e",
      "name": "Schedule Daily Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -288,
        128
      ],
      "parameters": {},
      "typeVersion": 1.2
    },
    {
      "id": "bbee0d58-182c-4ccc-8b81-9a5045baa6ba",
      "name": "Perplexity Search",
      "type": "n8n-nodes-base.perplexity",
      "position": [
        -64,
        128
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "01c94fc6-796a-46a6-9dd2-176adbc3813c",
      "name": "Write Video Script",
      "type": "n8n-nodes-base.openAi",
      "position": [
        160,
        128
      ],
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "1a30d646-2583-4711-a8af-1303ec3fe7ea",
      "name": "Get Screenshot",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        608,
        128
      ],
      "parameters": {},
      "retryOnFail": true,
      "typeVersion": 4.2
    },
    {
      "id": "28fdb385-a0a5-4c82-9cf0-ac84741b3e07",
      "name": "Write Video Caption",
      "type": "n8n-nodes-base.openAi",
      "position": [
        1248,
        128
      ],
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "23d6e640-5c1c-4478-b119-c24c3ce6cf6a",
      "name": "Extract URL",
      "type": "n8n-nodes-base.code",
      "position": [
        384,
        128
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "5a18e418-047a-4a41-9bd6-7d06258e50fc",
      "name": "Prepare Avatar Data",
      "type": "n8n-nodes-base.code",
      "position": [
        1456,
        128
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "56f84477-257d-42dd-80e6-a71eba6d121c",
      "name": "Create Avatar Video (Optimized)",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1680,
        128
      ],
      "parameters": {},
      "typeVersion": 4.2
    },
    {
      "id": "7d28cd0e-e000-4179-a6e8-d0c586210cc2",
      "name": "Store to Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "notes": "You need to:\n1. Create a Google Sheet\n2. Add headers: video_id, caption, timestamp, status\n3. Replace YOUR_GOOGLE_SHEET_ID with actual ID\n4. Connect your Google account",
      "position": [
        2128,
        128
      ],
      "parameters": {},
      "notesInFlow": true,
      "typeVersion": 4.5
    },
    {
      "id": "7b6a9415-6b36-4da0-9092-b00fb4f2b062",
      "name": "Prepare Sheets Data",
      "type": "n8n-nodes-base.code",
      "position": [
        1904,
        128
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "af47ca8b-1d8b-4d70-adb4-06aa58c03ea2",
      "name": "HeyGen Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -288,
        480
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "87c82997-22c8-4761-80af-e8c0df7ecf43",
      "name": "Process HeyGen Callback",
      "type": "n8n-nodes-base.code",
      "position": [
        -64,
        480
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "8160bf99-05c0-4c3d-9349-1c39f2f36ed3",
      "name": "Get Caption from Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "notes": "This looks up the video_id in Google Sheets to get the caption",
      "position": [
        160,
        480
      ],
      "parameters": {},
      "notesInFlow": true,
      "typeVersion": 4.5
    },
    {
      "id": "f240f457-ae29-486e-b53f-6e72c83bc1eb",
      "name": "Combine Data",
      "type": "n8n-nodes-base.code",
      "position": [
        384,
        480
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "2c068a8e-2506-49a2-ae79-413b56db6c91",
      "name": "Assign Social Media IDs",
      "type": "n8n-nodes-base.set",
      "position": [
        1024,
        480
      ],
      "parameters": {},
      "typeVersion": 3.4
    },
    {
      "id": "31e17a13-f3dd-4df2-b0a0-08a60cf91fac",
      "name": "INSTAGRAM",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1248,
        384
      ],
      "parameters": {},
      "typeVersion": 4.2
    },
    {
      "id": "62f97acb-7042-4217-b203-a79c0ca04f2b",
      "name": "TIKTOK",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1248,
        592
      ],
      "parameters": {},
      "typeVersion": 4.2
    },
    {
      "id": "bc266583-d522-41b8-95f3-10aa0d00071a",
      "name": "Upload to tmpfiles",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        816,
        128
      ],
      "parameters": {},
      "typeVersion": 4.2
    },
    {
      "id": "eec0d2b5-01b1-480f-854b-be5c4dadd7fe",
      "name": "Extract tmpfiles",
      "type": "n8n-nodes-base.code",
      "position": [
        1024,
        128
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "1bdca4f3-f2bc-402b-8ca6-63e8ed2a4dc6",
      "name": "Upload to Blotato",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        592,
        480
      ],
      "parameters": {},
      "typeVersion": 4.2
    },
    {
      "id": "5c95297b-750a-4970-a4e7-7bca0d5f96c5",
      "name": "Extract Blotato URL",
      "type": "n8n-nodes-base.code",
      "position": [
        800,
        480
      ],
      "parameters": {},
      "typeVersion": 2
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "",
  "connections": {
    "Extract URL": {
      "main": [
        [
          {
            "node": "Get Screenshot",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Combine Data": {
      "main": [
        [
          {
            "node": "Upload to Blotato",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Screenshot": {
      "main": [
        [
          {
            "node": "Upload to tmpfiles",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HeyGen Webhook": {
      "main": [
        [
          {
            "node": "Process HeyGen Callback",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract tmpfiles": {
      "main": [
        [
          {
            "node": "Write Video Caption",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Perplexity Search",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Perplexity Search": {
      "main": [
        [
          {
            "node": "Write Video Script",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload to Blotato": {
      "main": [
        [
          {
            "node": "Extract Blotato URL",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload to tmpfiles": {
      "main": [
        [
          {
            "node": "Extract tmpfiles",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Write Video Script": {
      "main": [
        [
          {
            "node": "Extract URL",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Blotato URL": {
      "main": [
        [
          {
            "node": "Assign Social Media IDs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Avatar Data": {
      "main": [
        [
          {
            "node": "Create Avatar Video (Optimized)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Sheets Data": {
      "main": [
        [
          {
            "node": "Store to Google Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Write Video Caption": {
      "main": [
        [
          {
            "node": "Prepare Avatar Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Assign Social Media IDs": {
      "main": [
        [
          {
            "node": "INSTAGRAM",
            "type": "main",
            "index": 0
          },
          {
            "node": "TIKTOK",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Caption from Sheets": {
      "main": [
        [
          {
            "node": "Combine Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Process HeyGen Callback": {
      "main": [
        [
          {
            "node": "Get Caption from Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Avatar Video (Optimized)": {
      "main": [
        [
          {
            "node": "Prepare Sheets Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}