This workflow corresponds to n8n.io template #12865 — we link there as the canonical source.
This workflow follows the Agent → Googlegemini 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 →
{
"meta": {
"templateCredsSetupCompleted": true
},
"nodes": [
{
"id": "{{NODE_ID_1}}",
"name": "Google Gemini Chat Model",
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
"position": [
1008,
1952
],
"parameters": {
"options": {}
},
"credentials": {
"googlePalmApi": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "{{NODE_ID_2}}",
"name": "LinkedIn Content Automation Scheduler",
"type": "n8n-nodes-base.scheduleTrigger",
"position": [
336,
1200
],
"parameters": {
"rule": {
"interval": [
{
"field": "hours",
"hoursInterval": 12
}
]
}
},
"typeVersion": 1.2
},
{
"id": "{{NODE_ID_3}}",
"name": "Fetch LinkedIn Profile URLs",
"type": "n8n-nodes-base.googleSheets",
"position": [
560,
1200
],
"parameters": {
"options": {},
"sheetName": {
"__rl": true,
"mode": "list",
"value": "{{SHEET_GID_PLACEHOLDER}}",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/{{GOOGLE_SHEET_ID_PLACEHOLDER}}/edit#gid={{SHEET_GID_PLACEHOLDER}}",
"cachedResultName": "usernames & links"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "{{GOOGLE_SHEET_ID_PLACEHOLDER}}",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/{{GOOGLE_SHEET_ID_PLACEHOLDER}}/edit",
"cachedResultName": "LinkedIn Usernames"
}
},
"typeVersion": 4.5
},
{
"id": "{{NODE_ID_4}}",
"name": "Process Profiles in Batches",
"type": "n8n-nodes-base.splitInBatches",
"position": [
784,
1200
],
"parameters": {
"options": {},
"batchSize": 3
},
"typeVersion": 3
},
{
"id": "{{NODE_ID_5}}",
"name": "Scrape LinkedIn Posts API",
"type": "n8n-nodes-base.httpRequest",
"position": [
1008,
1136
],
"parameters": {
"url": "https://api.apify.com/v2/acts/LQQIXN9Othf8f7R5n/run-sync-get-dataset-items",
"method": "POST",
"options": {
"timeout": 60000,
"redirect": {
"redirect": {}
}
},
"jsonBody": "={\n \"username\": \"{{ $json['Linkedin url'] }}\",\n \"page_number\": 1,\n \"limit\": 1\n}",
"sendBody": true,
"sendHeaders": true,
"specifyBody": "json",
"headerParameters": {
"parameters": [
{
"name": "Accept",
"value": "application/json"
},
{
"name": "Authorization",
"value": "Bearer {{APIFY_API_TOKEN_PLACEHOLDER}}"
},
{
"name": "Content-Type",
"value": "application/json"
}
]
}
},
"typeVersion": 4.2
},
{
"id": "{{NODE_ID_6}}",
"name": "Rate Limiting Delay",
"type": "n8n-nodes-base.wait",
"position": [
1232,
1136
],
"parameters": {
"amount": 3
},
"typeVersion": 1.1
},
{
"id": "{{NODE_ID_7}}",
"name": "Filter High-Engagement Posts",
"type": "n8n-nodes-base.filter",
"position": [
1456,
1136
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "loose"
},
"combinator": "or",
"conditions": [
{
"id": "{{CONDITION_ID_1}}",
"operator": {
"type": "number",
"operation": "gt"
},
"leftValue": "={{ $json.stats.reposts }}",
"rightValue": 20
},
{
"id": "{{CONDITION_ID_2}}",
"operator": {
"type": "number",
"operation": "gt"
},
"leftValue": "={{ $json.stats.like }}",
"rightValue": 20
},
{
"id": "{{CONDITION_ID_3}}",
"operator": {
"type": "number",
"operation": "gt"
},
"leftValue": "={{ $json.stats.comments }}",
"rightValue": 20
}
]
},
"looseTypeValidation": true
},
"typeVersion": 2.2
},
{
"id": "{{NODE_ID_8}}",
"name": "Save Viral Posts to Sheets",
"type": "n8n-nodes-base.googleSheets",
"position": [
1680,
1200
],
"parameters": {
"columns": {
"value": {
"Likes": "={{ $json.stats.like }}",
"Reposts": "={{ $json.stats.reposts }}",
"Comments": "={{ $json.stats.comments }}",
"Creator Name": "={{ $json.author.first_name }} {{ $json.author.last_name }}",
"Date Scraped": "={{$now.format('yyyy-MM-dd').toJsonString() }}",
"Date Published": "={{ $json.posted_at.date.toDate().format('yyyy-MM-dd').toJsonString() }}",
"Caption/Text/Copy": "={{ $json.text }}",
"Linkedin Post URL": "={{ $json.url }}"
},
"schema": [
{
"id": "Linkedin Post URL",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Linkedin Post URL",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Creator Name",
"type": "string",
"display": true,
"required": false,
"displayName": "Creator Name",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Caption/Text/Copy",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Caption/Text/Copy",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Likes",
"type": "string",
"display": true,
"required": false,
"displayName": "Likes",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Comments",
"type": "string",
"display": true,
"required": false,
"displayName": "Comments",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Reposts",
"type": "string",
"display": true,
"required": false,
"displayName": "Reposts",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Date Published",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Date Published",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Date Scraped",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Date Scraped",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "is done",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "is done",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [
"Caption/Text/Copy"
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "appendOrUpdate",
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/{{GOOGLE_SHEET_ID_PLACEHOLDER}}/edit#gid=0",
"cachedResultName": "scrape data"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "{{GOOGLE_SHEET_ID_PLACEHOLDER}}",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/{{GOOGLE_SHEET_ID_PLACEHOLDER}}/edit",
"cachedResultName": "LinkedIn Usernames"
}
},
"typeVersion": 4.5
},
{
"id": "{{NODE_ID_9}}",
"name": "New Post Data Trigger",
"type": "n8n-nodes-base.googleSheetsTrigger",
"position": [
352,
1760
],
"parameters": {
"options": {},
"pollTimes": {
"item": [
{
"mode": "everyMinute"
}
]
},
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/{{GOOGLE_SHEET_ID_PLACEHOLDER}}/edit#gid=0",
"cachedResultName": "scrape data"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "{{GOOGLE_SHEET_ID_PLACEHOLDER}}"
}
},
"credentials": {
"googleSheetsTriggerOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "{{NODE_ID_10}}",
"name": "Filter Recent Posts (3 Days)",
"type": "n8n-nodes-base.filter",
"position": [
576,
1760
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "loose"
},
"combinator": "and",
"conditions": [
{
"id": "{{CONDITION_ID_4}}",
"operator": {
"type": "number",
"operation": "lte"
},
"leftValue": "={{ Math.floor((new Date().setHours(0,0,0,0) - new Date($json['Date Published']).setHours(0,0,0,0)) / (1000 * 60 * 60 * 24)) }}",
"rightValue": 3
},
{
"id": "{{CONDITION_ID_5}}",
"operator": {
"type": "string",
"operation": "empty",
"singleValue": true
},
"leftValue": "={{ $json['is done'] }}",
"rightValue": ""
}
]
},
"looseTypeValidation": true
},
"typeVersion": 2.2
},
{
"id": "{{NODE_ID_11}}",
"name": "Aggregate Trending Content",
"type": "n8n-nodes-base.aggregate",
"position": [
800,
1760
],
"parameters": {
"options": {},
"aggregate": "aggregateAllItemData"
},
"typeVersion": 1
},
{
"id": "{{NODE_ID_12}}",
"name": "LinkedIn Content Strategy AI",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
1024,
1760
],
"parameters": {
"text": "={{ $json.data }}",
"options": {
"systemMessage": "=You are an expert LinkedIn content strategist and AI analyst specializing in trend detection, viral content creation, and visual storytelling. Your role is to analyze aggregated LinkedIn posts from multiple accounts over specified time periods, identify trending patterns, and generate original, high-engagement content with accompanying visual elements.\n\n## Input Data Analysis Framework\n\n### Data Structure Expected:\n- **Post URLs**: LinkedIn post links for content extraction\n- **Creator Names**: Original poster profiles\n- **Post Content**: Full captions/text/copy\n- **Engagement Metrics**: Likes, comments, reposts, views\n- **Publication Dates**: When posts were published\n- **Scraping Dates**: When data was collected\n\n### Trend Pattern Recognition Process:\n\n1. **Content Theme Analysis**\n - Extract core topics and subjects from all posts\n - Identify recurring keywords, phrases, and concepts\n - Map topic clusters and their engagement performance\n - Detect emerging vs declining conversation themes\n\n2. **Engagement Pattern Detection**\n - High-engagement triggers (1000+ likes): Universal pain points, surprising statistics, contrarian views\n - Comment-heavy posts (50+ comments): Controversial topics, open-ended questions, community discussions\n - Repost-worthy content (10+ shares): Actionable insights, frameworks, quotable moments\n - Cross-reference engagement with posting times and content types\n\n3. **Linguistic and Format Analysis**\n - Hook patterns that drive clicks and reads\n - Content structure preferences (lists, stories, insights)\n - Optimal post length correlation with engagement\n - Hashtag effectiveness and trending tags\n - Emoji usage and formatting preferences\n\n4. **Industry Context Mapping**\n - Sector-specific trending topics\n - Cross-industry conversation bridges\n - Seasonal/temporal trend correlations\n - Competitive intelligence insights\n\n## Content Generation Framework\n\n### Trending Topic Synthesis:\n- Combine insights from top-performing posts\n- Identify gaps in current conversations\n- Find fresh angles on popular themes\n- Cross-pollinate ideas from different industries\n\n### Original Post Creation Guidelines:\n\n**CRITICAL FORMATTING RULES:**\n- Use ONLY plain text formatting suitable for LinkedIn\n- NO markdown symbols (* ** _ etc.)\n- Use line breaks and spacing for emphasis\n- Use \u2192 arrows for bullet points\n- Use CAPITAL LETTERS sparingly for emphasis\n- Use emojis strategically (1-3 per post maximum)\n\n**Structure Template:**\n[ATTENTION HOOK - Bold statement/question/statistic]\n\n[CONTEXT BRIDGE - Connect to trending topic]\n\n[UNIQUE INSIGHT/STORY - Your fresh perspective with specific examples]\n\n[ACTIONABLE VALUE - What readers can implement]\n\n[ENGAGEMENT TRIGGER - Question or call-to-action]\n\n[STRATEGIC HASHTAGS - 3-5 relevant trending tags]\n\n**LinkedIn-Native Formatting Examples:**\n\nGOOD \u2705:\nThe 200K Marketing Research Team? Soon, it's just an AI Agent.\n\nWe're witnessing a seismic shift. Companies paying six-figure salaries for extensive market analysis are about to find their process distilled into seconds.\n\nHere's what I discovered:\n\n\u2192 Market research teams spend weeks on competitor analysis\n\u2192 Results often outdated by presentation time\n\u2192 Cost per insight: astronomical\n\u2192 ROI: questionable at best\n\nBut what if you could deploy an AI agent that:\n\u2192 Scans 1000s of data points in minutes\n\u2192 Identifies emerging market gaps instantly\n\u2192 Benchmarks competitor strategies with real-time data\n\u2192 Delivers actionable insights with confidence scores\n\nThe future isn't about MORE people.\nIt's about SMARTER tools.\n\nWhat's one research task you wish AI could automate right now?\n\n#AI #MarketResearch #BusinessIntelligence #FutureOfWork\n\nBAD \u274c:\nThe $200K Marketing Research Team? Soon, it's just an AI Agent.\n\nWe're witnessing a seismic shift. Companies paying six-figure salaries for extensive market analysis are about to find their process distilled into seconds.\n\nHere's what I discovered:\n\n*Market research teams spend weeks on competitor analysis*\n\n*Results often outdated by presentation time*\n\n**Writing Style Rules:**\n- Open with pattern interrupts or surprising statistics\n- Use storytelling with concrete examples and outcomes\n- Include specific numbers, percentages, or timeframes\n- Maintain professional yet conversational tone\n- Format for mobile readability with strategic line breaks\n- Length: 150-300 words for optimal engagement\n\n## Visual Content Strategy\n\n### Image Generation Prompt Structure:\nSince AI image generation has lower text accuracy, create prompts that minimize text dependency while maximizing visual impact:\n\n**Effective Prompt Framework:**\n\"Professional LinkedIn-style [image type] featuring [main visual element]. Clean modern design with LinkedIn blue (#0077B5) and white background. [Specific visual composition]. Minimal text overlay with [1-3 key words max]. Professional business aesthetic with [supporting visual elements]. Mobile-optimized layout.\"\n\n**Visual Categories by Content Type:**\n1. **Data/Statistics**: Simple charts, percentage circles, arrow trends\n2. **Process/Framework**: Icon sequences, numbered steps, flowcharts \n3. **Concepts**: Metaphorical imagery, professional symbols, abstract representations\n4. **Personal Branding**: Professional headshot style with minimal text overlay\n5. **Industry Themes**: Industry-relevant imagery with professional overlay\n\n### Text-Light Visual Strategies:\n- Use icons and symbols instead of words\n- Leverage color coding for meaning\n- Employ visual metaphors and representations\n- Focus on numerical data visualization\n- Create recognizable patterns and layouts\n\n## Three-Output Generation Protocol\n\nFor each analysis, provide exactly three outputs:\n\n### 1. TITLE\n- 5-10 words maximum\n- Captures core trending insight\n- Uses power words for LinkedIn algorithm\n- Includes numbers/statistics when relevant\n- NO markdown formatting\n- Example format: \"The 240K AI Revolution Nobody Sees Coming\"\n\n### 2. POST\n- Complete LinkedIn post following structure template\n- NO MARKDOWN FORMATTING WHATSOEVER\n- Use plain text with strategic line breaks\n- Use \u2192 for bullet points\n- Use CAPITAL LETTERS sparingly for emphasis\n- Incorporates trending topic insights from analysis\n- Original perspective with specific examples\n- Proper spacing and natural LinkedIn formatting\n- 150-300 word sweet spot for engagement\n\n### 3. IMAGE GENERATION PROMPT\n- Maximum 50 words to ensure AI accuracy\n- Focuses on visual elements over text\n- Specifies LinkedIn professional aesthetics\n- Includes specific colors and layout guidance\n- Minimizes text requirements for better AI output\n\n## Sample Output Format\n\n{\n\"title\": \"AI Agents Replace 240K Research Teams\",\n\"post\": \"The 200K Marketing Research Team? Soon it's just an AI Agent.\\n\\nWe're witnessing a seismic shift. Companies paying six-figure salaries for extensive market analysis are about to find their process distilled into seconds.\\n\\nHere's what I discovered:\\n\\n\u2192 Market research teams spend weeks on competitor analysis\\n\u2192 Results often outdated by presentation time\\n\u2192 Cost per insight: astronomical\\n\u2192 ROI: questionable at best\\n\\nBut what if you could deploy an AI agent that:\\n\u2192 Scans 1000s of data points in minutes\\n\u2192 Identifies emerging market gaps instantly\\n\u2192 Benchmarks competitor strategies with real-time data\\n\u2192 Delivers actionable insights with confidence scores\\n\\nThe future isn't about MORE people.\\nIt's about SMARTER tools.\\n\\nWhat's one research task you wish AI could automate right now?\\n\\n#AI #MarketResearch #BusinessIntelligence #FutureOfWork\",\n\"image_prompt\": \"Professional infographic showing AI robot icon next to dollar symbol and research charts. LinkedIn blue background. Minimal text. Clean modern design. Mobile optimized.\"\n}\n\n## Quality Assurance Checklist\n\n**Content Quality:**\n- \u2713 Leverages genuine trending insights from data analysis\n- \u2713 Provides unique angle on popular topics\n- \u2713 Includes specific examples and actionable value\n- \u2713 Optimized for LinkedIn algorithm preferences\n- \u2713 Mobile-friendly formatting\n- \u2713 NO MARKDOWN FORMATTING\n\n**Visual Quality:**\n- \u2713 Prompt under 50 words for AI accuracy\n- \u2713 Minimal text dependency\n- \u2713 Professional LinkedIn aesthetic\n- \u2713 Clear visual hierarchy and composition\n- \u2713 Mobile-optimized dimensions\n\n**Formatting Quality:**\n- \u2713 Plain text only - no markdown symbols\n- \u2713 Strategic use of line breaks and spacing\n- \u2713 \u2192 arrows for bullet points\n- \u2713 CAPITAL LETTERS used sparingly\n- \u2713 Natural LinkedIn post appearance\n- \u2713 Mobile-readable formatting\n\n## Critical Formatting Reminders\n\n1. NEVER use asterisks (*) or double asterisks (**)\n2. NEVER use underscores (_) for emphasis\n3. Use line breaks and spacing for visual emphasis\n4. Use \u2192 for bullet points instead of dashes or asterisks\n5. Use CAPITAL LETTERS sparingly for key emphasis\n6. Test output to ensure it appears natural on LinkedIn\n7. Remember LinkedIn displays text as plain text, not markdown\n\nExecute this framework to transform raw LinkedIn post data into high-performing, original content with compelling visual elements that capitalize on proven trending patterns while establishing unique thought leadership and proper LinkedIn formatting."
},
"promptType": "define",
"hasOutputParser": true
},
"typeVersion": 2.2
},
{
"id": "{{NODE_ID_13}}",
"name": "JSON Output Parser",
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"position": [
1168,
1984
],
"parameters": {
"jsonSchemaExample": "{\n\"title\": \"AI Agents Replace $240K Research Teams\",\n\"post\": \"[Complete formatted LinkedIn post content with proper line breaks, engagement hooks, and hashtags]\",\n\"image_prompt\": \"Professional infographic showing AI robot icon next to dollar symbol and research charts. LinkedIn blue background. Minimal text. Clean modern design. Mobile optimized.\"\n}"
},
"typeVersion": 1.3
},
{
"id": "{{NODE_ID_14}}",
"name": "Publish to LinkedIn",
"type": "n8n-nodes-base.linkedIn",
"position": [
1584,
1760
],
"parameters": {
"text": "={{ $('LinkedIn Content Strategy AI').item.json.output.post }}",
"postAs": "organization",
"organization": "{{LINKEDIN_ORGANIZATION_ID_PLACEHOLDER}}",
"additionalFields": {
"title": "={{ $('LinkedIn Content Strategy AI').item.json.output.title }}"
},
"shareMediaCategory": "IMAGE"
},
"typeVersion": 1
},
{
"id": "{{NODE_ID_15}}",
"name": "Extract Analyzed Post URLs",
"type": "n8n-nodes-base.code",
"position": [
1792,
1760
],
"parameters": {
"jsCode": "// Replace with the actual name of the node where your data exists\nconst sourceNode = 'Filter Posts Within 3 Days';\n\n// Get all items from that node\nconst items = $items(sourceNode);\n\n// Map each item to only include Linkedin Post URL\nconst output = items.map(item => {\n return {\n json: {\n postUrl: item.json[\"Linkedin Post URL\"]\n }\n };\n});\n\nreturn output;"
},
"typeVersion": 2
},
{
"id": "{{NODE_ID_16}}",
"name": "Mark Posts as Analyzed",
"type": "n8n-nodes-base.googleSheets",
"position": [
2016,
1760
],
"parameters": {
"columns": {
"value": {
"is done": "yes",
"Linkedin Post URL": "={{ $json.postUrl }}"
},
"schema": [
{
"id": "Linkedin Post URL",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Linkedin Post URL",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Creator Name",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "Creator Name",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Caption/Text/Copy",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "Caption/Text/Copy",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Likes",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "Likes",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Comments",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "Comments",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Reposts",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "Reposts",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Date Published",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "Date Published",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Date Scraped",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "Date Scraped",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "is done",
"type": "string",
"display": true,
"required": false,
"displayName": "is done",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [
"Linkedin Post URL"
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "appendOrUpdate",
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/{{GOOGLE_SHEET_ID_PLACEHOLDER}}/edit#gid=0",
"cachedResultName": "scrape data"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "{{GOOGLE_SHEET_ID_PLACEHOLDER}}",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/{{GOOGLE_SHEET_ID_PLACEHOLDER}}/edit",
"cachedResultName": "LinkedIn Usernames"
}
},
"typeVersion": 4.7
},
{
"id": "{{NODE_ID_17}}",
"name": "Generate an image",
"type": "@n8n/n8n-nodes-langchain.googleGemini",
"position": [
1376,
1760
],
"parameters": {
"prompt": "={{ $json.output.image_prompt }}",
"modelId": {
"__rl": true,
"mode": "list",
"value": "models/imagen-4.0-generate-preview-06-06",
"cachedResultName": "models/imagen-4.0-generate-preview-06-06"
},
"options": {},
"resource": "image"
},
"credentials": {
"googlePalmApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.1
},
{
"id": "{{NODE_ID_18}}",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
-336,
1264
],
"parameters": {
"width": 480,
"height": 640,
"content": "## LinkedIn Viral Content Automation\n\nThis workflow automates LinkedIn content discovery and creation by scraping high-engagement posts, analyzing trends with AI, and publishing optimized content.\n\n## How it works\n\nThe workflow operates in two phases. First, it scrapes LinkedIn profiles every 12 hours via Apify API, filters posts with 20+ likes/comments/reposts, and saves viral content to Google Sheets. Second, when new data arrives, it analyzes recent posts using Google Gemini AI to identify trends, generates original LinkedIn-optimized content with images, and auto-publishes to your organization page.\n\n## Setup steps\n\n1. Create a Google Sheet with two sheets: one for LinkedIn profile URLs and one for scraped post data\n2. Add Apify API credentials for LinkedIn scraping\n3. Configure Google Sheets credentials for data storage\n4. Add Google Gemini API key for AI content generation\n5. Set up LinkedIn organization credentials for publishing\n6. Update all placeholder IDs in nodes with your actual credentials\n7. Adjust engagement thresholds and timing based on your needs"
},
"typeVersion": 1
},
{
"id": "{{NODE_ID_19}}",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
352,
1008
],
"parameters": {
"color": 7,
"width": 288,
"content": "## Profile Scraping\n\nScheduled trigger runs every 12 hours to fetch LinkedIn profile URLs from Google Sheets and process them in batches of 3 to avoid rate limits."
},
"typeVersion": 1
},
{
"id": "{{NODE_ID_20}}",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
1024,
944
],
"parameters": {
"color": 6,
"width": 288,
"content": "## Post Extraction\n\nCalls Apify API to scrape recent LinkedIn posts from each profile. Includes 3-second delay between requests to respect API rate limits."
},
"typeVersion": 1
},
{
"id": "{{NODE_ID_21}}",
"name": "Sticky Note4",
"type": "n8n-nodes-base.stickyNote",
"position": [
1440,
944
],
"parameters": {
"color": 7,
"width": 336,
"content": "## Engagement Filtering\n\nFilters posts with high engagement (20+ likes, comments, or reposts) and saves viral content to Google Sheets for analysis."
},
"typeVersion": 1
},
{
"id": "{{NODE_ID_22}}",
"name": "Sticky Note5",
"type": "n8n-nodes-base.stickyNote",
"position": [
352,
1552
],
"parameters": {
"color": 7,
"width": 320,
"content": "## Data Monitoring\n\nTriggers when new rows are added to Google Sheets. Filters unprocessed posts from the last 3 days and aggregates data for AI analysis."
},
"typeVersion": 1
},
{
"id": "{{NODE_ID_23}}",
"name": "Sticky Note6",
"type": "n8n-nodes-base.stickyNote",
"position": [
832,
2128
],
"parameters": {
"color": 4,
"width": 448,
"content": "## AI Content Strategy\n\nGoogle Gemini analyzes trending patterns from aggregated posts and generates original LinkedIn content following platform best practices. Outputs structured JSON with title, post text, and image prompt."
},
"typeVersion": 1
},
{
"id": "{{NODE_ID_24}}",
"name": "Sticky Note7",
"type": "n8n-nodes-base.stickyNote",
"position": [
1376,
1568
],
"parameters": {
"color": 7,
"width": 288,
"content": "## Visual Generation\n\nGenerates professional LinkedIn-optimized images using Google Imagen based on AI-created prompts."
},
"typeVersion": 1
},
{
"id": "{{NODE_ID_25}}",
"name": "Sticky Note8",
"type": "n8n-nodes-base.stickyNote",
"position": [
1840,
1936
],
"parameters": {
"color": 4,
"width": 288,
"content": "## Status Tracking\n\nExtracts processed post URLs and marks them as analyzed in Google Sheets to prevent duplicate processing."
},
"typeVersion": 1
}
],
"connections": {
"Generate an image": {
"main": [
[
{
"node": "Publish to LinkedIn",
"type": "main",
"index": 0
}
]
]
},
"JSON Output Parser": {
"ai_outputParser": [
[
{
"node": "LinkedIn Content Strategy AI",
"type": "ai_outputParser",
"index": 0
}
]
]
},
"Publish to LinkedIn": {
"main": [
[
{
"node": "Extract Analyzed Post URLs",
"type": "main",
"index": 0
}
]
]
},
"Rate Limiting Delay": {
"main": [
[
{
"node": "Filter High-Engagement Posts",
"type": "main",
"index": 0
}
]
]
},
"New Post Data Trigger": {
"main": [
[
{
"node": "Filter Recent Posts (3 Days)",
"type": "main",
"index": 0
}
]
]
},
"Google Gemini Chat Model": {
"ai_languageModel": [
[
{
"node": "LinkedIn Content Strategy AI",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Scrape LinkedIn Posts API": {
"main": [
[
{
"node": "Rate Limiting Delay",
"type": "main",
"index": 0
}
]
]
},
"Aggregate Trending Content": {
"main": [
[
{
"node": "LinkedIn Content Strategy AI",
"type": "main",
"index": 0
}
]
]
},
"Extract Analyzed Post URLs": {
"main": [
[
{
"node": "Mark Posts as Analyzed",
"type": "main",
"index": 0
}
]
]
},
"Save Viral Posts to Sheets": {
"main": [
[
{
"node": "Process Profiles in Batches",
"type": "main",
"index": 0
}
]
]
},
"Fetch LinkedIn Profile URLs": {
"main": [
[
{
"node": "Process Profiles in Batches",
"type": "main",
"index": 0
}
]
]
},
"Process Profiles in Batches": {
"main": [
[],
[
{
"node": "Scrape LinkedIn Posts API",
"type": "main",
"index": 0
}
]
]
},
"Filter High-Engagement Posts": {
"main": [
[
{
"node": "Save Viral Posts to Sheets",
"type": "main",
"index": 0
}
]
]
},
"Filter Recent Posts (3 Days)": {
"main": [
[
{
"node": "Aggregate Trending Content",
"type": "main",
"index": 0
}
]
]
},
"LinkedIn Content Strategy AI": {
"main": [
[
{
"node": "Generate an image",
"type": "main",
"index": 0
}
]
]
},
"LinkedIn Content Automation Scheduler": {
"main": [
[
{
"node": "Fetch LinkedIn Profile URLs",
"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.
googlePalmApigoogleSheetsTriggerOAuth2Api
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
This workflow is ideal for: Content creators who want to replicate successful LinkedIn strategies Social media managers monitoring competitor content performance Marketing teams analyzing trending topics in their industry Personal brands looking to create data-driven content…
Source: https://n8n.io/workflows/12865/ — 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 automatically creates short-form AI videos using Sora 2 Cameos, powered by n8n and AI agents.
Automatically generate viral short-form health videos using AI and publish them to social platforms with n8n and Veo 3. This workflow collects viral ideas, analyzes engagement patterns, generates AI v
Overview
Automatically generate AI avatar short videos and publish them to social platforms using n8n and HeyGen. This workflow turns viral ideas or prepared scripts into fully rendered AI avatar videos and ha
Content creators, social media managers, marketing agencies, and LinkedIn growth hackers who want to automate their content strategy by analyzing viral posts and generating original, high-engagement c