Полное руководство по настройке системы автоматической генерации рекламных креативов для импорта автомобилей
Готовый JSON код для импорта:
Скопируйте код ниже и импортируйте его в N8N. Затем настройте все ID и credentials.
Инструкция по импорту:
- Скопируйте JSON код ниже
- В N8N нажмите "Import from JSON"
- Вставьте код
- Замените все YOUR_* значения на актуальные
- Настройте credentials для каждого узла
Замените следующие значения:
YOUR_GOOGLE_SHEET_ID
- ID вашей Google таблицы YOUR_GOOGLE_DRIVE_FOLDER_ID
- ID папки в Drive YOUR_TELEGRAM_CHAT_ID
- ваш Telegram Chat ID YOUR_*_CREDENTIALS_ID
- ID созданных credentials
{
"name": "Генерация автомобильных креативов",
"nodes": [
{
"parameters": {
"rule": {
"interval": [
{
"field": "hours",
"value": 1
}
]
}
},
"id": "a1b2c3d4-e5f6-7890-1234-567890abcdef",
"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": "Sheet1",
"range": "A:I",
"dataStartRow": 2,
"keyRow": 1
},
"id": "b2c3d4e5-f6g7-8901-2345-678901bcdefg",
"name": "Read Google Sheets",
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 4,
"position": [460, 300],
"credentials": {
"googleSheetsApi": {
"id": "YOUR_GOOGLE_CREDENTIALS_ID",
"name": "Google_Main"
}
}
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict"
},
"conditions": [
{
"id": "filter1",
"leftValue": "={{ $json.status }}",
"rightValue": "new",
"operator": {
"type": "string",
"operation": "equals"
}
}
],
"combinator": "and"
}
},
"id": "c3d4e5f6-g7h8-9012-3456-789012cdefgh",
"name": "Filter New Records",
"type": "n8n-nodes-base.filter",
"typeVersion": 2,
"position": [680, 300]
},
{
"parameters": {
"jsCode": "const items = $input.all();\nconst processedItems = [];\n\nfor (let i = 0; i < items.length; i++) {\n const item = items[i];\n const data = item.json;\n \n const prompt = `Рекламный креатив для импорта ${data.brand} ${data.model} ${data.year} из ${data.country}. В центре композиции элегантный автомобиль цвета ${data.color}. Добавить стильный текст \"ИМПОРТ ИЗ ${data.country.toUpperCase()} ЗА ${data.delivery_time}\" крупными буквами. Профессиональный стиль, премиальная подача, яркие контрастные цвета для текста. Композиция должна выглядеть как качественная реклама автомобильного бизнеса.`;\n \n const timestamp = Date.now();\n const filename = `${data.brand}_${data.model}_${data.year}_${timestamp}.jpg`;\n \n processedItems.push({\n json: {\n ...data,\n prompt: prompt,\n filename: filename,\n row_index: i + 2\n }\n });\n}\n\nreturn processedItems;"
},
"id": "d4e5f6g7-h8i9-0123-4567-890123defghi",
"name": "Process Data",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [900, 300]
},
{
"parameters": {
"resource": "image",
"operation": "generate",
"model": "dall-e-3",
"prompt": "={{ $json.prompt }}",
"size": "1024x1024",
"quality": "hd",
"responseFormat": "url"
},
"id": "e5f6g7h8-i9j0-1234-5678-901234efghij",
"name": "Generate Image",
"type": "n8n-nodes-base.openAi",
"typeVersion": 1,
"position": [1120, 300],
"credentials": {
"openAiApi": {
"id": "YOUR_OPENAI_CREDENTIALS_ID",
"name": "OpenAI_Main"
}
}
},
{
"parameters": {
"jsCode": "const imageUrl = $json.data[0].url;\nconst filename = $json.filename;\nconst originalData = $json;\n\nconst response = await fetch(imageUrl);\nif (!response.ok) {\n throw new Error(`HTTP error! status: ${response.status}`);\n}\n\nconst arrayBuffer = await response.arrayBuffer();\nconst buffer = Buffer.from(arrayBuffer);\n\nreturn [{\n json: {\n ...originalData,\n image_url: imageUrl\n },\n binary: {\n data: {\n data: buffer.toString('base64'),\n mimeType: 'image/jpeg',\n fileName: filename\n }\n }\n}];"
},
"id": "f6g7h8i9-j0k1-2345-6789-012345fghijk",
"name": "Download Image",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [1340, 300]
},
{
"parameters": {
"authentication": "serviceAccount",
"resource": "file",
"operation": "upload",
"name": "={{ $json.filename }}",
"binaryData": true,
"options": {
"parents": {
"values": ["YOUR_GOOGLE_DRIVE_FOLDER_ID"]
}
}
},
"id": "g7h8i9j0-k1l2-3456-7890-123456ghijkl",
"name": "Save to Drive",
"type": "n8n-nodes-base.googleDrive",
"typeVersion": 3,
"position": [1560, 300],
"credentials": {
"googleDriveApi": {
"id": "YOUR_GOOGLE_CREDENTIALS_ID",
"name": "Google_Main"
}
}
},
{
"parameters": {
"authentication": "serviceAccount",
"resource": "sheet",
"operation": "update",
"documentId": "YOUR_GOOGLE_SHEET_ID",
"sheetName": "Sheet1",
"range": "H{{ $json.row_index }}:I{{ $json.row_index }}",
"options": {
"valueInputOption": "USER_ENTERED"
},
"dataMode": "define",
"valueRange": {
"values": [
["done", "https://drive.google.com/file/d/{{ $json.id }}/view"]
]
}
},
"id": "h8i9j0k1-l2m3-4567-8901-234567hijklm",
"name": "Update Sheet Status",
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 4,
"position": [1780, 300],
"credentials": {
"googleSheetsApi": {
"id": "YOUR_GOOGLE_CREDENTIALS_ID",
"name": "Google_Main"
}
}
},
{
"parameters": {
"resource": "message",
"operation": "sendMessage",
"chatId": "YOUR_TELEGRAM_CHAT_ID",
"text": "✅ Креатив готов!\n\n???? {{ $json.brand }} {{ $json.model }} {{ $json.year }}\n???? Файл: {{ $json.filename }}\n???? Ссылка: https://drive.google.com/file/d/{{ $json.id }}/view"
},
"id": "i9j0k1l2-m3n4-5678-9012-345678ijklmn",
"name": "Send Telegram Notification",
"type": "n8n-nodes-base.telegram",
"typeVersion": 1,
"position": [2000, 300],
"credentials": {
"telegramApi": {
"id": "YOUR_TELEGRAM_CREDENTIALS_ID",
"name": "Telegram_Bot"
}
}
}
],
"connections": {
"Schedule Trigger": {
"main": [[{"node": "Read Google Sheets", "type": "main", "index": 0}]]
},
"Read Google Sheets": {
"main": [[{"node": "Filter New Records", "type": "main", "index": 0}]]
},
"Filter New Records": {
"main": [[{"node": "Process Data", "type": "main", "index": 0}]]
},
"Process Data": {
"main": [[{"node": "Generate Image", "type": "main", "index": 0}]]
},
"Generate Image": {
"main": [[{"node": "Download Image", "type": "main", "index": 0}]]
},
"Download Image": {
"main": [[{"node": "Save to Drive", "type": "main", "index": 0}]]
},
"Save to Drive": {
"main": [[{"node": "Update Sheet Status", "type": "main", "index": 0}]]
},
"Update Sheet Status": {
"main": [[{"node": "Send Telegram Notification", "type": "main", "index": 0}]]
}
}
}
Система готова к работе! Автоматическая генерация креативов запущена.
Время выполнения настройки: 8-11 часов | Ежемесячные затраты: $70-120