This workflow corresponds to n8n.io template #15162 — we link there as the canonical source.
This workflow follows the Agent → HTTP Request recipe pattern — see all workflows that pair these two integrations.
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": "Yb0oqyPREXLshBAy",
"meta": {
"templateCredsSetupCompleted": true
},
"name": "Multi-Agent Social Media Content Factory",
"tags": [],
"nodes": [
{
"id": "5e942cf1-ee88-4975-8220-b4d9154436c9",
"name": "Sticky Note - Overview",
"type": "n8n-nodes-base.stickyNote",
"position": [
0,
0
],
"parameters": {
"width": 980,
"height": 980,
"content": "## Multi-Agent Social Media Content Factory\n\nThis workflow orchestrates three specialized AI agents in sequence to research trends, generate platform-specific content (captions + images), and schedule posts across LinkedIn, X (Twitter), and Instagram.\n\n### Who's it for\n\u2022 Social media managers handling multiple brands\n\u2022 Marketing teams needing consistent content pipelines\n\u2022 Creators automating their content calendar\n\u2022 Agencies managing high-volume posting schedules\n\n### How it works\n1. A topic/industry keyword is submitted via webhook or schedule\n2. **Agent 1 (Research):** Searches current trends, extracts insights & hashtags\n3. **Agent 2 (Content Gen):** Produces platform-specific captions + image prompts\n4. **Agent 3 (Scheduling):** Posts to LinkedIn, X, and Instagram via their APIs\n5. All activity is logged to a Google Sheet tracker\n\n### How to set up\n1. Import this workflow into n8n\n2. Set credentials: OpenAI, LinkedIn OAuth2, Twitter OAuth2, Instagram Graph API, Google Sheets OAuth2, SendGrid (optional alerts)\n3. Replace YOUR_SHEET_ID placeholder in the Google Sheet node\n4. Replace YOUR_INSTAGRAM_ACCOUNT_ID, YOUR_LINKEDIN_PERSON_URN placeholders\n5. Activate the workflow\n\n### Requirements\n\u2022 OpenAI API key (GPT-4.1 mini or better)\n\u2022 LinkedIn OAuth2 credentials\n\u2022 Twitter/X OAuth2 credentials\n\u2022 Instagram Graph API credentials (Business account)\n\u2022 Google Sheets OAuth2\n\u2022 Optional: Stable Diffusion / DALL-E for image generation\n\n### How to customize\n\u2022 Swap OpenAI model in all AI nodes\n\u2022 Adjust character limits per platform in Agent 2 prompt\n\u2022 Modify posting schedule in the Schedule Trigger node\n\u2022 Add Slack/email notifications on post confirmation\n\u2022 Extend the Google Sheet columns for additional metadata"
},
"typeVersion": 1
},
{
"id": "f9e829b3-dd6b-41dc-939f-f49707709f34",
"name": "Sticky Note - Section 1",
"type": "n8n-nodes-base.stickyNote",
"position": [
1104,
16
],
"parameters": {
"color": 4,
"width": 740,
"height": 744,
"content": "## 1. Trigger & Input\n\nAccepts a topic/industry keyword via:\n- POST webhook (manual/external trigger)\n- Scheduled cron (recurring content calendar)\n\nNormalizes input into a standard `{ topic, industry, targetAudience }` shape before passing downstream."
},
"typeVersion": 1
},
{
"id": "3ff2ea1d-d202-4bb1-a221-ee642215f825",
"name": "Sticky Note - Section 2",
"type": "n8n-nodes-base.stickyNote",
"position": [
1952,
-80
],
"parameters": {
"color": 3,
"width": 820,
"height": 1044,
"content": "## 2. Agent 1 \u2014 Trend Research\n\nUses web search + AI to:\n- Fetch current trending topics for the given industry\n- Extract key insights, stats, and talking points\n- Identify platform-relevant hashtags (LinkedIn, X, Instagram)\n- Output a structured JSON trend report\n\nFails gracefully: if search fails, uses AI general knowledge as fallback."
},
"typeVersion": 1
},
{
"id": "ab37b57c-5aee-4a84-ae40-cc0cba597cad",
"name": "Sticky Note - Section 3",
"type": "n8n-nodes-base.stickyNote",
"position": [
2832,
-112
],
"parameters": {
"color": 5,
"width": 740,
"height": 1108,
"content": "## 3. Agent 2 \u2014 Content Generation\n\nReceives trend report and produces:\n- LinkedIn caption (\u22643000 chars, professional tone, 3-5 hashtags)\n- X/Twitter caption (\u2264280 chars, punchy, 2-3 hashtags)\n- Instagram caption (\u22642200 chars, engaging, 10-15 hashtags)\n- DALL-E image prompt for each platform\n- Structured JSON content bundle\n\nSkips scheduling if image generation fails (conditional gate)."
},
"typeVersion": 1
},
{
"id": "1c048135-7954-4238-8e9c-797850b797d3",
"name": "Sticky Note - Section 4",
"type": "n8n-nodes-base.stickyNote",
"position": [
3648,
-144
],
"parameters": {
"color": 6,
"width": 2036,
"height": 1108,
"content": "## 4. Agent 3 \u2014 Scheduling & Publishing\n\nReceives content bundle and:\n- Publishes to LinkedIn via Pages API\n- Posts to X via v2 Tweets API\n- Schedules Instagram via Graph API (create media \u2192 publish)\n- Logs post IDs, timestamps, and platform status to Google Sheet\n- Sends error alerts via SendGrid if any platform fails\n\nEach platform posts independently \u2014 one failure does NOT block others."
},
"typeVersion": 1
},
{
"id": "85d62773-4f79-4df6-8340-d5b72fdd4c17",
"name": "Webhook - Content Request",
"type": "n8n-nodes-base.webhook",
"position": [
1264,
384
],
"parameters": {
"path": "social-content-factory",
"options": {},
"httpMethod": "POST",
"responseMode": "responseNode"
},
"typeVersion": 1.1
},
{
"id": "0e48b68a-8f1b-46dc-8e87-fa37deb019ed",
"name": "Schedule Trigger - Content Calendar",
"type": "n8n-nodes-base.scheduleTrigger",
"position": [
1264,
592
],
"parameters": {
"rule": {
"interval": [
{
"field": "cronExpression",
"expression": "0 8 * * 1,3,5"
}
]
}
},
"typeVersion": 1.2
},
{
"id": "7f80f0d2-3935-4536-b789-74c89aaf021f",
"name": "Normalize Input",
"type": "n8n-nodes-base.set",
"position": [
1504,
480
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"name": "topic",
"type": "string",
"value": "={{ $json.topic || $json.body?.topic || 'Artificial Intelligence' }}"
},
{
"name": "industry",
"type": "string",
"value": "={{ $json.industry || $json.body?.industry || 'Technology' }}"
},
{
"name": "targetAudience",
"type": "string",
"value": "={{ $json.targetAudience || $json.body?.targetAudience || 'Business professionals and tech enthusiasts' }}"
},
{
"name": "brandVoice",
"type": "string",
"value": "={{ $json.brandVoice || $json.body?.brandVoice || 'Professional, insightful, forward-thinking' }}"
},
{
"name": "requestId",
"type": "string",
"value": "={{ 'scf-' + Date.now().toString() }}"
},
{
"name": "requestTimestamp",
"type": "string",
"value": "={{ new Date().toISOString() }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "0b6cc6d2-ad15-4adb-89be-0c2144796987",
"name": "Agent 1 - Trend Research AI",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
2016,
480
],
"parameters": {
"text": "=You are an expert social media trend researcher. Research and analyze current trends for the following topic.\n\nTopic: {{ $json.topic }}\nIndustry: {{ $json.industry }}\nTarget Audience: {{ $json.targetAudience }}\n\nYour task:\n1. Identify the top 3-5 trending angles, talking points, or developments for this topic RIGHT NOW\n2. Extract compelling statistics, quotes, or data points that would resonate on social media\n3. Identify the emotional hooks and narratives that are gaining traction\n4. Compile platform-appropriate hashtags:\n - LinkedIn hashtags (3-5, professional/industry focused)\n - X/Twitter hashtags (2-3, trending/broad reach)\n - Instagram hashtags (10-15, mix of niche and broad)\n\nRespond ONLY with a valid JSON object in this exact structure:\n{\n \"trendReport\": {\n \"topic\": \"string\",\n \"industry\": \"string\",\n \"researchTimestamp\": \"ISO 8601 string\",\n \"topTrends\": [\n {\n \"trendTitle\": \"string\",\n \"description\": \"string (2-3 sentences)\",\n \"relevanceScore\": \"number 1-10\",\n \"dataPoint\": \"string (stat or quote if available)\"\n }\n ],\n \"keyInsights\": [\"insight 1\", \"insight 2\", \"insight 3\"],\n \"contentAngles\": [\"angle 1\", \"angle 2\", \"angle 3\"],\n \"hashtags\": {\n \"linkedin\": [\"#hashtag1\", \"#hashtag2\", \"#hashtag3\"],\n \"twitter\": [\"#hashtag1\", \"#hashtag2\"],\n \"instagram\": [\"#hashtag1\", \"#hashtag2\", \"#hashtag3\", \"#hashtag4\", \"#hashtag5\", \"#hashtag6\", \"#hashtag7\", \"#hashtag8\", \"#hashtag9\", \"#hashtag10\"]\n },\n \"researchStatus\": \"success\"\n }\n}",
"options": {
"systemMessage": "You are a precise JSON-outputting research agent. Output ONLY valid JSON, no markdown, no preamble, no explanation. Use your web search capability to find current trends."
},
"promptType": "define"
},
"typeVersion": 1.6
},
{
"id": "09e42998-0349-4543-a8e2-e96dbe4da23f",
"name": "OpenAI - Agent 1 Model",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
2000,
704
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4.1-mini"
},
"options": {
"temperature": 0.3
},
"builtInTools": {
"webSearch": {}
}
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.3
},
{
"id": "6ba95752-3a8f-4ebc-a608-ee026b003acd",
"name": "JS - Parse & Validate Trend Report",
"type": "n8n-nodes-base.code",
"position": [
2352,
480
],
"parameters": {
"mode": "runOnceForEachItem",
"jsCode": "// Parse Agent 1 JSON output and validate structure\nconst item = $input.item.json;\nlet trendReport;\n\ntry {\n // Agent may return the JSON in .output or .text\n const rawText = item.output || item.text || item.response || '';\n const cleaned = rawText.replace(/```json|```/g, '').trim();\n const parsed = JSON.parse(cleaned);\n trendReport = parsed.trendReport || parsed;\n\n // Validate required fields\n if (!trendReport.topTrends || !trendReport.hashtags) {\n throw new Error('Missing required fields in trend report');\n }\n\n return {\n json: {\n ...item,\n trendReport,\n agent1Status: 'success',\n agent1Timestamp: new Date().toISOString()\n }\n };\n} catch (err) {\n // Fallback: construct a minimal report from available data\n return {\n json: {\n ...item,\n trendReport: {\n topic: item.topic || 'General',\n industry: item.industry || 'Technology',\n researchTimestamp: new Date().toISOString(),\n topTrends: [{\n trendTitle: item.topic + ' Latest Developments',\n description: 'Key developments are shaping the ' + (item.industry || 'industry') + ' landscape.',\n relevanceScore: 7,\n dataPoint: 'Industry leaders are actively investing in this area.'\n }],\n keyInsights: ['Innovation is accelerating', 'Adoption rates are rising', 'New use cases emerging'],\n contentAngles: ['Educational', 'Thought leadership', 'Industry news'],\n hashtags: {\n linkedin: ['#Innovation', '#' + (item.industry || 'Technology'), '#Leadership'],\n twitter: ['#' + (item.topic || 'Tech').replace(/\\s/g, ''), '#Innovation'],\n instagram: ['#innovation', '#tech', '#business', '#growth', '#future', '#digital', '#strategy', '#success', '#entrepreneurship', '#ai']\n },\n researchStatus: 'fallback'\n },\n agent1Status: 'fallback',\n agent1Error: err.message,\n agent1Timestamp: new Date().toISOString()\n }\n };\n}"
},
"typeVersion": 2
},
{
"id": "cfa52632-e653-4152-b1b8-f96b4c4eafe0",
"name": "Wait - Rate Limit Agent 1",
"type": "n8n-nodes-base.wait",
"position": [
2560,
480
],
"parameters": {},
"typeVersion": 1
},
{
"id": "75452949-0c50-4ca3-8487-6d96d02a6a8c",
"name": "Agent 2 - Content Generation AI",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
2912,
480
],
"parameters": {
"text": "=You are an expert social media copywriter and content strategist. Using the trend research provided, create platform-optimized social media content.\n\nTrend Report:\n{{ JSON.stringify($json.trendReport, null, 2) }}\n\nBrand Voice: {{ $json.brandVoice || 'Professional, insightful, forward-thinking' }}\nTarget Audience: {{ $json.targetAudience || 'Business professionals and tech enthusiasts' }}\n\nCreate platform-specific captions AND image generation prompts.\n\nPlatform requirements:\n- LINKEDIN: \u22643000 chars, professional tone, storytelling hook, 3-5 hashtags at end, no emojis in first line\n- TWITTER/X: \u2264280 chars (strict), punchy/bold opening, 2-3 inline hashtags, optionally 1 emoji\n- INSTAGRAM: \u22642200 chars, conversational and engaging, strong hook, call-to-action, 10-15 hashtags in first comment section\n\nFor EACH platform also generate a DALL-E image prompt (photorealistic or modern graphic style, no text in image).\n\nRespond ONLY with a valid JSON object in this exact structure:\n{\n \"contentBundle\": {\n \"generationTimestamp\": \"ISO 8601 string\",\n \"topic\": \"string\",\n \"linkedin\": {\n \"caption\": \"string (\u22643000 chars)\",\n \"hashtags\": [\"#tag1\", \"#tag2\"],\n \"imagePrompt\": \"string (detailed DALL-E prompt)\",\n \"characterCount\": 0\n },\n \"twitter\": {\n \"caption\": \"string (\u2264280 chars STRICT)\",\n \"hashtags\": [\"#tag1\", \"#tag2\"],\n \"imagePrompt\": \"string (detailed DALL-E prompt)\",\n \"characterCount\": 0\n },\n \"instagram\": {\n \"caption\": \"string (\u22642200 chars)\",\n \"firstCommentHashtags\": \"string (all hashtags as single string for first comment)\",\n \"imagePrompt\": \"string (detailed DALL-E prompt)\",\n \"characterCount\": 0\n },\n \"contentStatus\": \"success\"\n }\n}",
"options": {
"systemMessage": "You are a precise JSON-outputting content generation agent. Output ONLY valid JSON. Strictly enforce character limits \u2014 especially Twitter's 280-character hard limit. Count characters carefully."
},
"promptType": "define"
},
"typeVersion": 1.6
},
{
"id": "3cc7404b-3527-43cb-aec0-5dd93a1539bb",
"name": "OpenAI - Agent 2 Model",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
2928,
704
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4.1-mini"
},
"options": {
"temperature": 0.75
},
"builtInTools": {}
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.3
},
{
"id": "1b14ca90-795f-4133-97cd-319c3d149386",
"name": "JS - Parse & Validate Content Bundle",
"type": "n8n-nodes-base.code",
"position": [
3216,
480
],
"parameters": {
"mode": "runOnceForEachItem",
"jsCode": "// Parse Agent 2 JSON output, validate structure, and enforce character limits\nconst item = $input.item.json;\nlet contentBundle;\n\ntry {\n const rawText = item.output || item.text || item.response || '';\n const cleaned = rawText.replace(/```json|```/g, '').trim();\n const parsed = JSON.parse(cleaned);\n contentBundle = parsed.contentBundle || parsed;\n\n // Validate required platform keys\n if (!contentBundle.linkedin || !contentBundle.twitter || !contentBundle.instagram) {\n throw new Error('Missing platform content in content bundle');\n }\n\n // Enforce Twitter 280-char hard limit\n if (contentBundle.twitter.caption && contentBundle.twitter.caption.length > 280) {\n contentBundle.twitter.caption = contentBundle.twitter.caption.substring(0, 277) + '...';\n }\n\n // Update character counts\n contentBundle.linkedin.characterCount = (contentBundle.linkedin.caption || '').length;\n contentBundle.twitter.characterCount = (contentBundle.twitter.caption || '').length;\n contentBundle.instagram.characterCount = (contentBundle.instagram.caption || '').length;\n\n // Validate image prompts exist\n const imageFailed = !contentBundle.linkedin.imagePrompt || !contentBundle.twitter.imagePrompt || !contentBundle.instagram.imagePrompt;\n\n return {\n json: {\n ...item,\n contentBundle,\n imageFailed,\n agent2Status: 'success',\n agent2Timestamp: new Date().toISOString()\n }\n };\n} catch (err) {\n return {\n json: {\n ...item,\n contentBundle: null,\n imageFailed: true,\n agent2Status: 'error',\n agent2Error: err.message,\n agent2Timestamp: new Date().toISOString()\n }\n };\n}"
},
"typeVersion": 2
},
{
"id": "16b2126d-3f34-4f06-990b-a02a9a8f1cfa",
"name": "Gate - Content Generation Succeeded?",
"type": "n8n-nodes-base.filter",
"position": [
3392,
480
],
"parameters": {
"options": {},
"conditions": {
"conditions": [
{
"operator": {
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.agent2Status }}",
"rightValue": "success"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "22e61125-a70b-4ae2-ad19-e3c99bab30a8",
"name": "DALL-E - Generate LinkedIn Image",
"type": "n8n-nodes-base.httpRequest",
"position": [
3712,
352
],
"parameters": {
"url": "https://api.openai.com/v1/images/generations",
"method": "POST",
"options": {
"response": {
"response": {
"responseFormat": "json"
}
}
},
"jsonBody": "={\n \"model\": \"dall-e-3\",\n \"prompt\": \"{{ $json.contentBundle.linkedin.imagePrompt }}\",\n \"n\": 1,\n \"size\": \"1024x1024\",\n \"quality\": \"standard\"\n}",
"sendBody": true,
"specifyBody": "json",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth"
},
"credentials": {
"httpHeaderAuth": {
"name": "<your credential>"
}
},
"typeVersion": 4.2
},
{
"id": "d6217328-616c-427e-af1d-4d130d62e631",
"name": "DALL-E - Generate Twitter Image",
"type": "n8n-nodes-base.httpRequest",
"position": [
3712,
512
],
"parameters": {
"url": "https://api.openai.com/v1/images/generations",
"method": "POST",
"options": {
"response": {
"response": {
"responseFormat": "json"
}
}
},
"jsonBody": "={\n \"model\": \"dall-e-3\",\n \"prompt\": \"{{ $json.contentBundle.twitter.imagePrompt }}\",\n \"n\": 1,\n \"size\": \"1024x1024\",\n \"quality\": \"standard\"\n}",
"sendBody": true,
"specifyBody": "json",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth"
},
"credentials": {
"httpHeaderAuth": {
"name": "<your credential>"
}
},
"typeVersion": 4.2
},
{
"id": "92fb9ba7-63be-451c-b739-8a36357e9ae0",
"name": "DALL-E - Generate Instagram Image",
"type": "n8n-nodes-base.httpRequest",
"position": [
3712,
672
],
"parameters": {
"url": "https://api.openai.com/v1/images/generations",
"method": "POST",
"options": {
"response": {
"response": {
"responseFormat": "json"
}
}
},
"jsonBody": "={\n \"model\": \"dall-e-3\",\n \"prompt\": \"{{ $json.contentBundle.instagram.imagePrompt }}\",\n \"n\": 1,\n \"size\": \"1024x1024\",\n \"quality\": \"standard\"\n}",
"sendBody": true,
"specifyBody": "json",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth"
},
"credentials": {
"httpHeaderAuth": {
"name": "<your credential>"
}
},
"typeVersion": 4.2
},
{
"id": "d93e314b-a34b-4117-8f94-73871ca304b1",
"name": "JS - Merge Image URLs into Bundle",
"type": "n8n-nodes-base.code",
"position": [
3920,
512
],
"parameters": {
"mode": "runOnceForEachItem",
"jsCode": "// Merge image URLs from all three DALL-E calls back into the content bundle\n// NOTE: In n8n this node receives the last item; use $('node-name').all() pattern\n// to merge. Here we enrich with image URLs assuming they're in scope.\nconst item = $input.item.json;\n\nconst linkedinImageUrl = item.linkedinImageData?.data?.[0]?.url || item.contentBundle?.linkedin?.imagePrompt || null;\nconst twitterImageUrl = item.twitterImageData?.data?.[0]?.url || item.contentBundle?.twitter?.imagePrompt || null;\nconst instagramImageUrl = item.instagramImageData?.data?.[0]?.url || item.contentBundle?.instagram?.imagePrompt || null;\n\nreturn {\n json: {\n ...item,\n contentBundle: {\n ...item.contentBundle,\n linkedin: { ...item.contentBundle.linkedin, imageUrl: linkedinImageUrl },\n twitter: { ...item.contentBundle.twitter, imageUrl: twitterImageUrl },\n instagram: { ...item.contentBundle.instagram, imageUrl: instagramImageUrl }\n },\n imagesReady: !!(linkedinImageUrl && twitterImageUrl && instagramImageUrl),\n imagesMergeTimestamp: new Date().toISOString()\n }\n};"
},
"typeVersion": 2
},
{
"id": "8c45de3a-6bd7-4bd5-b2ce-640efc87f0d5",
"name": "Wait - Rate Limit Agent 2",
"type": "n8n-nodes-base.wait",
"position": [
4144,
512
],
"parameters": {},
"typeVersion": 1
},
{
"id": "9d24de45-cef8-495c-b942-16c34e1e484a",
"name": "Agent 3 - Post to LinkedIn",
"type": "n8n-nodes-base.httpRequest",
"position": [
4368,
352
],
"parameters": {
"url": "https://api.linkedin.com/v2/ugcPosts",
"method": "POST",
"options": {
"response": {
"response": {
"responseFormat": "json"
}
}
},
"jsonBody": "={\n \"author\": \"urn:li:person:YOUR_LINKEDIN_PERSON_URN\",\n \"lifecycleState\": \"PUBLISHED\",\n \"specificContent\": {\n \"com.linkedin.ugc.ShareContent\": {\n \"shareCommentary\": {\n \"text\": \"{{ $json.contentBundle.linkedin.caption }}\"\n },\n \"shareMediaCategory\": \"IMAGE\",\n \"media\": [\n {\n \"status\": \"READY\",\n \"description\": { \"text\": \"{{ $json.trendReport.topTrends[0].description }}\" },\n \"originalUrl\": \"{{ $json.contentBundle.linkedin.imageUrl }}\",\n \"title\": { \"text\": \"{{ $json.contentBundle.topic }}\" }\n }\n ]\n }\n },\n \"visibility\": {\n \"com.linkedin.ugc.MemberNetworkVisibility\": \"PUBLIC\"\n }\n}",
"sendBody": true,
"specifyBody": "json",
"authentication": "genericCredentialType",
"genericAuthType": "oAuth2Api"
},
"credentials": {
"oAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 4.2,
"continueOnFail": true
},
{
"id": "b5c4c94f-f548-424c-a2fe-328881e97082",
"name": "Agent 3 - Post to X (Twitter)",
"type": "n8n-nodes-base.httpRequest",
"position": [
4368,
512
],
"parameters": {
"url": "https://api.twitter.com/2/tweets",
"method": "POST",
"options": {
"response": {
"response": {
"responseFormat": "json"
}
}
},
"jsonBody": "={\n \"text\": \"{{ $json.contentBundle.twitter.caption }}\",\n \"media\": {\n \"media_ids\": [\"{{ $json.contentBundle.twitter.mediaId || '' }}\"]\n }\n}",
"sendBody": true,
"specifyBody": "json",
"authentication": "genericCredentialType",
"genericAuthType": "oAuth2Api"
},
"credentials": {
"oAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 4.2,
"continueOnFail": true
},
{
"id": "220b004b-1a73-4691-9922-50e74c32b451",
"name": "Agent 3 - Create Instagram Container",
"type": "n8n-nodes-base.httpRequest",
"position": [
4368,
672
],
"parameters": {
"url": "=https://graph.facebook.com/v19.0/YOUR_INSTAGRAM_ACCOUNT_ID/media",
"method": "POST",
"options": {
"response": {
"response": {
"responseFormat": "json"
}
}
},
"jsonBody": "={\n \"image_url\": \"{{ $json.contentBundle.instagram.imageUrl }}\",\n \"caption\": \"{{ $json.contentBundle.instagram.caption }}\",\n \"access_token\": \"{{ $credentials.accessToken }}\"\n}",
"sendBody": true,
"specifyBody": "json",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth"
},
"credentials": {
"httpHeaderAuth": {
"name": "<your credential>"
}
},
"typeVersion": 4.2,
"continueOnFail": true
},
{
"id": "e9abd925-347c-44a9-a19b-2355fc339ce8",
"name": "Agent 3 - Publish Instagram Post",
"type": "n8n-nodes-base.httpRequest",
"position": [
4592,
672
],
"parameters": {
"url": "=https://graph.facebook.com/v19.0/YOUR_INSTAGRAM_ACCOUNT_ID/media_publish",
"method": "POST",
"options": {
"response": {
"response": {
"responseFormat": "json"
}
}
},
"jsonBody": "={\n \"creation_id\": \"{{ $json.id }}\",\n \"access_token\": \"{{ $credentials.accessToken }}\"\n}",
"sendBody": true,
"specifyBody": "json",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth"
},
"credentials": {
"httpHeaderAuth": {
"name": "<your credential>"
}
},
"typeVersion": 4.2,
"continueOnFail": true
},
{
"id": "59a67a7d-ee92-46c7-b7f9-6133c962dbda",
"name": "JS - Build Publish Report",
"type": "n8n-nodes-base.code",
"position": [
5008,
512
],
"parameters": {
"mode": "runOnceForEachItem",
"jsCode": "// Collect results from all three platform posts and build final status report\nconst item = $input.item.json;\n\nconst linkedinPostId = item.linkedinResult?.id || item.id || null;\nconst twitterPostId = item.twitterResult?.data?.id || item.data?.id || null;\nconst instagramPostId = item.instagramPublishResult?.id || item.id || null;\n\nconst linkedinStatus = linkedinPostId ? 'published' : (item.linkedinError ? 'failed' : 'unknown');\nconst twitterStatus = twitterPostId ? 'published' : (item.twitterError ? 'failed' : 'unknown');\nconst instagramStatus = instagramPostId ? 'published' : (item.instagramError ? 'failed' : 'unknown');\n\nconst publishedDate = new Date().toISOString().split('T')[0];\nconst publishedTimestamp = new Date().toISOString();\n\nreturn {\n json: {\n ...item,\n publishReport: {\n requestId: item.requestId,\n topic: item.topic,\n publishedDate,\n publishedTimestamp,\n platforms: {\n linkedin: {\n status: linkedinStatus,\n postId: linkedinPostId,\n url: linkedinPostId ? 'https://www.linkedin.com/feed/update/' + linkedinPostId : null\n },\n twitter: {\n status: twitterStatus,\n postId: twitterPostId,\n url: twitterPostId ? 'https://x.com/i/web/status/' + twitterPostId : null\n },\n instagram: {\n status: instagramStatus,\n postId: instagramPostId\n }\n },\n overallStatus: [linkedinStatus, twitterStatus, instagramStatus].every(s => s === 'published')\n ? 'all_published'\n : [linkedinStatus, twitterStatus, instagramStatus].some(s => s === 'published')\n ? 'partial_success'\n : 'all_failed'\n }\n }\n};"
},
"typeVersion": 2
},
{
"id": "a08d5361-4bfb-4874-8143-ce8eb4fa9662",
"name": "Log to Google Sheet Tracker",
"type": "n8n-nodes-base.httpRequest",
"position": [
5232,
400
],
"parameters": {
"url": "https://sheets.googleapis.com/v4/spreadsheets/YOUR_SHEET_ID/values/ContentLog!A1:append?valueInputOption=USER_ENTERED",
"method": "POST",
"options": {},
"jsonBody": "={\n \"values\": [[\n \"{{ $json.publishReport.publishedDate }}\",\n \"{{ $json.topic }}\",\n \"{{ $json.industry }}\",\n \"{{ $json.publishReport.platforms.linkedin.status }}\",\n \"{{ $json.publishReport.platforms.linkedin.postId || 'N/A' }}\",\n \"{{ $json.publishReport.platforms.twitter.status }}\",\n \"{{ $json.publishReport.platforms.twitter.postId || 'N/A' }}\",\n \"{{ $json.publishReport.platforms.instagram.status }}\",\n \"{{ $json.publishReport.platforms.instagram.postId || 'N/A' }}\",\n \"{{ $json.publishReport.overallStatus }}\",\n \"{{ $json.publishReport.publishedTimestamp }}\",\n \"{{ $json.requestId }}\"\n ]]\n}",
"sendBody": true,
"specifyBody": "json",
"authentication": "genericCredentialType",
"genericAuthType": "oAuth2Api"
},
"credentials": {
"oAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 4.2
},
{
"id": "b04c9fab-5cc4-45a8-9d94-432e17bc0a32",
"name": "Filter - Any Platform Failed?",
"type": "n8n-nodes-base.filter",
"position": [
5232,
624
],
"parameters": {
"options": {},
"conditions": {
"conditions": [
{
"operator": {
"type": "string",
"operation": "notEquals"
},
"leftValue": "={{ $json.publishReport.overallStatus }}",
"rightValue": "all_published"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "b1d6e460-99b1-4609-a2b4-ac521249fc11",
"name": "Alert - Send Failure Email",
"type": "n8n-nodes-base.httpRequest",
"position": [
5456,
624
],
"parameters": {
"url": "https://api.sendgrid.com/v3/mail/send",
"method": "POST",
"options": {},
"jsonBody": "={\n \"personalizations\": [{\"to\": [{\"email\": \"your-alert-email@example.com\"}]}],\n \"from\": {\"email\": \"alerts@yourdomain.com\", \"name\": \"Content Factory Alert\"},\n \"subject\": \"[Content Factory] Partial/Failed Post - {{ $json.topic }}\",\n \"content\": [{\n \"type\": \"text/plain\",\n \"value\": \"Post status for topic '{{ $json.topic }}' ({{ $json.requestId }}):\\n\\nLinkedIn: {{ $json.publishReport.platforms.linkedin.status }}\\nTwitter/X: {{ $json.publishReport.platforms.twitter.status }}\\nInstagram: {{ $json.publishReport.platforms.instagram.status }}\\n\\nOverall: {{ $json.publishReport.overallStatus }}\\nTimestamp: {{ $json.publishReport.publishedTimestamp }}\"\n }]\n}",
"sendBody": true,
"specifyBody": "json",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth"
},
"credentials": {
"httpHeaderAuth": {
"name": "<your credential>"
}
},
"typeVersion": 4.2
},
{
"id": "e6a7054c-1d47-4978-b57e-6e5b72a0e3e8",
"name": "Respond - Webhook Success",
"type": "n8n-nodes-base.respondToWebhook",
"position": [
5456,
400
],
"parameters": {
"options": {},
"respondWith": "json",
"responseBody": "={{ JSON.stringify({ success: true, requestId: $json.requestId, overallStatus: $json.publishReport.overallStatus, platforms: $json.publishReport.platforms, publishedAt: $json.publishReport.publishedTimestamp }) }}"
},
"typeVersion": 1
},
{
"id": "250bf7cf-aea2-48ff-97d3-026a8cbffd6c",
"name": "Wait For Data",
"type": "n8n-nodes-base.wait",
"position": [
4576,
352
],
"parameters": {
"amount": 15
},
"typeVersion": 1.1
}
],
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "96013668-2ea6-4551-b59a-030a6881bb83",
"connections": {
"Wait For Data": {
"main": [
[
{
"node": "JS - Build Publish Report",
"type": "main",
"index": 0
}
]
]
},
"Normalize Input": {
"main": [
[
{
"node": "Agent 1 - Trend Research AI",
"type": "main",
"index": 0
}
]
]
},
"OpenAI - Agent 1 Model": {
"ai_languageModel": [
[
{
"node": "Agent 1 - Trend Research AI",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"OpenAI - Agent 2 Model": {
"ai_languageModel": [
[
{
"node": "Agent 2 - Content Generation AI",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"JS - Build Publish Report": {
"main": [
[
{
"node": "Log to Google Sheet Tracker",
"type": "main",
"index": 0
},
{
"node": "Filter - Any Platform Failed?",
"type": "main",
"index": 0
}
]
]
},
"Wait - Rate Limit Agent 1": {
"main": [
[
{
"node": "Agent 2 - Content Generation AI",
"type": "main",
"index": 0
}
]
]
},
"Wait - Rate Limit Agent 2": {
"main": [
[
{
"node": "Agent 3 - Post to LinkedIn",
"type": "main",
"index": 0
},
{
"node": "Agent 3 - Post to X (Twitter)",
"type": "main",
"index": 0
},
{
"node": "Agent 3 - Create Instagram Container",
"type": "main",
"index": 0
}
]
]
},
"Webhook - Content Request": {
"main": [
[
{
"node": "Normalize Input",
"type": "main",
"index": 0
}
]
]
},
"Agent 3 - Post to LinkedIn": {
"main": [
[
{
"node": "Wait For Data",
"type": "main",
"index": 0
}
]
]
},
"Agent 1 - Trend Research AI": {
"main": [
[
{
"node": "JS - Parse & Validate Trend Report",
"type": "main",
"index": 0
}
]
]
},
"Log to Google Sheet Tracker": {
"main": [
[
{
"node": "Respond - Webhook Success",
"type": "main",
"index": 0
}
]
]
},
"Agent 3 - Post to X (Twitter)": {
"main": [
[
{
"node": "JS - Build Publish Report",
"type": "main",
"index": 0
}
]
]
},
"Filter - Any Platform Failed?": {
"main": [
[
{
"node": "Alert - Send Failure Email",
"type": "main",
"index": 0
}
]
]
},
"Agent 2 - Content Generation AI": {
"main": [
[
{
"node": "JS - Parse & Validate Content Bundle",
"type": "main",
"index": 0
}
]
]
},
"DALL-E - Generate Twitter Image": {
"main": [
[
{
"node": "JS - Merge Image URLs into Bundle",
"type": "main",
"index": 0
}
]
]
},
"Agent 3 - Publish Instagram Post": {
"main": [
[
{
"node": "JS - Build Publish Report",
"type": "main",
"index": 0
}
]
]
},
"DALL-E - Generate LinkedIn Image": {
"main": [
[
{
"node": "JS - Merge Image URLs into Bundle",
"type": "main",
"index": 0
}
]
]
},
"DALL-E - Generate Instagram Image": {
"main": [
[
{
"node": "JS - Merge Image URLs into Bundle",
"type": "main",
"index": 0
}
]
]
},
"JS - Merge Image URLs into Bundle": {
"main": [
[
{
"node": "Wait - Rate Limit Agent 2",
"type": "main",
"index": 0
}
]
]
},
"JS - Parse & Validate Trend Report": {
"main": [
[
{
"node": "Wait - Rate Limit Agent 1",
"type": "main",
"index": 0
}
]
]
},
"Schedule Trigger - Content Calendar": {
"main": [
[
{
"node": "Normalize Input",
"type": "main",
"index": 0
}
]
]
},
"Agent 3 - Create Instagram Container": {
"main": [
[
{
"node": "Agent 3 - Publish Instagram Post",
"type": "main",
"index": 0
}
]
]
},
"Gate - Content Generation Succeeded?": {
"main": [
[
{
"node": "DALL-E - Generate LinkedIn Image",
"type": "main",
"index": 0
},
{
"node": "DALL-E - Generate Twitter Image",
"type": "main",
"index": 0
},
{
"node": "DALL-E - Generate Instagram Image",
"type": "main",
"index": 0
}
]
]
},
"JS - Parse & Validate Content Bundle": {
"main": [
[
{
"node": "Gate - Content Generation Succeeded?",
"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.
httpHeaderAuthoAuth2ApiopenAiApi
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
This workflow orchestrates three specialized AI agents in sequence to research trends, generate platform-specific content (captions + images), and schedule posts across LinkedIn, X (Twitter), and Instagram.
Source: https://n8n.io/workflows/15162/ — 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.
⏺ 🚀 How it works
L&D_AgentsAI_ATIVO. Uses httpRequest, agent, googleCalendarTool, toolSerpApi. Webhook trigger; 93 nodes.
CLINICAINTEGRAL_secretary. Uses postgres, mcpClientTool, googleDriveTool, toolWorkflow. Webhook trigger; 89 nodes.
Remi 1.1. Uses lmChatOpenAi, memoryPostgresChat, openAi, postgres. Webhook trigger; 89 nodes.
This n8n workflow orchestrates a powerful suite of AI Agents and automations to manage and optimize various aspects of an e-commerce operation, particularly for platforms like Shopify. It leverages La