AutomationFlowsAI & RAG › Create and Publish AI Avatar Short Videos with Gemini, Heygen and Google Sheets

Create and Publish AI Avatar Short Videos with Gemini, Heygen and Google Sheets

Bygiangxai @giangxai on n8n.io

Automatically generate AI avatar short videos and publish them to social platforms using n8n and HeyGen. This workflow turns viral ideas or prepared scripts into fully rendered AI avatar videos and handles publishing and tracking without manual editing.

Cron / scheduled trigger★★★★☆ complexityAI-powered23 nodesGoogle Gemini ChatGoogle Sheets@Apify/N8N Nodes ApifyGoogle GeminiOutput Parser StructuredAgentHTTP Request@Blotato/N8N Nodes Blotato
AI & RAG Trigger: Cron / scheduled Nodes: 23 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow corresponds to n8n.io template #13024 — we link there as the canonical source.

This workflow follows the Agent → Googlegemini recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "id": "sKCtQW9JsFxRrbxQ",
  "name": "Automated AI Video Avatar",
  "tags": [],
  "nodes": [
    {
      "id": "10397d84-2860-4aff-b7fb-1e1b6092a6b0",
      "name": "Google Gemini Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        624,
        192
      ],
      "parameters": {
        "options": {},
        "modelName": "models/gemini-3-flash-preview"
      },
      "typeVersion": 1
    },
    {
      "id": "4d8786ed-e454-4182-9105-5a06bdd43dca",
      "name": "Update row Viral Content",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        576,
        1040
      ],
      "parameters": {
        "columns": {
          "value": {
            "Status": "Done",
            "row_number": "={{ $('Load Viral Idea from Sheet').item.json.row_number }}"
          },
          "schema": [
            {
              "id": "Caption",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Caption",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Date Post",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Date Post",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Username",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Username",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Link user",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Link user",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Link video",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Link video",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "VideoURL",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "VideoURL",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Likes",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Likes",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Shares",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Shares",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "View",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "View",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Save",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Save",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Hasgtag",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Hasgtag",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Status",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "type": "number",
              "display": true,
              "removed": false,
              "readOnly": true,
              "required": false,
              "displayName": "row_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "row_number"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/11mgpwg5pU1IjZugU32oKqzHf21tlU57UbhLhERAoxFE/edit#gid=0",
          "cachedResultName": "Trang t\u00ednh1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "11mgpwg5pU1IjZugU32oKqzHf21tlU57UbhLhERAoxFE",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/11mgpwg5pU1IjZugU32oKqzHf21tlU57UbhLhERAoxFE/edit?usp=drivesdk",
          "cachedResultName": "Sabrina viral content"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "d2c94b87-eca0-46f4-9885-e20ea4c0dcbf",
      "name": "Cron \u2013 Fetch Viral Ideas",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        32,
        -80
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "hours",
              "hoursInterval": 6
            }
          ]
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "3a05cd51-c355-4779-9407-e9b70c0a4e6f",
      "name": "Get Viral Video Dataset",
      "type": "@apify/n8n-nodes-apify.apify",
      "position": [
        256,
        -80
      ],
      "parameters": {
        "actorId": {
          "__rl": true,
          "mode": "list",
          "value": "GdWCkxBtKWOsKjdch",
          "cachedResultUrl": "https://console.apify.com/actors/GdWCkxBtKWOsKjdch/input",
          "cachedResultName": "TikTok Scraper (clockworks/tiktok-scraper)"
        },
        "timeout": {},
        "operation": "Run actor and get dataset",
        "customBody": "={\n    \"excludePinnedPosts\": false,\n    \"profileScrapeSections\": [\n        \"videos\"\n    ],\n    \"profileSorting\": \"popular\",\n    \"profiles\": [\n        \"@sabrina_ramonov\"\n    ],\n    \"proxyCountryCode\": \"VN\",\n    \"resultsPerPage\": 10,\n    \"scrapeRelatedVideos\": false,\n    \"shouldDownloadAvatars\": false,\n    \"shouldDownloadCovers\": false,\n    \"shouldDownloadMusicCovers\": false,\n    \"shouldDownloadSlideshowImages\": false,\n    \"shouldDownloadSubtitles\": false,\n    \"shouldDownloadVideos\": true,\n    \"videoKvStoreIdOrName\": \"my-tiktok-ASMR\"\n}",
        "authentication": "apifyOAuth2Api"
      },
      "typeVersion": 1
    },
    {
      "id": "6d81e174-e7ee-429f-bbed-46e2a7677fc7",
      "name": "Save Viral Ideas to Google Sheet",
      "type": "n8n-nodes-base.set",
      "position": [
        512,
        -80
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "2927eb2d-7868-4945-b7c7-163782fc0044",
              "name": "Caption",
              "type": "string",
              "value": "={{ $json.text }}"
            },
            {
              "id": "8b7c1f39-207f-4433-9694-9aa4c5ac8c55",
              "name": "Date Post",
              "type": "string",
              "value": "={{ $json.createTimeISO.toDateTime().format('dd/LL/yyyy') }}"
            },
            {
              "id": "3be36a1b-f1c3-4b44-b265-bd79ab6bddbe",
              "name": "Username",
              "type": "string",
              "value": "={{ $json.authorMeta.name }}"
            },
            {
              "id": "25128c7b-b6e0-4c63-8bcb-c71866976737",
              "name": "Link user",
              "type": "string",
              "value": "={{ $json.authorMeta.profileUrl }}"
            },
            {
              "id": "ada46de7-8651-422a-bf7a-a958aad7ce28",
              "name": "Link video",
              "type": "string",
              "value": "={{ $json.webVideoUrl }}"
            },
            {
              "id": "92d4e87b-9cc9-4609-8e17-383c61ca3058",
              "name": "VideoURL",
              "type": "array",
              "value": "={{ $json.mediaUrls }}"
            },
            {
              "id": "1f428824-106f-49f3-8816-92c7ff9ef324",
              "name": "Likes",
              "type": "number",
              "value": "={{ $json.diggCount }}"
            },
            {
              "id": "5f1c9240-7a37-424e-8318-333c8de42797",
              "name": "Shares",
              "type": "number",
              "value": "={{ $json.shareCount }}"
            },
            {
              "id": "56c177a1-b382-4674-8308-45f9423a6e54",
              "name": "View",
              "type": "number",
              "value": "={{ $json.playCount }}"
            },
            {
              "id": "73cb5bb3-bdbf-406b-a778-bf36e935ead9",
              "name": "Save",
              "type": "number",
              "value": "={{ $json.collectCount }}"
            },
            {
              "id": "a8bbcfbe-7c37-4f78-9e9d-ad9387a581d1",
              "name": "Hasgtag",
              "type": "array",
              "value": "={{ $json.hashtags }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "44b61fef-fc39-4e65-acd4-0c3795ba4a43",
      "name": "Cron \u2013 Process Viral Row",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        16,
        336
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "hours",
              "hoursInterval": 6
            }
          ]
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "6aaed30c-8d26-4fff-8a14-990753eeadff",
      "name": "Load Viral Idea from Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        208,
        336
      ],
      "parameters": {
        "options": {
          "returnFirstMatch": true
        },
        "filtersUI": {
          "values": [
            {
              "lookupValue": "Pending",
              "lookupColumn": "Status"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/11mgpwg5pU1IjZugU32oKqzHf21tlU57UbhLhERAoxFE/edit#gid=0",
          "cachedResultName": "Trang t\u00ednh1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "11mgpwg5pU1IjZugU32oKqzHf21tlU57UbhLhERAoxFE",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/11mgpwg5pU1IjZugU32oKqzHf21tlU57UbhLhERAoxFE/edit?usp=drivesdk",
          "cachedResultName": "Sabrina viral content"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "4c661dd3-606f-405a-b336-1138f5f6b4a1",
      "name": "Analyze Viral Video",
      "type": "@n8n/n8n-nodes-langchain.googleGemini",
      "position": [
        416,
        336
      ],
      "parameters": {
        "text": "Analyze and extract the main content of the video.",
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "models/gemini-3-flash-preview",
          "cachedResultName": "models/gemini-3-flash-preview"
        },
        "options": {},
        "resource": "video",
        "operation": "analyze",
        "videoUrls": "={{ $json.VideoURL }}"
      },
      "typeVersion": 1
    },
    {
      "id": "7b5d7f4b-55f8-45f3-a16c-518526535695",
      "name": "Parse Script Structure",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        800,
        192
      ],
      "parameters": {
        "jsonSchemaExample": "{\n  \"title\": \"string\",\n  \"script\": \"string\",\n  \"caption\": \"string\"\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "5d0b551a-2be0-41c5-a3fd-3263f940be5c",
      "name": "AI Agent \u2013 Script & Avatar Director",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        640,
        336
      ],
      "parameters": {
        "text": "Written according to AI requirements.",
        "options": {
          "systemMessage": "=You are a short video script writer.\n\nYour task is to create a compelling TikTok script under 500 characters.\n\nThe script must be strong, engaging from the start and deliver immediate value.\n\nCarefully analyze the structure, tone, and rhythm of the content.\n\n{{ $json.content.parts[0].text.replace(/\\n+/g, ' ') }}\n\nto identify successful patterns (opening, coherence, impact).\n\nUse these insights to replicate the same energy, pace, and style of the opening.\nAdditionally, add a caption no longer than 120 characters that is intriguing and encourages viewers to click.\n\nOUTPUT RULES\n\n\n\nReturn the result ONLY in the following JSON format:\n\n{\n  \"title\": \"Short, compelling title here\",\n  \"script\": \"TikTok script content here (under 500 characters)\",\n  \"caption\": \"Intriguing caption here (under 120 characters)\"\n}\n\n\n\n\nNo unnecessary text\n\nNo explanation\n\nNo introduction\n\nMANDATORY REQUIREMENTS\n\nCaptivate the viewer from the first line\n\nContent is coherent and natural, leading to a clear conclusion\n\nSimple, everyday language, as if in conversation\n\nTotal length does not exceed 500 characters\n\n"
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 3
    },
    {
      "id": "f81a76fd-0fcb-415d-b6fb-20b945e2d80b",
      "name": "Finalize Avatar Script",
      "type": "n8n-nodes-base.set",
      "position": [
        944,
        336
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "60086b9e-e27e-4550-9cfe-e93b2ee77486",
              "name": "Scripts",
              "type": "string",
              "value": "={{ $json.output.script }}"
            },
            {
              "id": "d1c53089-313e-4c56-880b-3b81b435b24a",
              "name": "Title",
              "type": "string",
              "value": "={{ $json.output.title }}"
            },
            {
              "id": "3cd2eda3-a687-4b1d-b4ce-7e075b683ece",
              "name": "Caption",
              "type": "string",
              "value": "={{ $json.output.caption }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "887959e1-4c80-4edf-81b3-72a7eb646324",
      "name": "Create AI Avatar Video",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        144,
        640
      ],
      "parameters": {
        "url": "https://api.heygen.com/v2/video/generate",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"video_inputs\": [\n    {\n      \"character\": {\n        \"type\": \"avatar\",\n        \"avatar_id\": \"52774bb2c9ae4b5aa1bf0746784cfc0d\",\n        \"avatar_style\": \"normal\"\n        },\n        \n      \"voice\": {\n        \"type\": \"text\",\n        \"voice_id\": \"beaa78fa0aa04f0f9cd2a130d1f70231\",\n        \"input_text\": \"{{ $json.Scripts }}\" ,\n        \"speed\": 1.0\n       \n      }\n    }\n  ],\n  \"dimension\": {\n    \"width\": 720, \"height\": 1280\n  }\n} ",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "headerParameters": {
          "parameters": [
            {
              "name": "accept",
              "value": "application/json"
            }
          ]
        }
      },
      "typeVersion": 4.3
    },
    {
      "id": "78279cb1-86fb-487d-8c14-901cc0e47789",
      "name": "Wait for Video Rendering",
      "type": "n8n-nodes-base.wait",
      "position": [
        368,
        624
      ],
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "4bd1613a-1cac-457b-b7c2-c5f2bffda794",
      "name": "Get Rendered Video",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        560,
        624
      ],
      "parameters": {
        "url": "https://api.heygen.com/v1/video_status.get",
        "options": {},
        "sendQuery": true,
        "sendHeaders": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "queryParameters": {
          "parameters": [
            {
              "name": "video_id",
              "value": "={{ $('Create AI Avatar Video').item.json.data.video_id }}"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "accept",
              "value": "application/json"
            }
          ]
        }
      },
      "typeVersion": 4.3
    },
    {
      "id": "46df40c3-3fed-454e-bfec-a2a95f26b0d8",
      "name": "Check Video Status",
      "type": "n8n-nodes-base.if",
      "position": [
        752,
        624
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 3,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "c6aeae72-c65e-47bb-b4ff-5975817b3923",
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.data.status }}",
              "rightValue": "processing"
            }
          ]
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "15c7f23d-d8d3-4428-8d41-a1a13e3e6977",
      "name": "Save Viral Ideas to Google Sheet1",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        768,
        -80
      ],
      "parameters": {
        "columns": {
          "value": {
            "Save": "={{ $json.Save }}",
            "View": "={{ $json.View }}",
            "Likes": "={{ $json.Likes }}",
            "Shares": "={{ $json.Shares }}",
            "Status": "Pending",
            "Caption": "={{ $json.Caption }}",
            "Hasgtag": "={{ $json.Hasgtag }}",
            "Username": "={{ $json.Username }}",
            "VideoURL": "={{ $json.VideoURL[0] }}",
            "Date Post": "={{ $json['Date Post'] }}",
            "Link user": "={{ $json['Link user'] }}",
            "Link video": "={{ $json['Link video'] }}"
          },
          "schema": [
            {
              "id": "Caption",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Caption",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Date Post",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Date Post",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Username",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Username",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Link user",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Link user",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Link video",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Link video",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "VideoURL",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "VideoURL",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Likes",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Likes",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Shares",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Shares",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "View",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "View",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Save",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Save",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Hasgtag",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Hasgtag",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Status",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1AvE7tSFxcIHXN7xLwFNvMrAeI8J3wMPo-cs0TFrPgPA/edit#gid=0",
          "cachedResultName": "Trang t\u00ednh1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "11mgpwg5pU1IjZugU32oKqzHf21tlU57UbhLhERAoxFE",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/11mgpwg5pU1IjZugU32oKqzHf21tlU57UbhLhERAoxFE/edit?usp=drivesdk",
          "cachedResultName": "Sabrina viral content"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "477ddb0c-75ad-4a32-82ea-50f79cb25075",
      "name": "Publish Video to Tiktok",
      "type": "@blotato/n8n-nodes-blotato.blotato",
      "position": [
        160,
        1072
      ],
      "parameters": {
        "options": {},
        "platform": "tiktok",
        "accountId": {
          "__rl": true,
          "mode": "list",
          "value": "23867",
          "cachedResultUrl": "https://backend.blotato.com/v2/accounts/23867",
          "cachedResultName": "kytagiang"
        },
        "postContentText": "={{ $('Finalize Avatar Script').item.json.Title }}\n{{ $('Finalize Avatar Script').item.json.Caption }}",
        "postContentMediaUrls": "={{ $json.data.video_url }}"
      },
      "credentials": {
        "blotatoApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "cd3c677e-97dd-4416-a75a-1cabbef72a8d",
      "name": "Publish Video to Facebook",
      "type": "@blotato/n8n-nodes-blotato.blotato",
      "position": [
        576,
        1232
      ],
      "parameters": {
        "options": {},
        "platform": "facebook",
        "accountId": {
          "__rl": true,
          "mode": "list",
          "value": "15884",
          "cachedResultUrl": "https://backend.blotato.com/v2/accounts/15884",
          "cachedResultName": "Giang VT"
        },
        "facebookPageId": {
          "__rl": true,
          "mode": "list",
          "value": "688227101036478",
          "cachedResultUrl": "https://backend.blotato.com/v2/accounts/15884/subaccounts/688227101036478",
          "cachedResultName": "Giang VT"
        },
        "postContentText": "={{ $('Finalize Avatar Script').item.json.Title }}\n{{ $('Finalize Avatar Script').item.json.Caption }}",
        "postContentMediaUrls": "={{ $('Get Rendered Video').item.json.data.video_url }}"
      },
      "credentials": {
        "blotatoApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "ec90369e-590d-43ec-b6d5-06819fddc334",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -32,
        -208
      ],
      "parameters": {
        "color": 7,
        "width": 1200,
        "height": 320,
        "content": "## Viral Idea Engine\nCollect viral short-form video ideas on a schedule and store them in Google Sheets as the input queue for the workflow."
      },
      "typeVersion": 1
    },
    {
      "id": "f980615d-0e1a-427d-b917-0f3a79d75b44",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -32,
        112
      ],
      "parameters": {
        "color": 7,
        "width": 1200,
        "height": 448,
        "content": "## AI Content Brain\nAnalyze viral videos and generate short, avatar-ready scripts automatically using AI."
      },
      "typeVersion": 1
    },
    {
      "id": "f1d4ae47-37fe-4393-a315-ec60fec40551",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -32,
        544
      ],
      "parameters": {
        "color": 7,
        "width": 1200,
        "height": 416,
        "content": "##AI Avatar Video Factory\nCreate AI avatar videos from scripts, wait for rendering, and retrieve the final video from HeyGen."
      },
      "typeVersion": 1
    },
    {
      "id": "d38e05a9-b6e5-4f21-b009-928a892cbf8e",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -32,
        960
      ],
      "parameters": {
        "color": 7,
        "width": 1200,
        "height": 448,
        "content": "## Auto Publish & Tracking\nPublish AI avatar videos to social platforms and update Google Sheets with status and results."
      },
      "typeVersion": 1
    },
    {
      "id": "88173527-6a9a-47fd-9eb9-64c009a02864",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -624,
        -208
      ],
      "parameters": {
        "width": 592,
        "height": 656,
        "content": "## I\ud83d\udee0\ufe0f Workflow Setup Guide\n\nAuthor: [GiangxAI](https://www.youtube.com/@giangxai.official)\n\n## How it works\n- Viral video ideas are collected and stored in Google Sheets  \n- Each idea is analyzed and converted into an AI avatar-ready script  \n- HeyGen generates an AI avatar video automatically  \n- The video is published to social platforms  \n- Google Sheets is updated to track progress and results  \n\nThe entire workflow runs on a schedule and operates end-to-end without manual editing.\n---\n## Setup guide\n- Connect Google Sheets and prepare a sheet for viral ideas and status tracking  \n- Add credentials for your AI model (e.g. Gemini) and HeyGen  \n- Configure avatar settings such as voice and language  \n- Set publishing credentials for your target platforms  \n- Adjust the schedule to control how often videos are generated and published  \n\nSetup is quick and requires no coding knowledge.\n"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "302fb4c9-3407-4084-88df-a53bea582b4b",
  "connections": {
    "Check Video Status": {
      "main": [
        [
          {
            "node": "Wait for Video Rendering",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Publish Video to Tiktok",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Rendered Video": {
      "main": [
        [
          {
            "node": "Check Video Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Analyze Viral Video": {
      "main": [
        [
          {
            "node": "AI Agent \u2013 Script & Avatar Director",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create AI Avatar Video": {
      "main": [
        [
          {
            "node": "Wait for Video Rendering",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Finalize Avatar Script": {
      "main": [
        [
          {
            "node": "Create AI Avatar Video",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse Script Structure": {
      "ai_outputParser": [
        [
          {
            "node": "AI Agent \u2013 Script & Avatar Director",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Get Viral Video Dataset": {
      "main": [
        [
          {
            "node": "Save Viral Ideas to Google Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Publish Video to Tiktok": {
      "main": [
        [
          {
            "node": "Update row Viral Content",
            "type": "main",
            "index": 0
          },
          {
            "node": "Publish Video to Facebook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent \u2013 Script & Avatar Director",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Wait for Video Rendering": {
      "main": [
        [
          {
            "node": "Get Rendered Video",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Cron \u2013 Fetch Viral Ideas": {
      "main": [
        [
          {
            "node": "Get Viral Video Dataset",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Cron \u2013 Process Viral Row": {
      "main": [
        [
          {
            "node": "Load Viral Idea from Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Load Viral Idea from Sheet": {
      "main": [
        [
          {
            "node": "Analyze Viral Video",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Save Viral Ideas to Google Sheet": {
      "main": [
        [
          {
            "node": "Save Viral Ideas to Google Sheet1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent \u2013 Script & Avatar Director": {
      "main": [
        [
          {
            "node": "Finalize Avatar Script",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

Automatically generate AI avatar short videos and publish them to social platforms using n8n and HeyGen. This workflow turns viral ideas or prepared scripts into fully rendered AI avatar videos and handles publishing and tracking without manual editing.

Source: https://n8n.io/workflows/13024/ — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

This workflow automatically creates short-form AI videos using Sora 2 Cameos, powered by n8n and AI agents.

@Apify/N8N Nodes Apify, Google Sheets, Google Gemini +6
AI & RAG

Automatically generate viral short-form health videos using AI and publish them to social platforms with n8n and Veo 3. This workflow collects viral ideas, analyzes engagement patterns, generates AI v

@Apify/N8N Nodes Apify, Google Sheets, Google Gemini +6
AI & RAG

This workflow is ideal for: Content creators who want to replicate successful LinkedIn strategies Social media managers monitoring competitor content performance Marketing teams analyzing trending top

Google Gemini Chat, Google Sheets, HTTP Request +5
AI & RAG

Overview

Google Gemini Chat, Tool Think, Output Parser Structured +6
AI & RAG

This workflow is designed for: Content creators and marketers E-commerce and product-based businesses Agencies producing social media visuals and videos Automation builders looking for AI-powered crea

HTTP Request, Edit Image, Google Drive +7