{
"name": "AI Agency Video Ad Generator",
"nodes": [
{
"parameters": {
"rule": {
"interval": [
{
"field": "cronExpression",
"value": "0 9 * * 1-5"
}
]
}
},
"id": "f8b5c1d2-3e4a-5b6c-7d8e-9f0a1b2c3d4e",
"name": "Schedule Trigger",
"type": "n8n-nodes-base.scheduleTrigger",
"typeVersion": 1.1,
"position": [
240,
300
]
},
{
"parameters": {
"authentication": "serviceAccount",
"resource": "sheet",
"operation": "read",
"documentId": "YOUR_GOOGLE_SHEET_ID",
"sheetName": "Video Ideas",
"range": "A:F",
"keyRow": 1,
"dataStartRow": 2
},
"id": "a1b2c3d4-e5f6-7g8h-9i0j-k1l2m3n4o5p6",
"name": "Read Video Ideas",
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 4,
"position": [
460,
300
]
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict"
},
"conditions": [
{
"leftValue": "={{ $json.status }}",
"rightValue": "pending",
"operator": {
"type": "string",
"operation": "equals"
}
}
],
"combinator": "and"
}
},
"id": "b2c3d4e5-f6g7-8h9i-0j1k-l2m3n4o5p6q7",
"name": "Filter Pending Ideas",
"type": "n8n-nodes-base.if",
"typeVersion": 2,
"position": [
680,
300
]
},
{
"parameters": {
"resource": "text",
"operation": "message",
"model": "gpt-4",
"messages": {
"messages": [
{
"role": "system",
"content": "You are a expert copywriter for AI agencies. Create compelling short-form video scripts (30-60 seconds) for social media ads. Focus on:\n- Problem/solution narratives\n- Clear value propositions\n- Professional yet engaging tone\n- Strong call-to-actions\n- Agency credibility building\n\nFormat as scene-by-scene breakdown with visual descriptions."
},
{
"role": "user",
"content": "Create a short-form video script for an AI agency ad based on this idea: {{ $json.idea }}\n\nTarget audience: {{ $json.target_audience }}\nAd type: {{ $json.ad_type }}\nKey message: {{ $json.key_message }}\n\nFormat each scene as:\nScene X: [Visual description]\nNarration: [Voiceover text]\nDuration: [seconds]"
}
]
},
"options": {
"temperature": 0.7,
"maxTokens": 1000
}
},
"id": "c3d4e5f6-g7h8-9i0j-1k2l-m3n4o5p6q7r8",
"name": "Generate Script",
"type": "n8n-nodes-base.openAi",
"typeVersion": 1,
"position": [
900,
300
]
},
{
"parameters": {
"jsCode": "// Parse the script and extract scenes\nconst script = $input.first().json.choices[0].message.content;\nconst scenes = [];\n\n// Split script into scenes\nconst sceneRegex = /Scene \\d+: (.+?)\\nNarration: (.+?)\\nDuration: (\\d+)/g;\nlet match;\n\nwhile ((match = sceneRegex.exec(script)) !== null) {\n scenes.push({\n visual: match[1],\n narration: match[2],\n duration: parseInt(match[3]),\n imagePrompt: `Professional business setting, ${match[1]}, modern AI technology, sleek corporate style, high quality, 4K`\n });\n}\n\n// Add metadata\nconst originalData = $input.first().json;\nconst result = {\n id: originalData.id,\n idea: originalData.idea,\n target_audience: originalData.target_audience,\n ad_type: originalData.ad_type,\n key_message: originalData.key_message,\n full_script: script,\n scenes: scenes,\n total_duration: scenes.reduce((sum, scene) => sum + scene.duration, 0)\n};\n\nreturn [result];"
},
"id": "d4e5f6g7-h8i9-0j1k-2l3m-n4o5p6q7r8s9",
"name": "Process Script",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
1120,
300
]
},
{
"parameters": {
"batchSize": 1,
"options": {}
},
"id": "e5f6g7h8-i9j0-1k2l-3m4n-o5p6q7r8s9t0",
"name": "Split Scenes",
"type": "n8n-nodes-base.splitInBatches",
"typeVersion": 3,
"position": [
1340,
300
]
},
{
"parameters": {
"url": "https://api.together.ai/v1/images/generations",
"authentication": "predefinedCredentialType",
"nodeCredentialType": "httpHeaderAuth",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "Authorization",
"value": "Bearer YOUR_TOGETHER_API_KEY"
}
]
},
"sendBody": true,
"bodyParameters": {
"parameters": [
{
"name": "model",
"value": "black-forest-labs/FLUX.1-schnell"
},
{
"name": "prompt",
"value": "={{ $json.imagePrompt }}"
},
{
"name": "width",
"value": 1024
},
{
"name": "height",
"value": 1024
},
{
"name": "steps",
"value": 4
},
{
"name": "n",
"value": 1
}
]
},
"options": {}
},
"id": "f6g7h8i9-j0k1-2l3m-4n5o-p6q7r8s9t0u1",
"name": "Generate Images",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.1,
"position": [
1560,
300
]
},
{
"parameters": {
"url": "https://api.kling.com/v1/videos/generations",
"authentication": "predefinedCredentialType",
"nodeCredentialType": "httpHeaderAuth",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "Authorization",
"value": "Bearer YOUR_KLING_API_KEY"
}
]
},
"sendBody": true,
"bodyParameters": {
"parameters": [
{
"name": "model",
"value": "kling-v1"
},
{
"name": "image_url",
"value": "={{ $json.data[0].url }}"
},
{
"name": "duration",
"value": 5
},
{
"name": "ratio",
"value": "9:16"
},
{
"name": "mode",
"value": "std"
}
]
},
"options": {}
},
"id": "g7h8i9j0-k1l2-3m4n-5o6p-q7r8s9t0u1v2",
"name": "Create Video Clips",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.1,
"position": [
1780,
300
]
},
{
"parameters": {
"resource": "speech",
"operation": "create",
"model": "eleven_multilingual_v2",
"text": "={{ $json.narration }}",
"voice": "Josh",
"options": {
"stability": 0.5,
"similarity_boost": 0.8,
"style": 0.2,
"use_speaker_boost": true
}
},
"id": "h8i9j0k1-l2m3-4n5o-6p7q-r8s9t0u1v2w3",
"name": "Generate Voiceover",
"type": "n8n-nodes-base.elevenlabs",
"typeVersion": 1,
"position": [
1560,
500
]
},
{
"parameters": {
"url": "https://api.creatomate.com/v1/renders",
"authentication": "predefinedCredentialType",
"nodeCredentialType": "httpHeaderAuth",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "Authorization",
"value": "Bearer YOUR_CREATOMATE_API_KEY"
}
]
},
"sendBody": true,
"bodyParameters": {
"parameters": [
{
"name": "template_id",
"value": "YOUR_TEMPLATE_ID"
},
{
"name": "modifications",
"value": "={\n \"video-clip\": $json.video_url,\n \"voiceover\": $json.audio_url,\n \"captions\": $json.narration,\n \"duration\": $json.duration,\n \"brand-logo\": \"YOUR_AGENCY_LOGO_URL\",\n \"cta-text\": \"Book Your Free AI Strategy Call\",\n \"website\": \"YourAgency.com\"\n}"
}
]
},
"options": {}
},
"id": "i9j0k1l2-m3n4-5o6p-7q8r-s9t0u1v2w3x4",
"name": "Assemble Video",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.1,
"position": [
2000,
300
]
},
{
"parameters": {
"jsCode": "// Wait for all scenes to be processed\nconst allScenes = $input.all();\nconst videoData = allScenes[0].json;\n\n// Combine all video URLs\nconst videoUrls = allScenes.map(scene => scene.json.url);\n\n// Create final video data\nconst finalVideo = {\n id: videoData.id,\n idea: videoData.idea,\n final_video_url: videoUrls[0], // Main video URL\n status: 'completed',\n created_at: new Date().toISOString(),\n duration: videoData.total_duration,\n scenes_count: videoUrls.length\n};\n\nreturn [finalVideo];"
},
"id": "j0k1l2m3-n4o5-6p7q-8r9s-t0u1v2w3x4y5",
"name": "Combine Results",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
2220,
300
]
},
{
"parameters": {
"authentication": "serviceAccount",
"resource": "sheet",
"operation": "update",
"documentId": "YOUR_GOOGLE_SHEET_ID",
"sheetName": "Video Ideas",
"range": "E{{ $json.id }}:F{{ $json.id }}",
"options": {
"valueInputOption": "USER_ENTERED"
},
"dataMode": "define",
"fieldsUi": {
"values": [
{
"row": [
{
"fieldId": "status",
"fieldValue": "={{ $json.status }}"
},
{
"fieldId": "video_url",
"fieldValue": "={{ $json.final_video_url }}"
}
]
}
]
}
},
"id": "k1l2m3n4-o5p6-7q8r-9s0t-u1v2w3x4y5z6",
"name": "Update Sheet",
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 4,
"position": [
2440,
300
]
},
{
"parameters": {
"resource": "message",
"operation": "sendText",
"chatId": "YOUR_TELEGRAM_CHAT_ID",
"text": "🎬 New AI Agency Video Ad Complete!\n\n📝 Idea: {{ $json.idea }}\n🎯 Target: {{ $json.target_audience }}\n⏱️ Duration: {{ $json.duration }}s\n🔗 Video: {{ $json.final_video_url }}\n\n✅ Ready for campaign deployment!"
},
"id": "l2m3n4o5-p6q7-8r9s-0t1u-v2w3x4y5z6a7",
"name": "Send Notification",
"type": "n8n-nodes-base.telegram",
"typeVersion": 1.1,
"position": [
2660,
300
]
}
],
"connections": {
"Schedule Trigger": {
"main": [
[
{
"node": "Read Video Ideas",
"type": "main",
"index": 0
}
]
]
},
"Read Video Ideas": {
"main": [
[
{
"node": "Filter Pending Ideas",
"type": "main",
"index": 0
}
]
]
},
"Filter Pending Ideas": {
"main": [
[
{
"node": "Generate Script",
"type": "main",
"index": 0
}
]
]
},
"Generate Script": {
"main": [
[
{
"node": "Process Script",
"type": "main",
"index": 0
}
]
]
},
"Process Script": {
"main": [
[
{
"node": "Split Scenes",
"type": "main",
"index": 0
}
]
]
},
"Split Scenes": {
"main": [
[
{
"node": "Generate Images",
"type": "main",
"index": 0
},
{
"node": "Generate Voiceover",
"type": "main",
"index": 0
}
]
]
},
"Generate Images": {
"main": [
[
{
"node": "Create Video Clips",
"type": "main",
"index": 0
}
]
]
},
"Create Video Clips": {
"main": [
[
{
"node": "Assemble Video",
"type": "main",
"index": 0
}
]
]
},
"Generate Voiceover": {
"main": [
[
{
"node": "Assemble Video",
"type": "main",
"index": 0
}
]
]
},
"Assemble Video": {
"main": [
[
{
"node": "Combine Results",
"type": "main",
"index": 0
}
]
]
},
"Combine Results": {
"main": [
[
{
"node": "Update Sheet",
"type": "main",
"index": 0
}
]
]
},
"Update Sheet": {
"main": [
[
{
"node": "Send Notification",
"type": "main",
"index": 0
}
]
]
}
},
"settings": {
"executionOrder": "v1"
},
"staticData": null,
"tags": [
{
"createdAt": "2024-01-01T00:00:00.000Z",
"updatedAt": "2024-01-01T00:00:00.000Z",
"id": "tag1",
"name": "AI Agency"
},
{
"createdAt": "2024-01-01T00:00:00.000Z",
"updatedAt": "2024-01-01T00:00:00.000Z",
"id": "tag2",
"name": "Video Generation"
}
],
"meta": {
"templateCredsSetupCompleted": true
},
"id": "ai-agency-video-workflow",
"versionId": "1"
}