{
  "name": "Resume to AI Avatar Video",
  "nodes": [
    {
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.2,
      "position": [
        60,
        120
      ],
      "id": "56fe1a2a-c4fd-4aca-8973-08f3b712f320",
      "name": "OpenAI Chat Model",
      "credentials": {
        "openAiApi": {
          "id": "xYObejx0eIkwMS86",
          "name": "OpenAI account"
        }
      }
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://upload.heygen.com/v1/talking_photo",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "image/jpeg"
            },
            {
              "name": "x-api-key",
              "value": "api_key"
            }
          ]
        },
        "sendBody": true,
        "contentType": "binaryData",
        "inputDataFieldName": "=image",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        200,
        280
      ],
      "id": "8711d7bb-76fe-4138-8702-813f8d0ea3fc",
      "name": "Talk image id generate"
    },
    {
      "parameters": {
        "operation": "pdf",
        "binaryPropertyName": "Resume",
        "options": {}
      },
      "type": "n8n-nodes-base.extractFromFile",
      "typeVersion": 1,
      "position": [
        -60,
        -20
      ],
      "id": "9d400990-63ed-4803-a7b8-f16afa5e6a88",
      "name": "Extract Resume"
    },
    {
      "parameters": {
        "text": "={{ $json.text }}",
        "attributes": {
          "attributes": [
            {
              "name": "name",
              "description": "extract name",
              "required": true
            },
            {
              "name": "JobTitle",
              "description": "extract JobTitle",
              "required": true
            },
            {
              "name": "skill",
              "description": "extract skill",
              "required": true
            },
            {
              "name": "Education",
              "description": "extract Education",
              "required": true
            },
            {
              "name": "Summary",
              "description": "extract Summary",
              "required": true
            }
          ]
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.informationExtractor",
      "typeVersion": 1,
      "position": [
        100,
        -20
      ],
      "id": "275b7965-7359-4e8c-88c0-0b5b4cdc1ba8",
      "name": "Resume Information Extractor"
    },
    {
      "parameters": {
        "mode": "combine",
        "combineBy": "combineByPosition",
        "options": {}
      },
      "type": "n8n-nodes-base.merge",
      "typeVersion": 3.1,
      "position": [
        820,
        140
      ],
      "id": "b16a7d2b-054c-4238-9791-6b565cb136b2",
      "name": "Merge Image & Script"
    },
    {
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "id": "e6be6c7b-ac6b-4dc1-b242-a11afbbbfa2f",
                    "leftValue": "={{ $json.choices[0].message.content.gender }}",
                    "rightValue": "Male",
                    "operator": {
                      "type": "string",
                      "operation": "equals",
                      "name": "filter.operator.equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "Male"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "id": "74004d64-c27f-4026-82f4-0dcd40c7aba3",
                    "leftValue": "={{ $json.choices[0].message.content.gender }}",
                    "rightValue": "Female",
                    "operator": {
                      "type": "string",
                      "operation": "equals",
                      "name": "filter.operator.equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "Female"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.switch",
      "typeVersion": 3.2,
      "position": [
        1000,
        140
      ],
      "id": "43acb4d3-dbce-4afe-bb71-37dd78c7e941",
      "name": "Switch to Male & Female"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.heygen.com/v2/video/generate",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "X-Api-Key",
              "value": "api_key"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n  \"video_inputs\": [\n    {\n      \"character\": {\n        \"type\": \"talking_photo\",\n        \"talking_photo_id\": \"{{ $json.data.talking_photo_id }}\"\n      },\n      \"voice\": {\n        \"type\": \"text\",\n        \"input_text\": \"{{ $json.choices[0].message.content.script }}\",\n        \"voice_id\": \"2cfa7550c4dc41c7bd1b0751e7903332\"\n      },\n      \"background\": {\n        \"type\": \"color\",\n        \"value\": \"#FAFAFA\"\n      }\n    }\n  ]\n} ",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        1240,
        40
      ],
      "id": "56f014cb-5897-46d8-8d5a-69e2175ba7b9",
      "name": "Generate Male Voice Video"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.heygen.com/v2/video/generate",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "X-Api-Key",
              "value": "api_key"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n  \"video_inputs\": [\n    {\n      \"character\": {\n        \"type\": \"talking_photo\",\n        \"talking_photo_id\": \"{{ $json.data.talking_photo_id }}\"\n      },\n      \"voice\": {\n        \"type\": \"text\",\n        \"input_text\": \"{{ $json.choices[0].message.content.script }}\",\n        \"voice_id\": \"293ebc69dad345fc9dd1d542bc900673\"\n      },\n      \"background\": {\n        \"type\": \"color\",\n        \"value\": \"#FAFAFA\"\n      }\n    }\n  ]\n} ",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        1240,
        240
      ],
      "id": "84d826a3-70c1-47dc-a3b9-c1658ff6353d",
      "name": "Generate Female Voice Video"
    },
    {
      "parameters": {
        "amount": 3,
        "unit": "minutes"
      },
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        1460,
        140
      ],
      "id": "f12b3567-f074-4cac-845b-0996ad3a60c2",
      "name": "Wait",
      "webhookId": "0ff52e6c-b05c-4fb4-b087-bfef4d7b7820"
    },
    {
      "parameters": {
        "url": "=https://api.heygen.com/v1/video_status.get?video_id={{ $json.data.video_id }}",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Accept",
              "value": "application/json"
            },
            {
              "name": "X-Api-Key",
              "value": "api_key"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        1660,
        140
      ],
      "id": "4eefc524-1b7f-48e7-bf7b-5934c2ffdb8e",
      "name": "Check Status Video"
    },
    {
      "parameters": {
        "modelId": {
          "__rl": true,
          "value": "gpt-4o-mini",
          "mode": "list",
          "cachedResultName": "GPT-4O-MINI"
        },
        "messages": {
          "values": [
            {
              "content": "=- Name: {{ $json.output.name }}\n- Job Title: {{ $json.output.JobTitle }}\n- Skills: {{ $json.output.skill }}\n- Education: {{ $json.output.Education }}\n- Summary: {{ $json.output.Summary }}"
            },
            {
              "content": "=You are an AI assistant trained to:\n\n1. Predict the most likely gender associated with a given human name.\n2. Write a friendly, confident, and concise 30-second video self-introduction script based on that name.\n\nInstructions:\n- Use cultural context if provided (e.g., USA, UK, etc.) to infer gender more accurately.\n- If a name is unisex or unclear, respond with “Unisex” or “Unknown” accordingly.\n- Keep the tone of the script warm, professional, and engaging.\n- Use only the full name provided.\n- Do NOT fabricate background details. Keep it general and personal.\n\nInput:\nName: {{ $json.output.name }}\nRegion (optional): {{ $json.output.region }}\n\nOutput JSON format:\n{\n  \"gender\": \"Male | Female\",\n  \"script\": \"\"\n}\n",
              "role": "system"
            }
          ]
        },
        "simplify": false,
        "jsonOutput": true,
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "typeVersion": 1.8,
      "position": [
        420,
        -20
      ],
      "id": "070be57f-ff6e-4146-ba80-75990a3cd3ef",
      "name": "Generate Script & Find Gender",
      "credentials": {
        "openAiApi": {
          "id": "xYObejx0eIkwMS86",
          "name": "OpenAI account"
        }
      }
    },
    {
      "parameters": {
        "operation": "append",
        "documentId": {
          "__rl": true,
          "value": "1jQtu4ZREsMge8elB-6xJoOMDMKsJLqof2dDmh0sxqWk",
          "mode": "list",
          "cachedResultName": "Image talk video"
        },
        "sheetName": {
          "__rl": true,
          "value": "gid=0",
          "mode": "list",
          "cachedResultName": "Sheet1"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "Video Url": "={{ $json.data.video_url }}",
            "Script": "={{ $('Generate Script & Find Gender').item.json.choices[0].message.content.script }}",
            "Talking Photo ID": "={{ $('Talk image id generate').item.json.data.talking_photo_id }}",
            "Photo": "={{ $('Talk image id generate').item.json.data.talking_photo_url }}"
          },
          "matchingColumns": [],
          "schema": [
            {
              "id": "Talking Photo ID",
              "displayName": "Talking Photo ID",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "Photo",
              "displayName": "Photo",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "Script",
              "displayName": "Script",
              "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": false
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.5,
      "position": [
        2080,
        140
      ],
      "id": "f79cdeca-0bdb-4ba0-bf47-b2220165e331",
      "name": "Append video",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "Pjxuoti0ywJ2OIzZ",
          "name": "Google Sheets account"
        }
      }
    },
    {
      "parameters": {
        "formTitle": "Create video using Resume and Image",
        "formDescription": "Upload Image and Resume",
        "formFields": {
          "values": [
            {
              "fieldLabel": "image",
              "fieldType": "file",
              "multipleFiles": false,
              "acceptFileTypes": ".jpeg, .png, .jpg",
              "requiredField": true
            },
            {
              "fieldLabel": "Resume",
              "fieldType": "file",
              "multipleFiles": false,
              "acceptFileTypes": ".pdf, .docs",
              "requiredField": true
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.formTrigger",
      "typeVersion": 2.2,
      "position": [
        -320,
        125
      ],
      "id": "b4a74e9b-ff65-434a-b49e-15e7d7e42aa5",
      "name": "Upload Resume & Photo",
      "webhookId": "88a28561-dcef-4497-a4ba-42cc63330e79"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "41275522-0868-4901-8d9e-88c0a50166f6",
              "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": [
        1860,
        140
      ],
      "id": "45fb5d54-bfc8-4956-8aec-e266abebde95",
      "name": "Video is Completed or Not"
    },
    {
      "parameters": {
        "content": "## Data Setup\nCreate your own spreadsheet with these tabs/columns, then select it in the Google Sheets nodes:\n- **Image talk video → Sheet1**: `Talking Photo ID`, `Photo`, `Script`, `Video Url`",
        "height": 120,
        "width": 560
      },
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -360,
        -220
      ],
      "typeVersion": 1,
      "id": "8a85e740-b7df-4602-b471-72231a12b644",
      "name": "Sticky Note"
    }
  ],
  "pinData": {},
  "connections": {
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Resume Information Extractor",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Talk image id generate": {
      "main": [
        [
          {
            "node": "Merge Image & Script",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Extract Resume": {
      "main": [
        [
          {
            "node": "Resume Information Extractor",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Resume Information Extractor": {
      "main": [
        [
          {
            "node": "Generate Script & Find Gender",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge Image & Script": {
      "main": [
        [
          {
            "node": "Switch to Male & Female",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch to Male & Female": {
      "main": [
        [
          {
            "node": "Generate Male Voice Video",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Generate Female Voice Video",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Male Voice Video": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Female Voice Video": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait": {
      "main": [
        [
          {
            "node": "Check Status Video",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Status Video": {
      "main": [
        [
          {
            "node": "Video is Completed or Not",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Script & Find Gender": {
      "main": [
        [
          {
            "node": "Merge Image & Script",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload Resume & Photo": {
      "main": [
        [
          {
            "node": "Extract Resume",
            "type": "main",
            "index": 0
          },
          {
            "node": "Talk image id generate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Video is Completed or Not": {
      "main": [
        [
          {
            "node": "Append video",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "fbab423e-a017-41a2-9dc4-b6ce7742b626",
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "f1c26778ec36097a9722a22c47c5e9c01f00b8862dadd0121ec118026a370fa6"
  },
  "id": "507E3W5NRIJPUMRO",
  "tags": []
}