Discussions

Ask a Question
Back to All

template API endpoint - generate video

getting a "bad request" error when i run this node in my n8n workflow. error states a bad parameter or variable in JSON. can you look at this and tell me what I need to fix?

Thanks.

{
"nodes": [
{
"parameters": {
"method": "POST",
"url": "={{ "https://api.heygen.com/v2/template/\" + $('Get Setup Info').item.json['HG Avatar ID'] + "/generate" }}",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "X-Api-Key",
"value": "={{ $('Get Setup Info').item.json['HG API'] }}"
}
]
},
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={\n "video_inputs": [\n {\n "error": null,\n "data": {\n "templates": [\n {\n "template_id": "{{ $('Get Setup Info').item.json['HG Avatar ID'] }}"\n }\n ],\n "voice": {\n "type": "text",\n "input_text": "{{ $('Recent News Agent').item.json.output.spoken_text }}",\n "voice_id": "{{ $('Get Setup Info').item.json['HG Voice ID'] }}"\n }\n }\n }\n ],\n "caption": false,\n "dimension": {\n "width": 1280,\n "height": 720\n }\n}",
"options": {}
},
"id": "43a11eaa-db04-4e6c-85cb-69727470142a",
"name": "Generate Video",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
-300,
560
]
}
],
"connections": {
"Generate Video": {
"main": [
[]
]
}
},
"pinData": {}
}