Skip to content

Instantly share code, notes, and snippets.

@sfkaos
Created December 11, 2025 15:01
Show Gist options
  • Select an option

  • Save sfkaos/3d7eb2a6e53a3d653bd79bb0180ee807 to your computer and use it in GitHub Desktop.

Select an option

Save sfkaos/3d7eb2a6e53a3d653bd79bb0180ee807 to your computer and use it in GitHub Desktop.
Motivational video n8n workflow
{
"name": "Motivational Video Generator",
"nodes": [
{
"parameters": {
"modelId": {
"__rl": true,
"value": "gpt-4.1-mini",
"mode": "list",
"cachedResultName": "GPT-4.1-MINI"
},
"messages": {
"values": [
{
"content": "=You are an expert motivational copy-writer and visual-storyboard artist.\n\n**Goal** \nProduce a ~2-minute motivational speech (≈ 220–260 words) divided into coherent “scenes”. \n\n**Scene Structure** \n- **Scene 1 — Hook:** Immediately engage the viewer with the central <TOPIC>. \n- **Scenes 2 – 8/9 — Development (4–5 scenes):** Deeply explore the theme, evoke emotion, and build momentum. \n- **Final Scene — Uplift:** Leave the viewer with a clear, energizing call to improve their life. \n(=> total 9-10 scenes.)\n\n\nEach scene must contain: \n1. **voiceover_text** – the narration for that scene, written in <LANGUAGE>. \n2. **image_prompt** – a richly detailed, *photorealistic* English prompt that visually captures the scene’s message. \n • Maintain a consistent color palette, lighting style and overall aesthetic across every image to ensure harmony. \n • Avoid any mention or depiction of violence, gore, nudity, or other potentially NSFW elements.\n • Avoid generating images that include the appearance of human hands.\n \n\n**Input placeholders** \n- `<TOPIC>` – central theme of the speech (e.g., “overcoming self-doubt”). \n- `<LANGUAGE>` – language for the narration (e.g., “Spanish”). \n\n**Output format** – return pure JSON, no explanatory text: \n```json\n{\n \"title\": \"<Concise inspiring title>\",\n \"scenes\": [\n {\n \"voiceover_text\": \"<Scene 1 narration in <LANGUAGE>>\",\n \"image_prompt\": \"<Scene 1 photorealistic prompt in English>\"\n },\n ...\n ]\n}\n",
"role": "system"
},
{
"content": "=Topic: \"{{ $json.Topic }}\".\nTarget language: \"{{ $json.Language }}\"."
}
]
},
"jsonOutput": true,
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.openAi",
"typeVersion": 1.8,
"position": [256, 208],
"id": "b488031f-162c-4d17-883e-7c2e734101d3",
"name": "OpenAI",
"credentials": {
"openAiApi": {
"id": "dc8YdLQA5m8AVNUn",
"name": "OpenAi account 2"
}
}
},
{
"parameters": {
"rules": {
"values": [
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"leftValue": "={{ $json.movie.status }}",
"rightValue": "done",
"operator": {
"type": "string",
"operation": "equals"
},
"id": "c4cdadec-3a6a-4542-92f6-ebe0bee73f3c"
}
],
"combinator": "and"
},
"renameOutput": true,
"outputKey": "Done"
},
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "17c132d0-6142-4a07-b132-f28027949bec",
"leftValue": "={{ $json.movie.status }}",
"rightValue": "error",
"operator": {
"type": "string",
"operation": "equals",
"name": "filter.operator.equals"
}
}
],
"combinator": "and"
},
"renameOutput": true,
"outputKey": "Error"
},
{
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "b6381708-9a0d-4b23-9efc-fdfaccb2cbac",
"leftValue": "={{ $json.movie.status }}",
"rightValue": "",
"operator": {
"type": "string",
"operation": "notEmpty",
"singleValue": true
}
}
],
"combinator": "and"
},
"renameOutput": true,
"outputKey": "Still running"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.switch",
"typeVersion": 3.2,
"position": [1504, 208],
"id": "54b20f76-2b6e-466d-a56e-2eca29f167fd",
"name": "Switch"
},
{
"parameters": {
"errorMessage": "={{ $json.movie.message }}"
},
"type": "n8n-nodes-base.stopAndError",
"typeVersion": 1,
"position": [1824, 432],
"id": "1a73015b-865d-467c-b02d-3353e597497e",
"name": "Stop and Error"
},
{
"parameters": {
"content": "## Wait for the video to be rendered\n\nYou can expect about 3 - 4 minutes per video",
"height": 600,
"width": 700
},
"type": "n8n-nodes-base.stickyNote",
"position": [992, 0],
"typeVersion": 1,
"id": "caaa14f5-be2d-4f85-b59a-ab1690f1e1fe",
"name": "Sticky Note"
},
{
"parameters": {
"url": "https://api.json2video.com/v2/movies",
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "project",
"value": "={{ $('Submit a new job').item.json.project }}"
}
]
},
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "x-api-key",
"value": "s1gBmLtGLDn9UFiD0Wm9Ux5aewao7P20ecwcTc7I"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [1296, 208],
"id": "f30760b6-a649-4967-be6f-88374b1478ac",
"name": "Check status"
},
{
"parameters": {
"method": "POST",
"url": "https://api.json2video.com/v2/movies",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "x-api-key",
"value": "s1gBmLtGLDn9UFiD0Wm9Ux5aewao7P20ecwcTc7I"
}
]
},
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={\n \"template\": \"fOnm0pvJFwKBtwgcCDTk\",\n \"variables\": {\n \"voice_name\": \"{{ $('Airtable - Read').item.json['Voice Name'] }}\",\n \"voice_model\": \"{{ $('Airtable - Read').item.json['Voice Model'] }}\",\n \"image_model\": \"{{ $('Airtable - Read').item.json['Image Model'] }}\",\n \"subtitles_model\": \"{{ $('Airtable - Read').item.json['Subtitles Model'] }}\",\n \"subtitles_font\": \"{{ $('Airtable - Read').item.json['Subtitles Font'] }}\",\n \"scene_list\": {{ JSON.stringify($json.message.content.scenes) }},\n \"title_font\": \"{{ $('Airtable - Read').item.json['Title Font'] }}\",\n \"title\": \"{{ $json.message.content.title }}\"\n }\n}",
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [736, 208],
"id": "57f41d0b-f584-4213-91fa-3fab7cb33d77",
"name": "Submit a new job",
"notes": "From \n\nhttps://json2video.com/dashboard/apikeys"
},
{
"parameters": {
"amount": 15
},
"type": "n8n-nodes-base.wait",
"typeVersion": 1.1,
"position": [1072, 208],
"id": "aa3504ff-46c3-4ba2-a79a-df30dea27d90",
"name": "Wait for 15 seconds",
"webhookId": "ccb77f90-0b47-42fe-96b4-22d35ba46b46"
},
{
"parameters": {
"content": "## Ask ChatGPT to generate the script and image prompts",
"height": 600,
"width": 380
},
"type": "n8n-nodes-base.stickyNote",
"position": [192, 0],
"typeVersion": 1,
"id": "13f6f75b-564c-4578-adcd-e07b2e2ec926",
"name": "Sticky Note1"
},
{
"parameters": {
"content": "## Get the topic of the video to be created",
"height": 600,
"width": 480
},
"type": "n8n-nodes-base.stickyNote",
"position": [-304, 0],
"typeVersion": 1,
"id": "b6e656c0-6faa-417c-82c3-174ba4e58df6",
"name": "Sticky Note2"
},
{
"parameters": {
"content": "## Start the rendering job in JSON2Video\n\nCall the template passing the information from ChatGPT",
"height": 600,
"width": 384
},
"type": "n8n-nodes-base.stickyNote",
"position": [592, 0],
"typeVersion": 1,
"id": "8edadc41-5b74-4b61-a249-9f864f5c4c18",
"name": "Sticky Note3"
},
{
"parameters": {
"content": "## Update the Airtable row",
"height": 280,
"width": 304
},
"type": "n8n-nodes-base.stickyNote",
"position": [1712, 0],
"typeVersion": 1,
"id": "c7e74291-e894-4262-a2c6-2c6e414ba4b5",
"name": "Sticky Note4"
},
{
"parameters": {
"content": "## An error happened",
"height": 300,
"width": 304
},
"type": "n8n-nodes-base.stickyNote",
"position": [1712, 304],
"typeVersion": 1,
"id": "5370df1a-4fdb-4910-8f41-045d69249156",
"name": "Sticky Note5"
},
{
"parameters": {
"operation": "search",
"base": {
"__rl": true,
"value": "appLfxnRXaufzvtW3",
"mode": "list",
"cachedResultName": "Entertainment",
"cachedResultUrl": "https://airtable.com/appLfxnRXaufzvtW3"
},
"table": {
"__rl": true,
"value": "tblMhHNPUAkXfVq5b",
"mode": "list",
"cachedResultName": "Inspirational videos",
"cachedResultUrl": "https://airtable.com/appLfxnRXaufzvtW3/tblMhHNPUAkXfVq5b"
},
"filterByFormula": "AND( {Status} = \"Todo\", {Topic} != \"\" )",
"returnAll": false,
"options": {}
},
"type": "n8n-nodes-base.airtable",
"typeVersion": 2.1,
"position": [-112, 208],
"id": "4aa33cb1-8e0c-4c25-9d72-374b549bce2c",
"name": "Airtable - Read",
"credentials": {
"airtableTokenApi": {
"id": "gEecouqsTFTREzcN",
"name": "Airtable Personal Access Token account"
}
}
},
{
"parameters": {
"operation": "update",
"base": {
"__rl": true,
"value": "appLfxnRXaufzvtW3",
"mode": "list",
"cachedResultName": "Entertainment",
"cachedResultUrl": "https://airtable.com/appLfxnRXaufzvtW3"
},
"table": {
"__rl": true,
"value": "tblMhHNPUAkXfVq5b",
"mode": "list",
"cachedResultName": "Inspirational videos",
"cachedResultUrl": "https://airtable.com/appLfxnRXaufzvtW3/tblMhHNPUAkXfVq5b"
},
"columns": {
"mappingMode": "defineBelow",
"value": {
"Result": "={{ $json.movie.url }}",
"id": "={{ $('Airtable - Read').item.json.id }}",
"Status": "Done"
},
"matchingColumns": ["id"],
"schema": [
{
"id": "id",
"displayName": "id",
"required": false,
"defaultMatch": true,
"display": true,
"type": "string",
"readOnly": true,
"removed": false
},
{
"id": "ID",
"displayName": "ID",
"required": false,
"defaultMatch": false,
"canBeUsedToMatch": true,
"display": true,
"type": "string",
"readOnly": true,
"removed": true
},
{
"id": "Topic",
"displayName": "Topic",
"required": false,
"defaultMatch": false,
"canBeUsedToMatch": true,
"display": true,
"type": "string",
"readOnly": false,
"removed": false
},
{
"id": "Language",
"displayName": "Language",
"required": false,
"defaultMatch": false,
"canBeUsedToMatch": true,
"display": true,
"type": "string",
"readOnly": false,
"removed": false
},
{
"id": "Voice Name",
"displayName": "Voice Name",
"required": false,
"defaultMatch": false,
"canBeUsedToMatch": true,
"display": true,
"type": "string",
"readOnly": false,
"removed": false
},
{
"id": "Voice Model",
"displayName": "Voice Model",
"required": false,
"defaultMatch": false,
"canBeUsedToMatch": true,
"display": true,
"type": "string",
"readOnly": false,
"removed": false
},
{
"id": "Title Font",
"displayName": "Title Font",
"required": false,
"defaultMatch": false,
"canBeUsedToMatch": true,
"display": true,
"type": "string",
"readOnly": false,
"removed": false
},
{
"id": "Image Model",
"displayName": "Image Model",
"required": false,
"defaultMatch": false,
"canBeUsedToMatch": true,
"display": true,
"type": "string",
"readOnly": false,
"removed": false
},
{
"id": "Subtitles Model",
"displayName": "Subtitles Model",
"required": false,
"defaultMatch": false,
"canBeUsedToMatch": true,
"display": true,
"type": "string",
"readOnly": false,
"removed": false
},
{
"id": "Subtitles Font",
"displayName": "Subtitles Font",
"required": false,
"defaultMatch": false,
"canBeUsedToMatch": true,
"display": true,
"type": "string",
"readOnly": false,
"removed": false
},
{
"id": "Music URL",
"displayName": "Music URL",
"required": false,
"defaultMatch": false,
"canBeUsedToMatch": true,
"display": true,
"type": "string",
"readOnly": false,
"removed": false
},
{
"id": "Status",
"displayName": "Status",
"required": false,
"defaultMatch": false,
"canBeUsedToMatch": true,
"display": true,
"type": "options",
"options": [
{
"name": "Todo",
"value": "Todo"
},
{
"name": "In progress",
"value": "In progress"
},
{
"name": "Done",
"value": "Done"
}
],
"readOnly": false,
"removed": false
},
{
"id": "Result",
"displayName": "Result",
"required": false,
"defaultMatch": false,
"canBeUsedToMatch": true,
"display": true,
"type": "string",
"readOnly": false,
"removed": false
}
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {}
},
"type": "n8n-nodes-base.airtable",
"typeVersion": 2.1,
"position": [1824, 96],
"id": "3a64f1f6-00f6-4e94-8c35-223ce28e8966",
"name": "Airtable - Update",
"credentials": {
"airtableTokenApi": {
"id": "gEecouqsTFTREzcN",
"name": "Airtable Personal Access Token account"
}
}
},
{
"parameters": {
"pollTimes": {
"item": [
{
"mode": "everyMinute"
}
]
},
"authentication": "airtableTokenApi",
"baseId": {
"__rl": true,
"value": "appLfxnRXaufzvtW3",
"mode": "id"
},
"tableId": {
"__rl": true,
"value": "https://airtable.com/appLfxnRXaufzvtW3/tblMhHNPUAkXfVq5b/viwKS3iniqu0PSNca?blocks=show",
"mode": "url"
},
"triggerField": "=Last Modified",
"additionalFields": {}
},
"type": "n8n-nodes-base.airtableTrigger",
"typeVersion": 1,
"position": [-512, 208],
"id": "8e667b8b-8f74-4503-9960-ccb073356a6b",
"name": "Airtable Trigger",
"credentials": {
"airtableTokenApi": {
"id": "gEecouqsTFTREzcN",
"name": "Airtable Personal Access Token account"
}
}
}
],
"pinData": {},
"connections": {
"OpenAI": {
"main": [
[
{
"node": "Submit a new job",
"type": "main",
"index": 0
}
]
]
},
"Switch": {
"main": [
[
{
"node": "Airtable - Update",
"type": "main",
"index": 0
}
],
[
{
"node": "Stop and Error",
"type": "main",
"index": 0
}
],
[
{
"node": "Wait for 15 seconds",
"type": "main",
"index": 0
}
]
]
},
"Check status": {
"main": [
[
{
"node": "Switch",
"type": "main",
"index": 0
}
]
]
},
"Submit a new job": {
"main": [
[
{
"node": "Wait for 15 seconds",
"type": "main",
"index": 0
}
]
]
},
"Wait for 15 seconds": {
"main": [
[
{
"node": "Check status",
"type": "main",
"index": 0
}
]
]
},
"Airtable - Read": {
"main": [
[
{
"node": "OpenAI",
"type": "main",
"index": 0
}
]
]
},
"Airtable Trigger": {
"main": [
[
{
"node": "Airtable - Read",
"type": "main",
"index": 0
}
]
]
}
},
"active": true,
"settings": {
"executionOrder": "v1"
},
"versionId": "580b5f0b-8b98-4847-945b-cb3a4ed226b1",
"meta": {
"templateCredsSetupCompleted": true,
"instanceId": "6235b895b8f39b8441c0897a1ee527285a6f406197061618c73ee18b7cb327ed"
},
"id": "aWqxKN9SGXs2Jb1G",
"tags": []
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment