تست ورکفلو
{
“name”: “YouTube Viral Video Workflow”,
“nodes”: [
{
“parameters”: {
“httpMethod”: “POST”,
“path”: “voice-webhook”,
“options”: {
“responseMode”: “lastNode”,
“responseData”: “allEntries”
}
},
“name”: “Webhook Audio Input”,
“type”: “n8n-nodes-base.webhook”,
“typeVersion”: 1,
“position”: [200, 300]
},
{
“parameters”: {
“url”: “={{$json[“body”][“file_url”]}}”,
“responseFormat”: “file”,
“binaryPropertyName”: “audioFile”
},
“name”: “Download Audio”,
“type”: “n8n-nodes-base.httpRequest”,
“typeVersion”: 2,
“position”: [450, 300]
},
{
“parameters”: {
“functionCode”: “const inputPath = ‘/tmp/input.oga’;\nconst outputPath = ‘/tmp/input.wav’;\nconst fs = require(‘fs’);\nfs.writeFileSync(inputPath, items[0].binary.audioFile.data, ‘base64’);\nconst { execSync } = require(‘child_process’);\nexecSync(`ffmpeg -i ${inputPath} -ar 16000 -ac 1 ${outputPath}`);\nitems[0].binary.wav = { data: fs.readFileSync(outputPath).toString(‘base64’), fileName: ‘input.wav’, mimeType: ‘audio/wav’ };\nreturn items;” },
“name”: “Convert Audio to WAV”,
“type”: “n8n-nodes-base.function”,
“typeVersion”: 1,
“position”: [700, 300]
},
{
“parameters”: {
“operation”: “transcribe”,
“model”: “whisper-1”,
“fileProperty”: “wav”
},
“name”: “Transcribe Audio”,
“type”: “n8n-nodes-base.openAi”,
“typeVersion”: 1,
“position”: [950, 300]
},
{
“parameters”: {
“model”: “gpt-4o-mini”,
“systemPrompt”: “تو یک تهیهکنندهٔ ویدیوی کوتاه و وایرال برای یوتیوب هستی. خروجی JSON: title, description, shots, voiceover, thumbnail_prompts, keywords.”,
“userPrompt”: “={{`کاربر دستور صوتی داده: “${$json[“text”]}” لطفاً اسکریپت و ویدیو وایرال بساز.`}}”
},
“name”: “Generate Video Script”,
“type”: “n8n-nodes-base.openAiChat”,
“typeVersion”: 1,
“position”: [1200, 300]
},
{
“parameters”: {
“operation”: “tts”,
“voice”: “alloy”,
“inputProperty”: “voiceover”,
“outputProperty”: “voiceAudio”
},
“name”: “Generate Voiceover”,
“type”: “n8n-nodes-base.elevenLabs”,
“typeVersion”: 1,
“position”: [1450, 300]
},
{
“parameters”: {
“functionCode”: “// فرض میکنیم لیست کلیپها و موسیقی آماده است\n// اینجا میتوان با Shotstack یا ffmpeg ترکیب کرد\nitems[0].json.finalVideoPath = ‘/tmp/final_video.mp4’;\nreturn items;” },
“name”: “Assemble Video”,
“type”: “n8n-nodes-base.function”,
“typeVersion”: 1,
“position”: [1700, 300]
},
{
“parameters”: {
“operation”: “upload”,
“title”: “={{$json[“title”]}}”,
“description”: “={{$json[“description”]}}”,
“tags”: “={{$json[“keywords”].join(“,”)}}”,
“privacyStatus”: “public”,
“file”: “/tmp/final_video.mp4”
},
“name”: “Upload to YouTube”,
“type”: “n8n-nodes-base.youtube”,
“typeVersion”: 1,
“position”: [1950, 300]
},
{
“parameters”: {
“chatId”: “<YOUR_TELEGRAM_CHAT_ID>”,
“text”: “ویدیوی جدید آپلود شد 🎬\nعنوان: {{$json[“title”]}}\nلینک: https://youtu.be/{{$json[“videoId”]}}”
},
“name”: “Telegram Notification”,
“type”: “n8n-nodes-base.telegram”,
“typeVersion”: 1,
“position”: [2200, 300]
}
],
“connections”: {
“Webhook Audio Input”: {“main”: [[{“node”: “Download Audio”,”type”: “main”,”index”: 0}]]},
“Download Audio”: {“main”: [[{“node”: “Convert Audio to WAV”,”type”: “main”,”index”: 0}]]},
“Convert Audio to WAV”: {“main”: [[{“node”: “Transcribe Audio”,”type”: “main”,”index”: 0}]]},
“Transcribe Audio”: {“main”: [[{“node”: “Generate Video Script”,”type”: “main”,”index”: 0}]]},
“Generate Video Script”: {“main”: [[{“node”: “Generate Voiceover”,”type”: “main”,”index”: 0}]]},
“Generate Voiceover”: {“main”: [[{“node”: “Assemble Video”,”type”: “main”,”index”: 0}]]},
“Assemble Video”: {“main”: [[{“node”: “Upload to YouTube”,”type”: “main”,”index”: 0}]]},
“Upload to YouTube”: {“main”: [[{“node”: “Telegram Notification”,”type”: “main”,”index”: 0}]]}
}
}
