{
  "name": "Automate AI news videos to social media with GPT-4o & HeyGen and Postiz",
  "nodes": [
    {
      "id": "5ffbcd0a-c7f3-4718-9073-e3484758669f",
      "name": "When clicking 'Test workflow'",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -624,
        784
      ]
    },
    {
      "id": "ec1b8c65-3aec-4339-9313-be9675bf0413",
      "name": "RSS Read",
      "type": "n8n-nodes-base.rssFeedRead",
      "position": [
        -400,
        784
      ]
    },
    {
      "id": "7f1495af-bf4d-4415-b382-aac0e3920f9a",
      "name": "Limit1",
      "type": "n8n-nodes-base.limit",
      "position": [
        16,
        784
      ]
    },
    {
      "id": "18d282ab-1d01-4b16-bcf4-13e68f1e9bf8",
      "name": "Log news to sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        624,
        784
      ]
    },
    {
      "id": "a34ca38f-6dd6-432f-b537-c5d9751a33b7",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -608,
        1040
      ]
    },
    {
      "id": "8710ad91-df58-4712-91f0-6f99d2f22cd9",
      "name": "write script",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -576,
        1344
      ]
    },
    {
      "id": "b882950d-8367-4b5a-a2f9-eb63371a6a80",
      "name": "Parse Caption",
      "type": "n8n-nodes-base.code",
      "position": [
        -224,
        1040
      ]
    },
    {
      "id": "ee185fd9-8289-4fd4-986d-03919e4d6dab",
      "name": "Setup Heygen Parameters",
      "type": "n8n-nodes-base.set",
      "position": [
        16,
        1040
      ]
    },
    {
      "id": "7da6a496-0263-4723-9c08-1d15ed8ed28a",
      "name": "Create Avatar Video (HeyGen)",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        272,
        1040
      ]
    },
    {
      "id": "471fc0e5-263a-450f-b642-98c066991556",
      "name": "Wait for Video (HeyGen)",
      "type": "n8n-nodes-base.wait",
      "position": [
        480,
        1040
      ]
    },
    {
      "id": "556b79e0-a3a6-4534-bd68-19c330b2351c",
      "name": "Get Avatar Video Status (HeyGen)",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        784,
        1040
      ]
    },
    {
      "id": "a5834c43-4bca-456e-97b4-a7eedf4b3ebf",
      "name": "Download Video",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -592,
        1536
      ]
    },
    {
      "id": "bfc62fe4-58cd-40c9-8365-ad9bbc3a5f56",
      "name": "Upload to Google Drive",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        -304,
        1536
      ]
    },
    {
      "id": "7b1b1dc9-85e1-481f-a102-0560ad185aa1",
      "name": "Log Video Details to Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        16,
        1536
      ]
    },
    {
      "id": "dcf670d4-7cc3-406c-ba1a-36cb501f98ed",
      "name": "Upload Video to Postiz",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -688,
        2000
      ]
    },
    {
      "id": "45521d27-d9b9-4e3d-9ce1-bb0a36ed2989",
      "name": "Get Postiz Integrations",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -464,
        2000
      ]
    },
    {
      "id": "86490587-728e-4e9a-b9ea-3e3044d5c869",
      "name": "Video Platform Router",
      "type": "n8n-nodes-base.switch",
      "position": [
        -240,
        1984
      ]
    },
    {
      "id": "0386ca30-d554-4480-93b0-d2519851acc4",
      "name": "Clean Instagram Caption",
      "type": "n8n-nodes-base.code",
      "position": [
        -16,
        1808
      ]
    },
    {
      "id": "0d29320b-7d0c-4346-a48a-33908cea8706",
      "name": "Instagram Video Publisher",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        208,
        1808
      ]
    },
    {
      "id": "f6a1f484-979e-493f-b213-448765ac93be",
      "name": "Clean Facebook Video Caption",
      "type": "n8n-nodes-base.code",
      "position": [
        -16,
        2000
      ]
    },
    {
      "id": "d301177f-e6ac-4b04-813d-05fd7ccf1cd1",
      "name": "Facebook Video Publisher",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        208,
        2000
      ]
    },
    {
      "id": "ce67c70c-9ee2-4638-bdbd-c6f42ce442aa",
      "name": "YouTube Video Publisher",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -16,
        2192
      ]
    },
    {
      "id": "56c69cd0-bd0f-4392-878a-08c16bbfb899",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -864,
        880
      ],
      "parameters": {
        "width": 176,
        "height": 128,
        "content": "🚀 **Workflow Trigger:**\nThis node acts as the manual trigger for the entire workflow. When you click 'Execute Workflow' in n8n, this node initiates the process, fetching the latest news and starting t"
      }
    },
    {
      "id": "5bdcc1f2-c149-4f5c-a3bd-69e6b5d74c55",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -464,
        528
      ],
      "parameters": {
        "width": null,
        "height": 384,
        "content": "📰 **News Feed Source:**\nConnects to the CNN Edition RSS feed (`http://rss.cnn.com/rss/edition.rss`) to pull the latest news articles. It extracts key information like the title, link, content, and pub"
      }
    },
    {
      "id": "0e5b8f4e-ebd5-4adc-bb66-1f4a5fe973c9",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1056,
        1712
      ],
      "parameters": {
        "width": 448,
        "height": 416,
        "content": "⬆️ **Postiz Video Upload:**\nThis node is responsible for uploading the actual binary video file (received from 'Download Video') to your Postiz instance's internal storage (`https://postiz.yourdomain."
      }
    },
    {
      "id": "d83e0987-0d2e-4577-aa62-d9b00944711f",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        544,
        560
      ],
      "parameters": {
        "width": null,
        "height": 384,
        "content": "📊 **News Article Logger (Google Sheets):**\nAppends the fetched news article details (Title, Link, Guid, pubDate, Content, IsoDate) to a specified Google Sheet ('RSS FEEDS' spreadsheet, 'Sheet1'). This"
      }
    },
    {
      "id": "b507d9a4-ee7d-40ab-8c92-242c56122571",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -80,
        528
      ],
      "parameters": {
        "width": null,
        "height": 384,
        "content": "⚡ **Data Limiter (For Testing/Control):**\nThis node is configured to limit the number of items processed from the RSS feed, typically to 1. This is crucial during development and testing to prevent pr"
      }
    },
    {
      "id": "7e56b046-a1e7-4790-8e12-9795b0d4ee0b",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        128,
        1600
      ],
      "parameters": {
        "width": 496,
        "height": 176,
        "content": "📊 **Video Details Logger (Google Sheets):**\\nAppends a new row to your designated Google Sheet ('Avatar video' spreadsheet, 'Sheet1') with comprehensive details about the generated video. This include"
      }
    },
    {
      "id": "b0479969-4ea3-471d-a49c-1cda3494152f",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -576,
        1744
      ],
      "parameters": {
        "width": 368,
        "height": 352,
        "content": "🎯 **Dynamic Platform Routing (Video):**\nThis intelligent switch node dynamically routes the workflow to specific publishing branches based on the `identifier` of each social media integration fetched "
      }
    },
    {
      "id": "2e9d3b33-bc69-4b65-85d3-02bf53b785df",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        512,
        1840
      ],
      "parameters": {
        "width": 368,
        "height": 128,
        "content": "🧼 **Instagram Caption Cleaner (Video):**\nThis crucial code node sanitizes and formats the AI-generated caption specifically for Instagram video posts (Reels or regular videos). It performs essential c"
      }
    },
    {
      "id": "5b994d79-0277-4cf8-ae05-a8298e8aee82",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -288,
        1184
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": "🧹 **Caption Extractor:**\nThis small code node processes the output from the 'AI Agent' to extract just the generated caption text. It simplifies the data structure, making it easier to reference the c"
      }
    },
    {
      "id": "3a375cac-c4c4-4201-a6ca-79bc395505cb",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -960,
        1056
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": "✍️ **Caption Generation AI:**\nUtilizes an AI agent (powered by the 'write script' node) to generate a short, engaging caption (30-60 words) for the news video. The prompt uses the news article's title"
      }
    },
    {
      "id": "bfc15c14-2396-4b52-be10-3ee4a11fae7b",
      "name": "Sticky Note11",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        32,
        1184
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": "🔧 **HeyGen Configuration:**\nSets up the necessary parameters for the HeyGen video creation API call. This includes your HeyGen API key, the `avatar_id`, `voice_id`, the AI-generated `caption`, and the"
      }
    },
    {
      "id": "c1a1646c-ce7a-4cfb-b19e-2805f3e13831",
      "name": "Sticky Note12",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        976,
        960
      ],
      "parameters": {
        "width": 544,
        "height": 336,
        "content": "🎬 **Video Generation (HeyGen API):**\nCalls the HeyGen API to generate a video using the specified avatar, voice, and the AI-generated caption. It sets the video dimensions and provides your HeyGen API"
      }
    },
    {
      "id": "bf6a9892-0661-4774-811c-0f4df7349d11",
      "name": "Sticky Note13",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -576,
        2192
      ],
      "parameters": {
        "width": 368,
        "height": 208,
        "content": "📸 **Publish to Instagram (Video):**\nThis node uses the Postiz API (`https://postiz.yourdomain.com/api/public/v1/posts`) to publish the video content to Instagram. It sends the cleaned caption from 'Cl"
      }
    },
    {
      "id": "28d3c92a-4178-4b78-a46c-e5b778977682",
      "name": "Sticky Note14",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        400,
        2064
      ],
      "parameters": {
        "width": 448,
        "height": 144,
        "content": "📺 **Publish to YouTube (Video):**\nThis node is responsible for publishing the generated video to YouTube via the Postiz API. It uses the `news_title` from 'Setup Heygen Parameters' as the YouTube vide"
      }
    },
    {
      "id": "85f3fa47-0e66-45d4-84b3-01e2ab0bbef6",
      "name": "Sticky Note15",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1840,
        832
      ],
      "parameters": {
        "width": 704,
        "height": 1136,
        "content": "## 🤖 Automated AI News Video Creation and Social Media Publishing Workflow\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n\n🎯 **PURPOSE:**\nThis workflow fully automates the "
      }
    }
  ],
  "connections": {
    "Limit1": {
      "main": [
        [
          {
            "node": "Log news to sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Parse Caption",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "RSS Read": {
      "main": [
        [
          {
            "node": "Limit1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "write script": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Parse Caption": {
      "main": [
        [
          {
            "node": "Setup Heygen Parameters",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download Video": {
      "main": [
        [
          {
            "node": "Upload to Google Drive",
            "type": "main",
            "index": 0
          },
          {
            "node": "Upload Video to Postiz",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Log news to sheets": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Video Platform Router": {
      "main": [
        [
          {
            "node": "Clean Instagram Caption",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Clean Facebook Video Caption",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "YouTube Video Publisher",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload Video to Postiz": {
      "main": [
        [
          {
            "node": "Get Postiz Integrations",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload to Google Drive": {
      "main": [
        [
          {
            "node": "Log Video Details to Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Clean Instagram Caption": {
      "main": [
        [
          {
            "node": "Instagram Video Publisher",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Postiz Integrations": {
      "main": [
        [
          {
            "node": "Video Platform Router",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Setup Heygen Parameters": {
      "main": [
        [
          {
            "node": "Create Avatar Video (HeyGen)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait for Video (HeyGen)": {
      "main": [
        [
          {
            "node": "Get Avatar Video Status (HeyGen)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Clean Facebook Video Caption": {
      "main": [
        [
          {
            "node": "Facebook Video Publisher",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Avatar Video (HeyGen)": {
      "main": [
        [
          {
            "node": "Wait for Video (HeyGen)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking 'Test workflow'": {
      "main": [
        [
          {
            "node": "RSS Read",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Avatar Video Status (HeyGen)": {
      "main": [
        [
          {
            "node": "Download Video",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}