{
  "name": "Tool - Generate Talking Avatar",
  "nodes": [
    {
      "parameters": {
        "workflowInputs": {
          "values": [
            {
              "name": "script"
            }
          ]
        }
      },
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "typeVersion": 1.1,
      "position": [
        0,
        0
      ],
      "id": "02136e22-d2ce-4c4e-972b-396335bd7d63",
      "name": "workflow_trigger"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.heygen.com/v2/video/generate",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n  \"video_inputs\": [\n    {\n      \"character\": {\n        \"type\": \"avatar\",\n        \"avatar_id\": \"2fcfd565e6c04285b970284703a06e2c\",\n        \"avatar_style\": \"normal\"\n      },\n      \"voice\": {\n        \"type\": \"text\",\n        \"input_text\": {{ JSON.stringify($json.script) }},\n        \"voice_id\": \"0de91825d8ff42ab8e18a2e5778b9ad4\"\n      },\n      \"background\": {\n        \"type\": \"color\",\n        \"value\": \"#008000\"\n      }\n    }\n  ],\n  \"dimension\": {\n    \"width\": 1080,\n    \"height\": 1920\n  }\n}",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        256,
        0
      ],
      "id": "b0a3a632-35e3-4fa3-9dc2-f024d6ae8d57",
      "name": "generate_avatar_video",
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {},
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        496,
        0
      ],
      "id": "8b38b151-aad5-42b2-a5eb-676b32889daf",
      "name": "wait"
    },
    {
      "parameters": {
        "url": "=https://api.heygen.com/v1/video_status.get?video_id={{ $('generate_avatar_video').item.json.data.video_id }}",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        752,
        0
      ],
      "id": "24f689c9-260f-4b60-ba10-1e8f3be03dd1",
      "name": "get_video_status",
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "67eff07a-23fb-471e-8864-6a7184def6f1",
              "leftValue": "={{ $json.data.status }}",
              "rightValue": "completed",
              "operator": {
                "type": "string",
                "operation": "equals",
                "name": "filter.operator.equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        1040,
        64
      ],
      "id": "8e452b67-937a-409b-9a67-988744f66ddb",
      "name": "check_status"
    },
    {
      "parameters": {
        "select": "channel",
        "channelId": {
          "__rl": true,
          "value": "=C08KC39K8DR",
          "mode": "id"
        },
        "text": "=*Here's the talking avatar video you requested*\n\n```\n{{ $('get_video_status').item.json.data.video_url }}\n```",
        "otherOptions": {
          "includeLinkToWorkflow": false
        }
      },
      "type": "n8n-nodes-base.slack",
      "typeVersion": 2.3,
      "position": [
        1360,
        48
      ],
      "id": "bd59ae75-3396-4590-8462-ec77053087c4",
      "name": "share_avatar_video",
      "credentials": {
        "slackApi": {
          "name": "<your credential>"
        }
      }
    }
  ],
  "connections": {
    "workflow_trigger": {
      "main": [
        [
          {
            "node": "generate_avatar_video",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "generate_avatar_video": {
      "main": [
        [
          {
            "node": "wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "wait": {
      "main": [
        [
          {
            "node": "get_video_status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "get_video_status": {
      "main": [
        [
          {
            "node": "check_status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "check_status": {
      "main": [
        [
          {
            "node": "share_avatar_video",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "fe78b8f6-685a-47f6-9d97-9b6130dbebe7",
  "id": "cAoqlw91ctlvdqO8",
  "tags": []
}