{
  "name": "Elevenlabs/Heygen Video Gen",
  "nodes": [
    {
      "parameters": {
        "url": "=https://api.heygen.com/v1/video_status.get?video_id={{ $json.data.video_id }}",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "options": {}
      },
      "id": "eef8a0f5-126e-45af-9161-2b189d55249d",
      "name": "Check Video Status",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        608,
        -16
      ],
      "credentials": {
        "httpHeaderAuth": {
          "id": "lrUHhiCvWE4zyfdC",
          "name": "Heygen X Ankittalks"
        }
      }
    },
    {
      "parameters": {
        "unit": "minutes"
      },
      "id": "8382f63c-4a0d-4f04-a5a8-e9dbcecf6be7",
      "name": "Wait for Processing",
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1,
      "position": [
        1008,
        96
      ],
      "webhookId": "589f8ffd-3736-4ba9-9915-c63e0af12fc0"
    },
    {
      "parameters": {
        "amount": 1,
        "unit": "minutes"
      },
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        432,
        96
      ],
      "id": "f770df60-01e0-4b26-b681-3e4f74c008ee",
      "name": "Wait1",
      "webhookId": "5ae7c616-83e2-438c-bfac-f8acf0bb3940"
    },
    {
      "parameters": {},
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        -176,
        -400
      ],
      "id": "803ab081-0cc3-453e-9007-22d232a9b3ec",
      "name": "When clicking ‘Execute workflow’"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.heygen.com/v2/video/generate",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n  \"dimension\": {\n    \"width\": 1280,\n    \"height\": 720\n  },\n  \"video_inputs\": [\n    {\n      \"character\": {\n        \"type\": \"avatar\",\n        \"avatar_id\": \"Elenora_FitnessCoach_public\",\n        \"avatar_style\": \"normal\"\n      },\n      \"voice\": {\n        \"type\": \"audio\",\n        \"audio_url\": \"https://drive.google.com/file/d/1ou94OyvIHwFaCXuXVcuHfv_fAQdQp5F-/view?usp=sharing\"\n      },\n      \"background\": {\n        \"type\": \"color\",\n        \"value\": \"#008000\"\n      }\n    }\n  ]\n}",
        "options": {}
      },
      "id": "c6e2b6fb-db90-4164-ad47-0f3f2f6c54f4",
      "name": "Generate AI video",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        240,
        176
      ],
      "credentials": {
        "httpHeaderAuth": {
          "id": "lrUHhiCvWE4zyfdC",
          "name": "Heygen X Ankittalks"
        }
      }
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 1
          },
          "conditions": [
            {
              "id": "condition-1",
              "leftValue": "={{ $json.data.status }}",
              "rightValue": "completed",
              "operator": {
                "type": "string",
                "operation": "equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "da663374-07be-455c-9103-a2194c93ce3e",
      "name": "Completed?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [
        816,
        -16
      ]
    },
    {
      "parameters": {
        "url": "={{ $json.data.video_url }}",
        "options": {
          "response": {
            "response": {
              "responseFormat": "file"
            }
          }
        }
      },
      "id": "f9a93950-8f2e-4f14-b8e4-21147ca8a419",
      "name": "Download AI Video",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        992,
        -144
      ]
    },
    {
      "parameters": {
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive"
        },
        "folderId": {
          "__rl": true,
          "value": "1R6IVAiA2BciaURirHEWz2m148gX6XokU",
          "mode": "list",
          "cachedResultName": "Hey gen videos",
          "cachedResultUrl": "https://drive.google.com/drive/folders/1R6IVAiA2BciaURirHEWz2m148gX6XokU"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleDrive",
      "typeVersion": 3,
      "position": [
        1200,
        -240
      ],
      "id": "2b946623-8a9e-4586-8efb-173b02dcb046",
      "name": "Upload Video to Gdrive",
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "P3fdcC0Pu8BryPwf",
          "name": "N8n X Ankittalks"
        }
      }
    },
    {
      "parameters": {
        "select": "channel",
        "channelId": {
          "__rl": true,
          "value": "C07UQQ1GNAE",
          "mode": "list",
          "cachedResultName": "social"
        },
        "text": "Hey, a new video from Heygen is ready for editing",
        "otherOptions": {}
      },
      "type": "n8n-nodes-base.slack",
      "typeVersion": 2.3,
      "position": [
        1216,
        -32
      ],
      "id": "0bee92dd-049e-4c0e-b4bb-fbbac8fd7484",
      "name": "Update on slack",
      "webhookId": "3994b19f-d812-4237-b8f1-9c78a0ffcac2",
      "credentials": {
        "slackApi": {
          "id": "IZ7E8Dvn9r9iXnHc",
          "name": "Slack X n8n"
        }
      }
    },
    {
      "parameters": {
        "resource": "speech",
        "voice": {
          "__rl": true,
          "value": "21m00Tcm4TlvDq8ikWAM",
          "mode": "list",
          "cachedResultName": "Rachel"
        },
        "text": "={{ $json.Script }}",
        "additionalOptions": {},
        "requestOptions": {}
      },
      "type": "@elevenlabs/n8n-nodes-elevenlabs.elevenLabs",
      "typeVersion": 1,
      "position": [
        320,
        -304
      ],
      "id": "3531b248-55a5-428d-be0d-359692301a32",
      "name": "Convert text to speech",
      "credentials": {
        "elevenLabsApi": {
          "id": "iVyxcJjTzLszsJ98",
          "name": "N8n X ankittalks"
        }
      }
    },
    {
      "parameters": {
        "documentId": {
          "__rl": true,
          "value": "1CUeOy5TKo9bSPKgQPgzZwCXUfct_qNr8szAuAJDN-uI",
          "mode": "list",
          "cachedResultName": "AI video Gneration",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1CUeOy5TKo9bSPKgQPgzZwCXUfct_qNr8szAuAJDN-uI/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": "gid=0",
          "mode": "list",
          "cachedResultName": "Status sheet",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1CUeOy5TKo9bSPKgQPgzZwCXUfct_qNr8szAuAJDN-uI/edit#gid=0"
        },
        "filtersUI": {
          "values": [
            {
              "lookupColumn": "Status",
              "lookupValue": "Generate Audio"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.7,
      "position": [
        112,
        -304
      ],
      "id": "7ab93359-dfc2-4b17-8f38-4961ce3c71a5",
      "name": "Get row(s) in sheet",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "tY0FJBuJ7JTKB0im",
          "name": "N8n X Google"
        }
      }
    },
    {
      "parameters": {
        "name": "Test",
        "driveId": {
          "__rl": true,
          "value": "My Drive",
          "mode": "list",
          "cachedResultName": "My Drive",
          "cachedResultUrl": "https://drive.google.com/drive/my-drive"
        },
        "folderId": {
          "__rl": true,
          "value": "13VaTiYZGzEAM5mVUnr-MbQiSkodc-Gv1",
          "mode": "list",
          "cachedResultName": "Eleven Labs Audio",
          "cachedResultUrl": "https://drive.google.com/drive/folders/13VaTiYZGzEAM5mVUnr-MbQiSkodc-Gv1"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleDrive",
      "typeVersion": 3,
      "position": [
        528,
        -304
      ],
      "id": "bce85cf1-1e20-438a-8ab6-93da87c1875f",
      "name": "Upload file",
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "P3fdcC0Pu8BryPwf",
          "name": "N8n X Ankittalks"
        }
      }
    },
    {
      "parameters": {
        "operation": "update",
        "documentId": {
          "__rl": true,
          "value": "1CUeOy5TKo9bSPKgQPgzZwCXUfct_qNr8szAuAJDN-uI",
          "mode": "list",
          "cachedResultName": "AI video Gneration",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1CUeOy5TKo9bSPKgQPgzZwCXUfct_qNr8szAuAJDN-uI/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": "gid=0",
          "mode": "list",
          "cachedResultName": "Status sheet",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1CUeOy5TKo9bSPKgQPgzZwCXUfct_qNr8szAuAJDN-uI/edit#gid=0"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "Status": "Audio Generated",
            "row_number": "={{ $('Get row(s) in sheet').item.json.row_number }}",
            "Audio URL": "={{ $json.webViewLink }}"
          },
          "matchingColumns": [
            "row_number"
          ],
          "schema": [
            {
              "id": "Title",
              "displayName": "Title",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Script",
              "displayName": "Script",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Audio URL",
              "displayName": "Audio URL",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "Video URL",
              "displayName": "Video URL",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Status",
              "displayName": "Status",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "displayName": "row_number",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "number",
              "canBeUsedToMatch": true,
              "readOnly": true,
              "removed": false
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.7,
      "position": [
        256,
        -64
      ],
      "id": "22489e67-76e4-4a08-bb3c-9d6a5364fb95",
      "name": "Update row in sheet",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "tY0FJBuJ7JTKB0im",
          "name": "N8n X Google"
        }
      }
    },
    {
      "parameters": {
        "rule": {
          "interval": [
            {}
          ]
        }
      },
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [
        -176,
        -208
      ],
      "id": "962cce4b-9843-42d4-abd7-12a4702c91f6",
      "name": "Schedule Trigger1"
    },
    {
      "parameters": {
        "operation": "update",
        "documentId": {
          "__rl": true,
          "value": "1CUeOy5TKo9bSPKgQPgzZwCXUfct_qNr8szAuAJDN-uI",
          "mode": "list",
          "cachedResultName": "AI video Gneration",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1CUeOy5TKo9bSPKgQPgzZwCXUfct_qNr8szAuAJDN-uI/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": "gid=0",
          "mode": "list",
          "cachedResultName": "Status sheet",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1CUeOy5TKo9bSPKgQPgzZwCXUfct_qNr8szAuAJDN-uI/edit#gid=0"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "Status": "Video Generated",
            "row_number": "={{ $('Get row(s) in sheet').item.json.row_number }}",
            "Video URL": "={{ $json.webContentLink }}"
          },
          "matchingColumns": [
            "row_number"
          ],
          "schema": [
            {
              "id": "Title",
              "displayName": "Title",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Avatar Name",
              "displayName": "Avatar Name",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Avatar ID",
              "displayName": "Avatar ID",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Script",
              "displayName": "Script",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Audio URL",
              "displayName": "Audio URL",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Video URL",
              "displayName": "Video URL",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Status",
              "displayName": "Status",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "displayName": "row_number",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "number",
              "canBeUsedToMatch": true,
              "readOnly": true,
              "removed": false
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.7,
      "position": [
        1392,
        -240
      ],
      "id": "55f98c59-d875-4ef6-8b19-3e2c020e7e7d",
      "name": "Update row in sheet1",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "tY0FJBuJ7JTKB0im",
          "name": "N8n X Google"
        }
      }
    },
    {
      "parameters": {
        "url": "=https://api.heygen.com/v1/video_status.get?video_id={{ $json.data.id }}",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "options": {}
      },
      "id": "b0f9326b-84a7-4d08-8aed-11eafed9ec89",
      "name": "Check Video Status1",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        1216,
        160
      ],
      "credentials": {
        "httpHeaderAuth": {
          "id": "lrUHhiCvWE4zyfdC",
          "name": "Heygen X Ankittalks"
        }
      }
    }
  ],
  "pinData": {},
  "connections": {
    "Check Video Status": {
      "main": [
        [
          {
            "node": "Completed?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait for Processing": {
      "main": [
        [
          {
            "node": "Check Video Status1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait1": {
      "main": [
        [
          {
            "node": "Check Video Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Execute workflow’": {
      "main": [
        [
          {
            "node": "Get row(s) in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate AI video": {
      "main": [
        [
          {
            "node": "Wait1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Completed?": {
      "main": [
        [
          {
            "node": "Download AI Video",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait for Processing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download AI Video": {
      "main": [
        [
          {
            "node": "Upload Video to Gdrive",
            "type": "main",
            "index": 0
          },
          {
            "node": "Update on slack",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get row(s) in sheet": {
      "main": [
        [
          {
            "node": "Convert text to speech",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert text to speech": {
      "main": [
        [
          {
            "node": "Upload file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload file": {
      "main": [
        [
          {
            "node": "Update row in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger1": {
      "main": [
        [
          {
            "node": "Get row(s) in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update row in sheet": {
      "main": [
        [
          {
            "node": "Generate AI video",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload Video to Gdrive": {
      "main": [
        [
          {
            "node": "Update row in sheet1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Video Status1": {
      "main": [
        [
          {
            "node": "Completed?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "d0c5cbb7-9173-4df4-a4a1-68a22a6fc70e",
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "77f1d8375380ee2bc4995763b4e39528bf040d446fc3e9e5f6d802ec19784049"
  },
  "id": "xNcS3h2m6wXp09Yw",
  "tags": []
}