This workflow corresponds to n8n.io template #8965 — we link there as the canonical source.
The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"id": "d5hNboOM0rOzbBmJ",
"meta": {
"templateCredsSetupCompleted": true
},
"name": "LATE concurs - AI-Generated Social Media Posting",
"tags": [
{
"id": "gqMRU2Ba1YgqAZJU",
"name": "AI-Content",
"createdAt": "2025-09-11T13:08:29.370Z",
"updatedAt": "2025-09-11T13:08:29.370Z"
},
{
"id": "du9UO8LEzUxQnXv8",
"name": "Late-API",
"createdAt": "2025-09-11T13:08:29.378Z",
"updatedAt": "2025-09-11T13:08:29.378Z"
},
{
"id": "Umt6EEscWk5FFCzQ",
"name": "Gemini-2.5",
"createdAt": "2025-09-11T13:08:29.375Z",
"updatedAt": "2025-09-11T13:08:29.375Z"
},
{
"id": "7byhvdWLMWaM0kWg",
"name": "Social-Media",
"createdAt": "2025-09-11T18:06:17.589Z",
"updatedAt": "2025-09-11T18:06:17.589Z"
},
{
"id": "bE1BiWObzyUr42HD",
"name": "AI-Automation",
"createdAt": "2025-09-11T18:06:17.589Z",
"updatedAt": "2025-09-11T18:06:17.589Z"
}
],
"nodes": [
{
"id": "692d61fc-b2aa-4773-a890-06f4050300d7",
"name": "Check Enabled Platforms",
"type": "n8n-nodes-base.if",
"position": [
-320,
320
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 1,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "or",
"conditions": [
{
"id": "fb-enable-check",
"operator": {
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.ENABLE_FACEBOOK }}",
"rightValue": "true"
},
{
"id": "insta-enable-check",
"operator": {
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.ENABLE_INSTAGRAM }}",
"rightValue": "true"
},
{
"id": "tiktok-enable-check",
"operator": {
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.ENABLE_TIKTOK }}",
"rightValue": "true"
},
{
"id": "linkedin-enable-check",
"operator": {
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.ENABLE_LINKEDIN }}",
"rightValue": "true"
}
]
}
},
"typeVersion": 2.1
},
{
"id": "a4b59691-373c-4431-893b-ff1c4626d8cc",
"name": "Gemini - Generate Content",
"type": "n8n-nodes-base.httpRequest",
"position": [
-64,
176
],
"parameters": {
"url": "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent",
"method": "POST",
"options": {},
"jsonBody": "={\n \"contents\": [\n {\n \"parts\": [\n {\n \"text\": \"Create social media content for {{ $json.BUSINESS_TYPE }}. Generate content optimized for:\\n- Facebook: Professional but friendly, 100-150 chars\\n- Instagram: Visual focus, storytelling, include emojis, 125 chars\\n- TikTok: Trendy, Gen-Z friendly, viral potential, 80 chars\\n- LinkedIn: Professional, thought leadership, 120 chars\\n\\nTopic: {{ $json.CONTENT_TOPIC }}\\n\\nReturn as JSON with keys: topic, facebook, instagram, tiktok, linkedin, hashtags, bestTime\"\n }\n ]\n }\n ],\n \"generationConfig\": {\n \"temperature\": 0.8,\n \"maxOutputTokens\": 1024,\n \"responseMimeType\": \"application/json\"\n }\n}",
"sendBody": true,
"specifyBody": "json",
"authentication": "predefinedCredentialType",
"nodeCredentialType": "googlePalmApi"
},
"credentials": {
"oAuth2Api": {
"name": "<your credential>"
},
"googlePalmApi": {
"name": "<your credential>"
},
"httpBearerAuth": {
"name": "<your credential>"
}
},
"typeVersion": 4.2
},
{
"id": "7426451d-663d-46f7-8fd8-b47469c9c760",
"name": "Parse & Filter Platforms",
"type": "n8n-nodes-base.code",
"position": [
128,
464
],
"parameters": {
"jsCode": "// Parse Gemini response and extract content\nconst response = $input.first().json;\nlet content = {};\n\ntry {\n // Gemini API response structure\n const text = response.candidates[0].content.parts[0].text;\n content = JSON.parse(text);\n} catch (e) {\n // Fallback content if parsing fails\n content = {\n topic: 'AI Innovation 2025',\n facebook: '\ud83d\ude80 Discover how AI is transforming businesses in 2025. From automation to insights, the future is here!',\n instagram: '\u2728 AI Revolution Alert! \ud83e\udd16 Swipe to see how artificial intelligence is changing everything we know about tech \ud83d\udca1',\n tiktok: 'POV: AI just made your job 10x easier \ud83e\udd2f #AITech #FutureTech',\n linkedin: 'The convergence of AI and enterprise technology is creating unprecedented opportunities for innovation.',\n hashtags: '#AI #Innovation #TechTrends #DigitalTransformation #FutureTech',\n bestTime: '10:00 AM EST'\n };\n}\n\n// Build platforms array based on enabled platforms\nconst platforms = [];\n\nif ($vars.ENABLE_FACEBOOK === 'true') {\n platforms.push({\n platform: 'facebook',\n content: content.facebook,\n enabled: true\n });\n}\n\nif ($vars.ENABLE_INSTAGRAM === 'true') {\n platforms.push({\n platform: 'instagram',\n content: content.instagram,\n enabled: true\n });\n}\n\nif ($vars.ENABLE_TIKTOK === 'true') {\n platforms.push({\n platform: 'tiktok',\n content: content.tiktok,\n enabled: true\n });\n}\n\nif ($vars.ENABLE_LINKEDIN === 'true') {\n platforms.push({\n platform: 'linkedin',\n content: content.linkedin,\n enabled: true\n });\n}\n\nreturn [{\n json: {\n ...content,\n enabledPlatforms: platforms,\n platformCount: platforms.length\n }\n}];"
},
"typeVersion": 2
},
{
"id": "1438e1ac-a00e-4358-ad9b-63b3ec247924",
"name": "Kie.ai - Generate Image",
"type": "n8n-nodes-base.httpRequest",
"position": [
400,
160
],
"parameters": {
"url": "https://api.kie.ai/api/v1/jobs/createTask",
"method": "POST",
"options": {},
"jsonBody": "={\n \"model\": \"bytedance/seedream-v4-text-to-image\",\n \"input\": {\n \"prompt\": \"Create a professional social media image about: {{ $json.topic }}. Modern tech company style, clean design, blue and white color scheme, suitable for Facebook, Instagram, LinkedIn. Square format 1080x1080.\",\n \"image_size\": \"square_hd\",\n \"image_resolution\": \"1K\",\n \"max_images\": 1\n }\n}",
"sendBody": true,
"sendHeaders": true,
"specifyBody": "json",
"authentication": "genericCredentialType",
"genericAuthType": "httpBearerAuth",
"headerParameters": {
"parameters": [
{
"name": "Content-Type",
"value": "application/json"
}
]
}
},
"credentials": {
"oAuth2Api": {
"name": "<your credential>"
},
"googlePalmApi": {
"name": "<your credential>"
},
"httpBearerAuth": {
"name": "<your credential>"
}
},
"typeVersion": 4.2
},
{
"id": "ebce8ef2-6d3a-4d13-86a0-12ae021d70a0",
"name": "Kie.ai - Obtain Image",
"type": "n8n-nodes-base.httpRequest",
"position": [
720,
176
],
"parameters": {
"url": "=https://api.kie.ai/api/v1/jobs/recordInfo?taskId={{ $json[\"data\"][\"taskId\"] }}",
"options": {},
"authentication": "genericCredentialType",
"genericAuthType": "httpBearerAuth"
},
"credentials": {
"oAuth2Api": {
"name": "<your credential>"
},
"googlePalmApi": {
"name": "<your credential>"
},
"httpBearerAuth": {
"name": "<your credential>"
}
},
"typeVersion": 4.2
},
{
"id": "a916495f-fc6f-4dbb-810c-9f003667136f",
"name": "Prepare data",
"type": "n8n-nodes-base.code",
"position": [
720,
480
],
"parameters": {
"jsCode": "const url = $json.data\n ? JSON.parse($json.data.resultJson).resultUrls[0]\n : $json.imageUrl; // dac\u0103 ai deja imageUrl\nconst fn = url.split('/').pop() || 'image.bin';\nconst ext = fn.split('.').pop()?.toLowerCase();\nconst ct = (ext === 'png') ? 'image/png'\n : (ext === 'webp') ? 'image/webp'\n : (ext === 'gif') ? 'image/gif'\n : 'image/jpeg';\nreturn [{ json: { imageUrl: url, filename: fn, contentType: ct } }];\n"
},
"typeVersion": 2
},
{
"id": "f3566902-e203-4996-b691-a2eed863b541",
"name": "HTTP Request for content-length",
"type": "n8n-nodes-base.httpRequest",
"position": [
1008,
176
],
"parameters": {
"url": "={{ $json.imageUrl }}",
"options": {
"response": {
"response": {
"fullResponse": true,
"responseFormat": "text"
}
}
}
},
"typeVersion": 4.2
},
{
"id": "1d769d47-2cd3-480b-87e0-ddcc46859f7c",
"name": "IF \u2013 \u201eIs Large?\u201d",
"type": "n8n-nodes-base.if",
"position": [
1168,
336
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "or",
"conditions": [
{
"id": "e3f62ead-f07f-4dc3-b6cc-53cc281c06dc",
"operator": {
"type": "number",
"operation": "gt"
},
"leftValue": "={{ Number(\n $node[\"HTTP Request for content-length\"].json.headers['content-length'] \n || $node[\"HTTP Request for content-length\"].json.headers['Content-Length'] \n || 0\n) }}",
"rightValue": 4194304
}
]
}
},
"typeVersion": 2.2
},
{
"id": "74bc6ead-60b5-41de-a24d-234dac200385",
"name": "HTTP Request for files \u2264 ~4 MB",
"type": "n8n-nodes-base.httpRequest",
"position": [
1504,
496
],
"parameters": {
"url": "={{ $('Prepare data').item.json.imageUrl }}",
"options": {
"response": {
"response": {
"responseFormat": "file",
"outputPropertyName": "imageData"
}
}
}
},
"typeVersion": 4.2
},
{
"id": "fa895f94-4935-442f-9e46-10b1809cac9a",
"name": "LATE \u2013 Init Upload files > 4MB",
"type": "n8n-nodes-base.httpRequest",
"position": [
1504,
176
],
"parameters": {
"url": "https://getlate.dev/api/v1/media",
"method": "POST",
"options": {},
"jsonBody": "={\n \"filename\": \"{{ $('Prepare data').item.json.filename }}\",\n \"contentType\": \"{{ $('Prepare data').item.json.contentType }}\",\n \"multipart\": true\n}",
"sendBody": true,
"sendHeaders": true,
"specifyBody": "json",
"authentication": "genericCredentialType",
"genericAuthType": "httpBearerAuth",
"headerParameters": {
"parameters": [
{
"name": "Content-Type",
"value": "application/json"
}
]
}
},
"credentials": {
"httpBearerAuth": {
"name": "<your credential>"
}
},
"typeVersion": 4.2
},
{
"id": "fdf55cdd-a5a1-4df3-8904-e016fc80b08a",
"name": "Late - Upload Media files <=4MB",
"type": "n8n-nodes-base.httpRequest",
"position": [
1984,
496
],
"parameters": {
"url": "https://getlate.dev/api/v1/media",
"method": "POST",
"options": {},
"sendBody": true,
"contentType": "multipart-form-data",
"authentication": "genericCredentialType",
"bodyParameters": {
"parameters": [
{
"name": "files",
"parameterType": "formBinaryData",
"inputDataFieldName": "imageData"
}
]
},
"genericAuthType": "httpBearerAuth"
},
"credentials": {
"httpBearerAuth": {
"name": "<your credential>"
}
},
"typeVersion": 4.2
},
{
"id": "2bbbf256-8be7-4a60-a73b-39843bd24b07",
"name": "Download Large (GET)",
"type": "n8n-nodes-base.httpRequest",
"position": [
1760,
176
],
"parameters": {
"url": "={{ $('Prepare data').item.json.imageUrl }}",
"options": {
"response": {
"response": {
"responseFormat": "file",
"outputPropertyName": "imageData"
}
}
}
},
"typeVersion": 4.2
},
{
"id": "d366735b-c6c9-41fd-b3bd-ad4d6c2af34e",
"name": "Upload to Storage (PUT)",
"type": "n8n-nodes-base.httpRequest",
"position": [
1984,
176
],
"parameters": {
"url": "={{ $('LATE \u2013 Init Upload files > 4MB').item.json.uploadUrl\n || $('LATE \u2013 Init Upload files >4MB').item.json.url }}",
"method": "PUT",
"options": {},
"sendBody": true,
"contentType": "binaryData",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "Content-Type",
"value": "={{ $('Prepare data').item.json.contentType }}"
}
]
},
"inputDataFieldName": "imageData"
},
"typeVersion": 4.2
},
{
"id": "f03b7ca3-6e58-43bf-9a20-82ee51255388",
"name": "Success Notification & Logging",
"type": "n8n-nodes-base.code",
"position": [
3920,
352
],
"parameters": {
"jsCode": "// Collect all Late Create Post results from the Merge\nconst items = $input.all();\nconst posts = items.map(i => i.json);\n\n// Helpers\nconst fmtPlatform = p => p?.platforms?.[0] || 'unknown';\nconst fmtId = p => p?._id || 'N/A';\nconst preview = s => (s || '').slice(0, 100) + (s && s.length > 100 ? '\u2026' : '');\n\n// Build per-platform lines\nconst lines = posts.map(p =>\n `\u2022 ${fmtPlatform(p)} \u2014 ID: ${fmtId(p)} \u2014 \"${preview(p.content)}\"`\n);\n\n// Build unified message\nconst nowLocal = new Date().toLocaleString();\nconst nowISO = new Date().toISOString();\nconst notificationMessage =\n `\ud83c\udf89 Social Media Posts Published Successfully!\\n\\n` +\n `\ud83d\udccb Details (${posts.length}):\\n` +\n lines.join('\\n') +\n `\\n\\n\u2705 Workflow completed at ${nowISO}`;\n\n// Structured payload for downstream (webhook/Slack/Discord/Email)\nconst webhookData = {\n status: 'SUCCESS',\n count: posts.length,\n posts: posts.map(p => ({\n postId: fmtId(p),\n platform: fmtPlatform(p),\n contentPreview: preview(p.content),\n createdAt: p.createdAt || nowISO,\n userId: p.userId || 'N/A'\n })),\n createdAt: nowISO,\n slackMessage: `\u2705 Published on: ${posts.map(p => fmtPlatform(p)).join(', ')} | ` +\n `IDs: ${posts.map(p => fmtId(p)).join(', ')}`,\n discordMessage: `\ud83d\ude80 **Posts Published (${posts.length})**\\n` +\n lines.join('\\n') + `\\n\\n**Time:** ${nowLocal}`,\n emailSubject: `Social Posts Published (${posts.length})`,\n emailBody: notificationMessage,\n webhookNotification: notificationMessage\n};\n\n// Return a single consolidated item\nreturn [{\n json: {\n posts,\n notification: webhookData,\n webhookMessage: notificationMessage,\n executionStatus: 'SUCCESS'\n }\n}];"
},
"typeVersion": 2
},
{
"id": "7341910d-8f0f-4b52-9324-7e502352ca49",
"name": "Respond to Webhook",
"type": "n8n-nodes-base.respondToWebhook",
"position": [
4160,
352
],
"parameters": {
"options": {}
},
"typeVersion": 1.4
},
{
"id": "5431359e-62e7-4665-9ffe-7d53d2ffe16f",
"name": "When clicking \u2018Execute workflow\u2019",
"type": "n8n-nodes-base.manualTrigger",
"position": [
-800,
320
],
"parameters": {},
"typeVersion": 1
},
{
"id": "9bb0e70f-3a6e-43cd-8116-7f2e0805e897",
"name": "Wait 30s",
"type": "n8n-nodes-base.wait",
"position": [
400,
480
],
"parameters": {
"amount": 30
},
"typeVersion": 1.1
},
{
"id": "8b69f38d-d616-4dac-adb1-f0d7f9701f74",
"name": "Default Settings",
"type": "n8n-nodes-base.set",
"position": [
-576,
320
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "b2a93df9-00b3-4511-9bf8-e14ab5efc354",
"name": "BUSINESS_TYPE",
"type": "string",
"value": "YOUR_BUSINESS_TYPE"
},
{
"id": "5b860d3a-0c66-4bda-aee2-b01eb4f7e5fb",
"name": "CONTENT_TOPIC",
"type": "string",
"value": "YOUR_CONTENT_TOPIC"
},
{
"id": "4dae4bb6-a304-40ca-a100-18b63d578895",
"name": "ENABLE_FACEBOOK",
"type": "string",
"value": "true"
},
{
"id": "34db5228-6039-4235-8621-b3d65593840c",
"name": "FACEBOOK_ACCOUNT_ID",
"type": "string",
"value": "YOUR_IFACEBOOK_ACCOUNT_ID"
},
{
"id": "bd445855-79d4-4fbb-b5c7-9d5c707ac9e7",
"name": "ENABLE_INSTAGRAM",
"type": "string",
"value": "true"
},
{
"id": "b1f080f6-0ffc-433c-8945-a62168b7646c",
"name": "INSTAGRAM_ACCOUNT_ID",
"type": "string",
"value": "YOUR_INSTAGRAM_ACCOUNT_ID"
},
{
"id": "a66f1e1d-3284-4a3a-af2b-3e7183f6967a",
"name": "ENABLE_LINKEDIN",
"type": "string",
"value": "false"
},
{
"id": "d50c61a8-9cf7-4e5e-9230-b06279b4f026",
"name": "LINKEDIN_ACCOUNT_ID",
"type": "string",
"value": "YOUR_LINKEDIN_ACCOUNT_ID"
},
{
"id": "88ebc1ca-375b-4067-8539-f1285b604bb5",
"name": "ENABLE_TIKTOK",
"type": "string",
"value": "false"
},
{
"id": "9ddd122c-2a14-41ac-acba-ebe291bfb4c8",
"name": "TIKTOK_ACCOUNT_ID",
"type": "string",
"value": "YOUR_TIKTOK_ACCOUNT_ID"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "3282bf89-2b9c-41c3-96cb-5968d13dd3dd",
"name": "Late Create Post Facebook",
"type": "n8n-nodes-base.httpRequest",
"position": [
3248,
48
],
"parameters": {
"url": "https://getlate.dev/api/v1/posts",
"method": "POST",
"options": {},
"jsonBody": "={\n \"content\": \"{{ $json.facebook }}\\n\\n{{ Array.isArray($json.hashtags) ? $json.hashtags.join(' ') : $json.hashtags }}\",\n \"publishNow\": true,\n \"platforms\": [\n { \"platform\": \"facebook\", \"accountId\": \"{{ $('Default Settings').item.json.FACEBOOK_ACCOUNT_ID }}\" }\n ],\n \"mediaItems\": [\n { \"type\": \"image\", \"url\": \"{{ $json.publicUrl || $json.files?.[0]?.url || $json.url }}\" }\n ]\n}\n",
"sendBody": true,
"specifyBody": "json",
"authentication": "genericCredentialType",
"genericAuthType": "httpBearerAuth"
},
"credentials": {
"httpBearerAuth": {
"name": "<your credential>"
}
},
"typeVersion": 4.2
},
{
"id": "acba7755-48ec-4fca-935e-8b1e4e77c60a",
"name": "IF Facebook",
"type": "n8n-nodes-base.if",
"position": [
2880,
64
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "loose"
},
"combinator": "or",
"conditions": [
{
"id": "e3f62ead-f07f-4dc3-b6cc-53cc281c06dc",
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
},
"leftValue": "={{ $('Default Settings').item.json.ENABLE_FACEBOOK }}",
"rightValue": ""
}
]
},
"looseTypeValidation": true
},
"typeVersion": 2.2
},
{
"id": "08abe312-a3ae-4536-b112-ab0d4a25d87a",
"name": "IF Instagram",
"type": "n8n-nodes-base.if",
"position": [
2880,
272
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "loose"
},
"combinator": "or",
"conditions": [
{
"id": "e3f62ead-f07f-4dc3-b6cc-53cc281c06dc",
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
},
"leftValue": "={{ $('Default Settings').item.json.ENABLE_INSTAGRAM }}",
"rightValue": ""
}
]
},
"looseTypeValidation": true
},
"typeVersion": 2.2
},
{
"id": "7f8757c9-c6e6-4c60-aa25-8f76e645dbfa",
"name": "IF LinkedIn",
"type": "n8n-nodes-base.if",
"position": [
2880,
464
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "loose"
},
"combinator": "or",
"conditions": [
{
"id": "e3f62ead-f07f-4dc3-b6cc-53cc281c06dc",
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
},
"leftValue": "={{ $('Default Settings').item.json.ENABLE_LINKEDIN }}",
"rightValue": ""
}
]
},
"looseTypeValidation": true
},
"typeVersion": 2.2
},
{
"id": "d9fc9ad2-156c-43fc-9634-221f4f0d336d",
"name": "IF TikTok",
"type": "n8n-nodes-base.if",
"position": [
2880,
672
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "loose"
},
"combinator": "or",
"conditions": [
{
"id": "e3f62ead-f07f-4dc3-b6cc-53cc281c06dc",
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
},
"leftValue": "={{ $('Default Settings').item.json.ENABLE_TIKTOK }}",
"rightValue": ""
}
]
},
"looseTypeValidation": true
},
"typeVersion": 2.2
},
{
"id": "601d5c07-6a7e-432d-97cd-e527eb04ed81",
"name": "Late Create Post Instagram",
"type": "n8n-nodes-base.httpRequest",
"position": [
3248,
256
],
"parameters": {
"url": "https://getlate.dev/api/v1/posts",
"method": "POST",
"options": {},
"jsonBody": "={\n \"content\": \"{{ $json.instagram }}\\n\\n{{ Array.isArray($json.hashtags) ? $json.hashtags.join(' ') : $json.hashtags }}\",\n \"publishNow\": true,\n \"platforms\": [\n { \"platform\": \"instagram\", \"accountId\": \"{{ $('Default Settings').item.json.INSTAGRAM_ACCOUNT_ID }}\" }\n ],\n \"mediaItems\": [\n { \"type\": \"image\", \"url\": \"{{ $json.publicUrl || $json.files?.[0]?.url || $json.url }}\" }\n ]\n}\n",
"sendBody": true,
"specifyBody": "json",
"authentication": "genericCredentialType",
"genericAuthType": "httpBearerAuth"
},
"credentials": {
"httpBearerAuth": {
"name": "<your credential>"
}
},
"typeVersion": 4.2
},
{
"id": "1f39f5fd-6fcf-4675-9ac6-fe2b844aa69f",
"name": "Late Create Post Linkedin",
"type": "n8n-nodes-base.httpRequest",
"position": [
3248,
448
],
"parameters": {
"url": "https://getlate.dev/api/v1/posts",
"method": "POST",
"options": {},
"jsonBody": "={\n \"content\": \"{{ $json.linkedin }}\\n\\n{{ Array.isArray($json.hashtags) ? $json.hashtags.join(' ') : $json.hashtags }}\",\n \"publishNow\": true,\n \"platforms\": [\n { \"platform\": \"linkedin\", \"accountId\": \"{{ $('Default Settings').item.json.LINKEDIN_ACCOUNT_ID }}\" }\n ],\n \"mediaItems\": [\n { \"type\": \"image\", \"url\": \"{{ $json.publicUrl || $json.files?.[0]?.url || $json.url }}\" }\n ]\n}\n",
"sendBody": true,
"specifyBody": "json",
"authentication": "genericCredentialType",
"genericAuthType": "httpBearerAuth"
},
"credentials": {
"httpBearerAuth": {
"name": "<your credential>"
}
},
"typeVersion": 4.2
},
{
"id": "438f89c0-2671-462a-8318-61e790872736",
"name": "Late Create Post TikTok",
"type": "n8n-nodes-base.httpRequest",
"position": [
3248,
656
],
"parameters": {
"url": "https://getlate.dev/api/v1/posts",
"method": "POST",
"options": {},
"jsonBody": "={\n \"content\": \"{{ $json.tiktok }}\\n\\n{{ Array.isArray($json.hashtags) ? $json.hashtags.join(' ') : $json.hashtags }}\",\n \"publishNow\": true,\n \"platforms\": [\n { \"platform\": \"tiktok\", \"accountId\": \"{{ $('Default Settings').item.json.TIKTOK_ACCOUNT_ID }}\" }\n ],\n \"mediaItems\": [\n { \"type\": \"image\", \"url\": \"{{ $json.publicUrl || $json.files?.[0]?.url || $json.url }}\" }\n ]\n}\n",
"sendBody": true,
"specifyBody": "json",
"authentication": "genericCredentialType",
"genericAuthType": "httpBearerAuth"
},
"credentials": {
"httpBearerAuth": {
"name": "<your credential>"
}
},
"typeVersion": 4.2
},
{
"id": "20d51af6-ba48-48cc-8c69-5f53c602627e",
"name": "Merge",
"type": "n8n-nodes-base.merge",
"position": [
3648,
320
],
"parameters": {
"numberInputs": 4
},
"typeVersion": 3.2
},
{
"id": "ffeaf90f-428a-4407-81f4-ab2527a60f5f",
"name": "Combine Content with Media",
"type": "n8n-nodes-base.code",
"position": [
2464,
336
],
"parameters": {
"jsCode": "// Combine content data with media URLs\nconst mediaData = $input.first().json;\nconst contentData = $('Parse & Filter Platforms').item.json;\n\nreturn [{\n json: {\n ...contentData, // facebook, instagram, hashtags, etc.\n ...mediaData, // url, publicUrl, files, etc.\n }\n}];"
},
"typeVersion": 2
},
{
"id": "e7ab8509-6dad-4d9f-bced-8e206d67d0a7",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
128,
-48
],
"parameters": {
"color": 5,
"width": 832,
"height": 80,
"content": "# AI-Generated Social Media Posting with Late API"
},
"typeVersion": 1
},
{
"id": "f8dad610-9a03-4067-9b66-7a258d3e11fa",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1152,
480
],
"parameters": {
"width": 368,
"height": 320,
"content": "## \ud83d\udcca Workflow Overview\n\nThis workflow automates social media publishing:\n\n1. Generate platform-optimized text with **Google Gemini**. \n2. Generate branded images with **Kie.ai**. \n3. Upload media to **Late API**. \n4. Publish posts on selected platforms (Facebook, Instagram, LinkedIn, TikTok). \n5. Send structured success notifications (Slack, Discord, Email, Webhook). \n"
},
"typeVersion": 1
},
{
"id": "8dea0bea-a4a0-4a74-a796-c5ee21f61bcb",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
-656,
512
],
"parameters": {
"width": 384,
"height": 352,
"content": "## \ud83d\udd11 Prerequisites & Credentials\n\nRequired credentials:\n- **Google Gemini API key** (PaLM)\n- **Kie.ai API key** (DreamSeed model)\n- **Late API key**\n\nRequired account IDs (from Late dashboard):\n- FACEBOOK_ACCOUNT_ID\n- INSTAGRAM_ACCOUNT_ID\n- LINKEDIN_ACCOUNT_ID\n- TIKTOK_ACCOUNT_ID\n\n\u26a0\ufe0f Each post requires both { platform, accountId }.\n"
},
"typeVersion": 1
},
{
"id": "7abf6a51-bc80-485c-a70a-a73375ec5881",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
-832,
0
],
"parameters": {
"width": 464,
"height": 256,
"content": "## \u2699\ufe0f Default Settings\n\nThis node defines workflow variables:\n\n- BUSINESS_TYPE \u2192 type of company\n- CONTENT_TOPIC \u2192 topic for content generation\n- ENABLE_* \u2192 toggle platforms (true/false)\n- *_ACCOUNT_ID \u2192 required Late account IDs\n\n\ud83d\udca1 Change values here to control which platforms are active.\n"
},
"typeVersion": 1
},
{
"id": "1ba6ca03-6672-4a9b-bfc3-05d85c16b5dc",
"name": "Sticky Note4",
"type": "n8n-nodes-base.stickyNote",
"position": [
-160,
640
],
"parameters": {
"width": 432,
"height": 320,
"content": "## \ud83e\udde0 Content Generation\n\n**Gemini \u2013 Generate Content**\n- Calls Google Gemini (gemini-2.5-flash).\n- Produces JSON with platform-specific texts:\n { topic, facebook, instagram, tiktok, linkedin, hashtags, bestTime }\n\n**Parse & Filter Platforms**\n- Extracts texts per platform.\n- Filters only enabled platforms.\n- Adds platformCount for reporting.\n"
},
"typeVersion": 1
},
{
"id": "190f8d6a-7e89-4f10-bdf3-fd10a122942d",
"name": "Sticky Note5",
"type": "n8n-nodes-base.stickyNote",
"position": [
352,
640
],
"parameters": {
"width": 528,
"height": 800,
"content": "## \ud83c\udfa8 Image Generation\n\n**Model & provider**\n- Kie.ai \u2192 ByteDance **Seedream v4** (T2I + I2I + Editing)\n- Flow:\n - Create Task \u2192 Poll recordInfo \u2192 use `resultUrls[0]` as CDN URL (passed to Late API)\n\n### \ud83d\udcb8 Pricing (as of 2025-09-26)\nAssumptions: 1MP ~ 1024\u00d71024 image. Higher resolutions scale proportionally.\n\n- **Seedream via Kie.ai (v3 reference)**: ~**$0.0175 / image** (3.5 credits) \u2014 typical rate cited for Seedream v3 on Kie.ai. \n *Indicative for v4; check your Kie.ai plan.* \n- **Seedream via BytePlus (official API)**: **$0.03 / image** (+ **200 free images**). \n- **Nano Banana (Gemini 2.5 wrapper)**: **\u2248 $0.12 / edit** on Premium monthly (\u2248619 edits for $59.9); basic one-time pack \u2248 **$0.25 / edit**. \n- **FAL.ai (aggregator, FLUX family)** *(normalized to 1MP)*:\n - FLUX.1 **dev**: **$0.025 / MP** (\u2248$0.025 / 1MP image)\n - FLUX.1 **pro**: **$0.05 / MP**\n - FLUX.1 **schnell**: **$0.003 / MP** (fast/cheap, lower fidelity)\n\n### \u2705 Why Seedream (Kie.ai) here\n1) **Quality & prompt adherence** suitable for brand assets; strong editing & consistency. \n2) **Simple integration** (task \u2192 poll \u2192 CDN URL) fits n8n + Late upload flow. \n3) **Cost-effective at scale** versus Nano Banana subscriptions; comparable or better than many FAL image models for 1MP, with higher consistency for marketing creatives.\n\n> **Rule of thumb (1K images @ ~1MP):** \n> Kie.ai Seedream v3 ref ~$17.5 \u2192 BytePlus $30 \u2192 FAL FLUX dev ~$25 \u2192 Nano Banana ~$120 (Premium) / ~$250 (one-time).\n"
},
"typeVersion": 1
},
{
"id": "8178523a-d236-4053-90c9-f89936cacd34",
"name": "Sticky Note6",
"type": "n8n-nodes-base.stickyNote",
"position": [
1536,
736
],
"parameters": {
"width": 512,
"height": 320,
"content": "## \ud83d\udce6 Media Upload to Late\n\nUploads images to Late API depending on size:\n\n- \u2264 4MB \u2192 direct upload\n- > 4MB \u2192 multipart flow:\n 1. Init Upload (Late API)\n 2. Download Large File\n 3. Upload to Storage (PUT)\n\n\u2705 Ensures files are properly stored before posting.\n"
},
"typeVersion": 1
},
{
"id": "7350ae95-d565-45b2-af95-61b759223db0",
"name": "Sticky Note7",
"type": "n8n-nodes-base.stickyNote",
"position": [
2784,
864
],
"parameters": {
"width": 704,
"height": 368,
"content": "## \ud83d\ude80 Publishing Logic\n\nBranches per platform:\n- IF Facebook \u2192 Late Create Post Facebook\n- IF Instagram \u2192 Late Create Post Instagram\n- IF LinkedIn \u2192 Late Create Post LinkedIn\n- IF TikTok \u2192 Late Create Post TikTok\n\nEach post sends:\nPOST https://getlate.dev/api/v1/posts\n{\n content: \"text + hashtags\",\n publishNow: true,\n platforms: [{ platform, accountId }],\n mediaItems: [{ type: \"image\", url }]\n}\n"
},
"typeVersion": 1
},
{
"id": "63f67571-1961-430f-af7e-3acaa3fc5cec",
"name": "Sticky Note8",
"type": "n8n-nodes-base.stickyNote",
"position": [
3776,
576
],
"parameters": {
"width": 384,
"height": 416,
"content": "## \ud83d\udce2 Notifications & Logging\n\n**Merge** responses from all platforms.\n\n**Success Notification & Logging**\n- Builds structured messages for:\n - Slack\n - Discord\n - Email\n - Webhook\n\nIncludes:\n- Post ID\n- Platform\n- Content preview\n- Timestamp\n"
},
"typeVersion": 1
},
{
"id": "bc91c6f2-5402-4ae4-9742-adc6626277e0",
"name": "Sticky Note9",
"type": "n8n-nodes-base.stickyNote",
"position": [
4224,
576
],
"parameters": {
"color": 3,
"width": 432,
"height": 288,
"content": "## \u26a0\ufe0f Error Handling\n\nCommon issues:\n- Missing accountId \u2192 check Default Settings.\n- Large files failing \u2192 check upload URL from Late.\n- Empty content \u2192 Gemini fallback text used.\n- Invalid credentials \u2192 update API keys.\n\n\ud83d\udee0 Errors stop only the failing branch; other platforms continue.\n"
},
"typeVersion": 1
},
{
"id": "e080af37-05cd-452b-a9fd-a2d516533a6e",
"name": "Sticky Note10",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1472,
1024
],
"parameters": {
"color": 5,
"width": 544,
"height": 544,
"content": "## \ud83d\udd11 [Gemini API (Google AI Studio)](https://ai.google.dev/gemini-api/docs/get-started) Gemini API Key\n\nSteps\n1) Open Google AI Studio \u2192 API Keys.\n2) Click **Create API key** (choose or create a Cloud project if prompted).\n3) Copy the key and store it securely.\n4) (Optional) Restrict the key (HTTP referrers / IPs) in Google Cloud Console.\n\nUse in requests\n- Header: x-goog-api-key: YOUR_KEY\n- Or as query param: ?key=YOUR_KEY\n\nQuick test (curl)\ncurl -s -X POST \\\n \"https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent?key=YOUR_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"contents\":[{\"parts\":[{\"text\":\"Say hello\"}]}],\n \"generationConfig\":{\"maxOutputTokens\":64}\n }'\n\nn8n\n- Create Credential: HTTP Bearer YOUR_TOKEN_HERE API Key (per node), or store as env var.\n- Use in **Gemini \u2013 Generate Content** HTTP node.\n"
},
"typeVersion": 1
},
{
"id": "ec7b61ba-3672-4b0e-a78f-70968461ed07",
"name": "Sticky Note11",
"type": "n8n-nodes-base.stickyNote",
"position": [
-896,
1024
],
"parameters": {
"color": 5,
"width": 528,
"height": 544,
"content": "## \ud83e\udde9 [Kie.ai (Seedream)](https://kie.ai/seedream-api)\n\nSteps\n1) Sign up / log in at Kie.ai \u2192 API Key Management.\n2) Create an API key (Bearer YOUR_TOKEN_HERE) and copy it.\n3) (Optional) Check credits endpoint to verify: GET /api/v1/chat/credit\n\nUse in requests\n- Header: Authorization: Bearer YOUR_TOKEN_HERE\n\nSeedream v4 flow (used here)\n- POST /api/v1/jobs/createTask\n { \"model\": \"bytedance/seedream-v4-text-to-image\", \"input\": { \"prompt\": \"...\", \"image_size\": \"square_hd\", \"image_resolution\": \"1K\" } }\n- Poll: GET /api/v1/jobs/recordInfo?taskId=...\n- Use data.resultJson.resultUrls[0] as CDN image URL.\n\nn8n\n- Create Credential: HTTP Bearer \u201cKie.ai\u201d.\n- Attach to **Kie.ai \u2013 Generate Image** and **Obtain Image** nodes.\n"
},
"typeVersion": 1
},
{
"id": "ebad7299-b595-40bf-9255-3d692e2971c0",
"name": "Sticky Note12",
"type": "n8n-nodes-base.stickyNote",
"position": [
-336,
1024
],
"parameters": {
"color": 5,
"width": 544,
"height": 544,
"content": "## \ud83d\ude80 [Late API](https://getlate.dev/docs)\n\nSteps\n1) Create an account at getlate.dev and connect social accounts.\n2) Generate an **API key** in the Late dashboard (Account/Settings \u2192 API).\n3) Copy the key and keep it secure.\n\nUse in requests\n- Header: Authorization: Bearer YOUR_TOKEN_HERE\n\nCore endpoints (used here)\n- POST /api/v1/media \u2192 upload images (small: multipart, large: init + PUT)\n- POST /api/v1/posts \u2192 publish or schedule posts\n {\n \"content\": \"...\",\n \"publishNow\": true,\n \"platforms\": [{ \"platform\": \"facebook\", \"accountId\": \"...\" }],\n \"mediaItems\": [{ \"type\": \"image\", \"url\": \"CDN_URL\" }]\n }\n\nn8n\n- Create Credential: HTTP Bearer \u201cLate\u201d.\n- Attach to upload + posting nodes (Media & Create Post).\n"
},
"typeVersion": 1
},
{
"id": "f9e32b17-8c16-4b49-bd4c-bed82bfc164d",
"name": "Normalize Media Output",
"type": "n8n-nodes-base.code",
"position": [
2240,
336
],
"parameters": {
"jsCode": "return [{\n json: {\n publicUrl:\n $json.publicUrl ||\n $json.url ||\n ($json.files?.[0]?.url) ||\n $('Prepare data').item.json.imageUrl\n }\n}];"
},
"typeVersion": 2
},
{
"id": "2bedc643-db64-4916-b18b-df0548573916",
"name": "Sticky Note13",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1056,
1616
],
"parameters": {
"color": 5,
"width": 880,
"height": 784,
"content": "### \ud83d\udcb8 Run Cost Cheat-Sheet \u2014 \u201cAI-Generated Social Post\u201d Flow\n\n**What gets billed per run**\n\n* **Text generation (Gemini 2.5 Flash)**\n\n * *Free Tier (AI Studio / API free tier):* **$0** (rate-limited). ([Google AI for Developers][1])\n * *Paid Tier (interactive API):* **$0.30 / 1M input tokens** and **$2.50 / 1M output tokens**.\n *Batch API is ~50% of interactive prices.* ([Google AI for Developers][1])\n\n* **Image generation (Seedream v4 via Kie.ai)**\n\n * Typical credit pricing: ~**$0.04\u2013$0.069 per image** depending on plan/volume. ([Seedream-4][2])\n\n* **Publishing (Late API)**\n\n * **Subscription-based**; marginal cost per post is **$0** within plan limits\n (Free: 10 posts/mo; Build: 120 posts/mo; Accelerate/Dominate/Enterprise: unlimited posts). ([Late][3])\n\n---\n\n**Quick estimate (paid Gemini tier)**\n\n```\nEstimated LLM cost = \n (input_tokens / 1,000,000) * $0.30 +\n (output_tokens / 1,000,000) * $2.50\nTotal per run \u2248 LLM cost + image_cost (\u2248 $0.04\u2013$0.069) + $0 (Late)\n```\n\n**Example:** ~600 input tokens + ~800 output tokens\nLLM \u2248 (600 * 0.30 + 800 * 2.50) / 1,000,000 \u2248 **$0.0022**\nImage \u2248 **$0.05** \u2192 **~$0.052 per full run** (posting cost covered by Late plan).\n\n> **Tips**\n>\n> * Staying on **AI Studio free tier** makes LLM cost $0; only image (and your Late plan) remains. ([Google AI for Developers][1])\n> * If you batch-generate captions, **Batch API is ~50% cheaper** than interactive. ([Google AI for Developers][1])\n"
},
"typeVersion": 1
}
],
"active": false,
"settings": {
"callerPolicy": "workflowsFromSameOwner",
"executionOrder": "v1",
"executionTimeout": -1,
"timeSavedPerExecution": 2
},
"versionId": "ffa440bf-7b8f-4ebd-be4f-bd067a0b58ee",
"connections": {
"Merge": {
"main": [
[
{
"node": "Success Notification & Logging",
"type": "main",
"index": 0
}
]
]
},
"Wait 30s": {
"main": [
[
{
"node": "Kie.ai - Obtain Image",
"type": "main",
"index": 0
}
]
]
},
"IF TikTok": {
"main": [
[
{
"node": "Late Create Post TikTok",
"type": "main",
"index": 0
}
]
]
},
"IF Facebook": {
"main": [
[
{
"node": "Late Create Post Facebook",
"type": "main",
"index": 0
}
]
]
},
"IF LinkedIn": {
"main": [
[
{
"node": "Late Create Post Linkedin",
"type": "main",
"index": 0
}
]
]
},
"IF Instagram": {
"main": [
[
{
"node": "Late Create Post Instagram",
"type": "main",
"index": 0
}
]
]
},
"Prepare data": {
"main": [
[
{
"node": "HTTP Request for content-length",
"type": "main",
"index": 0
}
]
]
},
"Default Settings": {
"main": [
[
{
"node": "Check Enabled Platforms",
"type": "main",
"index": 0
}
]
]
},
"Download Large (GET)": {
"main": [
[
{
"node": "Upload to Storage (PUT)",
"type": "main",
"index": 0
}
]
]
},
"Kie.ai - Obtain Image": {
"main": [
[
{
"node": "Prepare data",
"type": "main",
"index": 0
}
]
]
},
"IF \u2013 \u201eIs Large?\u201d": {
"main": [
[
{
"node": "LATE \u2013 Init Upload files > 4MB",
"type": "main",
"index": 0
}
],
[
{
"node": "HTTP Request for files \u2264 ~4 MB",
"type": "main",
"index": 0
}
]
]
},
"Normalize Media Output": {
"main": [
[
{
"node": "Combine Content with Media",
"type": "main",
"index": 0
}
]
]
},
"Check Enabled Platforms": {
"main": [
[
{
"node": "Gemini - Generate Content",
"type": "main",
"index": 0
}
]
]
},
"Kie.ai - Generate Image": {
"main": [
[
{
"node": "Wait 30s",
"type": "main",
"index": 0
}
]
]
},
"Late Create Post TikTok": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 2
}
]
]
},
"Upload to Storage (PUT)": {
"main": [
[
{
"node": "Normalize Media Output",
"type": "main",
"index": 0
}
]
]
},
"Parse & Filter Platforms": {
"main": [
[
{
"node": "Kie.ai - Generate Image",
"type": "main",
"index": 0
}
]
]
},
"Gemini - Generate Content": {
"main": [
[
{
"node": "Parse & Filter Platforms",
"type": "main",
"index": 0
}
]
]
},
"Late Create Post Facebook": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 0
}
]
]
},
"Late Create Post Linkedin": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 2
}
]
]
},
"Combine Content with Media": {
"main": [
[
{
"node": "IF Facebook",
"type": "main",
"index": 0
},
{
"node": "IF Instagram",
"type": "main",
"index": 0
},
{
"node": "IF LinkedIn",
"type": "main",
"index": 0
},
{
"node": "IF TikTok",
"type": "main",
"index": 0
}
]
]
},
"Late Create Post Instagram": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 1
}
]
]
},
"Success Notification & Logging": {
"main": [
[
{
"node": "Respond to Webhook",
"type": "main",
"index": 0
}
]
]
},
"HTTP Request for content-length": {
"main": [
[
{
"node": "IF \u2013 \u201eIs Large?\u201d",
"type": "main",
"index": 0
}
]
]
},
"Late - Upload Media files <=4MB": {
"main": [
[
{
"node": "Normalize Media Output",
"type": "main",
"index": 0
}
]
]
},
"HTTP Request for files \u2264 ~4 MB": {
"main": [
[
{
"node": "Late - Upload Media files <=4MB",
"type": "main",
"index": 0
}
]
]
},
"LATE \u2013 Init Upload files > 4MB": {
"main": [
[
{
"node": "Download Large (GET)",
"type": "main",
"index": 0
}
]
]
},
"When clicking \u2018Execute workflow\u2019": {
"main": [
[
{
"node": "Default Settings",
"type": "main",
"index": 0
}
]
]
}
}
}
Credentials you'll need
Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.
googlePalmApihttpBearerAuthoAuth2Api
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
This workflow automates end-to-end social media publishing powered by Late API. It generates text content with Google Gemini, creates branded visuals with Kie.ai, uploads media to Late, and publishes across multiple platforms (Facebook, Instagram, LinkedIn, TikTok).
Source: https://n8n.io/workflows/8965/ — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
This workflow is perfect for app developers, SaaS founders, and mobile growth teams who need constant UGC-style video ads without hiring creators or agencies. If you're spending $500+ per creator and
AI Background Generation with Nano Banana (Gemini Image). Uses httpRequest, googleDrive. Webhook trigger; 35 nodes.
This template is for developers, teams, and automation enthusiasts who want a private, PIN-protected Telegram chatbot that answers questions from their own documents — without relying on external AI A
Elevate your digital presence with high-fidelity cinematic video automation. This workflow orchestrates the complex, asynchronous rendering process of OpenAI Sora—transforming static product images or
Storage Sync - Google Drive. Uses supabase, googleDrive, httpRequest. Webhook trigger; 22 nodes.