{
  "id": 7973,
  "name": "Automate LinkedIn content using viral post analysis with Gemini AI & Flux image generation",
  "description": "# LinkedIn Viral Post Scraper + AI Content Generator with Auto Publishing\n\n## Who's it for\n\nContent 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 content at scale.\n\n## What it does\n\nThis comprehensive automation pipeline combines LinkedIn data intelligence with AI-powered content creation to build a complete content marketing system:\n\n**Data Collection Phase:**\n- Automatically scrapes high-engagement posts from target LinkedIn profiles\n- Filters content based on viral metrics (20+ likes, comments, or reposts)\n- Stores trending content data in Google Sheets for analysis\n- Runs on a 12-hour schedule with built-in rate limiting\n\n**Content Generation Phase:**\n- AI analyzes trending patterns and engagement triggers from collected data\n- Generates original LinkedIn posts using Google Gemini's advanced language model\n- Creates custom visuals using AI image generation (HuggingFace Flux model)\n- Automatically publishes complete posts with images to your LinkedIn company page\n- Tracks processed content to prevent duplicate analysis\n\n## How it works\n\nThe workflow operates in two connected phases. The scraping phase monitors specified LinkedIn profiles, collecting high-performing posts into a centralized database. When new viral content is detected, the AI analysis phase triggers automatically, identifying trending topics and creating original content that leverages proven engagement patterns while maintaining authenticity.\n\n## Requirements\n\n**APIs and Credentials:**\n- Google Sheets API (for data storage and profile management)\n- Apify API key (for LinkedIn post scraping)\n- Google Gemini API access (for content generation)\n- HuggingFace API token (for image generation)\n- LinkedIn API access (for publishing)\n\n**Setup Prerequisites:**\n- Google Sheets document with LinkedIn profile URLs\n- LinkedIn company page for publishing\n- Self-hosted n8n instance (uses community nodes)\n\n## How to set up\n\n1. **Configure Data Sources:** Create a Google Sheet with two tabs - one for target LinkedIn profile URLs and another for storing scraped data\n2. **API Integration:** Add all required API credentials to n8n credential manager\n3. **Customize Filters:** Adjust engagement thresholds (currently 20+ for each metric) based on your niche\n4. **AI Prompt Tuning:** Modify the content generation prompt to match your brand voice and industry focus\n5. **Publishing Settings:** Configure your LinkedIn organization ID and posting preferences\n6. **Schedule Optimization:** Set scraping frequency based on your content needs and API limits\n\n## How to customize the workflow\n\n**Content Targeting:** Modify the profile list in Google Sheets to focus on specific industries, thought leaders, or competitors in your niche.\n\n**Engagement Thresholds:** Adjust the filter conditions to be more or less selective about which posts qualify as \"viral\" content.\n\n**AI Voice Customization:** Edit the comprehensive system prompt in the LinkedIn Content Strategy AI node to match your brand personality, industry terminology, and content style preferences.\n\n**Visual Branding:** Customize image generation prompts to include your brand colors, logo elements, or specific visual styles.\n\n**Publishing Schedule:** Modify the trigger frequency and add conditional logic to publish at optimal times for your audience.\n\n**Data Retention:** Add cleanup nodes to manage historical data and prevent Google Sheets from becoming unwieldy over time.",
  "categories": [
    {
      "id": 31,
      "name": "Content Creation"
    },
    {
      "id": 51,
      "name": "Multimodal AI"
    }
  ],
  "totalViews": 141,
  "createdAt": "2025-08-28T06:47:01.985Z",
  "workflow": {
    "meta": {
      "instanceId": "YOUR_N8N_INSTANCE_ID",
      "templateCredsSetupCompleted": true
    },
    "nodes": [
      {
        "id": "2421d1cb-fd45-4d09-af46-fe7eddb014bc",
        "name": "Google Gemini Chat Model",
        "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
        "position": [
          -800,
          1648
        ],
        "parameters": {},
        "typeVersion": 1
      },
      {
        "id": "843e69c0-6734-463d-ba79-81eed6350568",
        "name": "LinkedIn Content Automation Scheduler",
        "type": "n8n-nodes-base.scheduleTrigger",
        "position": [
          -1520,
          144
        ],
        "parameters": {},
        "typeVersion": 1.2
      },
      {
        "id": "ee8cbee4-5929-409e-9f42-daa15971347d",
        "name": "Fetch LinkedIn Profile URLs",
        "type": "n8n-nodes-base.googleSheets",
        "position": [
          -1296,
          144
        ],
        "parameters": {},
        "typeVersion": 4.5
      },
      {
        "id": "a134c65a-51a8-4ad2-9361-56770428013b",
        "name": "Process Profiles in Batches",
        "type": "n8n-nodes-base.splitInBatches",
        "position": [
          -1072,
          144
        ],
        "parameters": {},
        "typeVersion": 3
      },
      {
        "id": "baa9d8d0-dbc3-405c-827c-44201e9e1864",
        "name": "Scrape LinkedIn Posts API",
        "type": "n8n-nodes-base.httpRequest",
        "position": [
          -848,
          80
        ],
        "parameters": {},
        "typeVersion": 4.2
      },
      {
        "id": "200bf2c7-c5b1-499d-bdce-0c13c0f1018c",
        "name": "Rate Limiting Delay",
        "type": "n8n-nodes-base.wait",
        "position": [
          -624,
          80
        ],
        "webhookId": "YOUR_WEBHOOK_ID",
        "parameters": {},
        "typeVersion": 1.1
      },
      {
        "id": "beec62a4-f99e-489e-ab2f-3102999e5853",
        "name": "Filter High-Engagement Posts",
        "type": "n8n-nodes-base.filter",
        "position": [
          -400,
          80
        ],
        "parameters": {},
        "typeVersion": 2.2
      },
      {
        "id": "eaa2f9f9-462f-4838-a5ca-69fa6be91614",
        "name": "Save Viral Posts to Sheets",
        "type": "n8n-nodes-base.googleSheets",
        "position": [
          -176,
          144
        ],
        "parameters": {},
        "typeVersion": 4.5
      },
      {
        "id": "5a5a5e59-e3ad-4c78-9296-495c90a00ad7",
        "name": "New Post Data Trigger",
        "type": "n8n-nodes-base.googleSheetsTrigger",
        "position": [
          -1456,
          1456
        ],
        "parameters": {},
        "typeVersion": 1
      },
      {
        "id": "de36c1f0-e0d9-4613-8853-f7778ec3125d",
        "name": "Filter Recent Posts (3 Days)",
        "type": "n8n-nodes-base.filter",
        "position": [
          -1232,
          1456
        ],
        "parameters": {},
        "typeVersion": 2.2
      },
      {
        "id": "d29253cd-e744-4f41-90c4-07d4c7b101da",
        "name": "Aggregate Trending Content",
        "type": "n8n-nodes-base.aggregate",
        "position": [
          -1008,
          1456
        ],
        "parameters": {},
        "typeVersion": 1
      },
      {
        "id": "5b66d4ed-93c5-487f-b421-4988efb6f765",
        "name": "LinkedIn Content Strategy AI",
        "type": "@n8n/n8n-nodes-langchain.agent",
        "position": [
          -784,
          1456
        ],
        "parameters": {},
        "typeVersion": 2.2
      },
      {
        "id": "5a5bec30-5bf1-4f0b-b925-7b5d482dd455",
        "name": "JSON Output Parser",
        "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
        "position": [
          -640,
          1680
        ],
        "parameters": {},
        "typeVersion": 1.3
      },
      {
        "id": "72e67a9d-7f68-4f12-ae37-f568e9cc8a28",
        "name": "Generate Post Image",
        "type": "n8n-nodes-base.httpRequest",
        "position": [
          -432,
          1456
        ],
        "parameters": {},
        "typeVersion": 4.2
      },
      {
        "id": "ced01e5e-bb88-4eeb-86e0-df7d20725872",
        "name": "Download Generated Image",
        "type": "n8n-nodes-base.httpRequest",
        "position": [
          -208,
          1456
        ],
        "parameters": {},
        "typeVersion": 4.2
      },
      {
        "id": "7501ca46-93ac-4ce8-a5d3-8d0eb0e2dc4f",
        "name": "Publish to LinkedIn",
        "type": "n8n-nodes-base.linkedIn",
        "position": [
          16,
          1456
        ],
        "parameters": {},
        "typeVersion": 1
      },
      {
        "id": "3ec614e2-a0c0-4a3e-b189-29417ed8caf1",
        "name": "Extract Analyzed Post URLs",
        "type": "n8n-nodes-base.code",
        "position": [
          224,
          1456
        ],
        "parameters": {},
        "typeVersion": 2
      },
      {
        "id": "129d48d7-7c3b-4ef7-9296-d058d034832b",
        "name": "Mark Posts as Analyzed",
        "type": "n8n-nodes-base.googleSheets",
        "position": [
          448,
          1456
        ],
        "parameters": {},
        "typeVersion": 4.7
      },
      {
        "id": "009b2c84-7c90-4e76-8ffa-430e63d79853",
        "name": "Sticky Note",
        "type": "n8n-nodes-base.stickyNote",
        "position": [
          -2096,
          -320
        ],
        "parameters": {
          "content": ""
        },
        "typeVersion": 1
      },
      {
        "id": "2b60af78-4faa-407e-9ade-301328afed03",
        "name": "Sticky Note1",
        "type": "n8n-nodes-base.stickyNote",
        "position": [
          -2080,
          1040
        ],
        "parameters": {
          "content": ""
        },
        "typeVersion": 1
      }
    ],
    "pinData": {},
    "connections": {
      "JSON Output Parser": {
        "ai_outputParser": [
          [
            {
              "node": "LinkedIn Content Strategy AI",
              "type": "ai_outputParser",
              "index": 0
            }
          ]
        ]
      },
      "Generate Post Image": {
        "main": [
          [
            {
              "node": "Download Generated Image",
              "type": "main",
              "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
            }
          ]
        ]
      },
      "Download Generated Image": {
        "main": [
          [
            {
              "node": "Publish to LinkedIn",
              "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 Post Image",
              "type": "main",
              "index": 0
            }
          ]
        ]
      },
      "LinkedIn Content Automation Scheduler": {
        "main": [
          [
            {
              "node": "Fetch LinkedIn Profile URLs",
              "type": "main",
              "index": 0
            }
          ]
        ]
      }
    }
  },
  "workflowInfo": {
    "nodeCount": 20,
    "nodeTypes": {
      "n8n-nodes-base.code": {
        "count": 1
      },
      "n8n-nodes-base.wait": {
        "count": 1
      },
      "n8n-nodes-base.filter": {
        "count": 2
      },
      "n8n-nodes-base.linkedIn": {
        "count": 1
      },
      "n8n-nodes-base.aggregate": {
        "count": 1
      },
      "n8n-nodes-base.stickyNote": {
        "count": 2
      },
      "n8n-nodes-base.httpRequest": {
        "count": 3
      },
      "n8n-nodes-base.googleSheets": {
        "count": 3
      },
      "n8n-nodes-base.splitInBatches": {
        "count": 1
      },
      "@n8n/n8n-nodes-langchain.agent": {
        "count": 1
      },
      "n8n-nodes-base.scheduleTrigger": {
        "count": 1
      },
      "n8n-nodes-base.googleSheetsTrigger": {
        "count": 1
      },
      "@n8n/n8n-nodes-langchain.lmChatGoogleGemini": {
        "count": 1
      },
      "@n8n/n8n-nodes-langchain.outputParserStructured": {
        "count": 1
      }
    }
  },
  "nodes": [
    "Google Gemini Chat Model",
    "LinkedIn Content Automation Scheduler",
    "Fetch LinkedIn Profile URLs",
    "Process Profiles in Batches",
    "Scrape LinkedIn Posts API",
    "Rate Limiting Delay",
    "Filter High-Engagement Posts",
    "Save Viral Posts to Sheets",
    "New Post Data Trigger",
    "Filter Recent Posts (3 Days)",
    "Aggregate Trending Content",
    "LinkedIn Content Strategy AI",
    "JSON Output Parser",
    "Generate Post Image",
    "Download Generated Image",
    "Publish to LinkedIn",
    "Extract Analyzed Post URLs",
    "Mark Posts as Analyzed",
    "Sticky Note",
    "Sticky Note1"
  ],
  "nodeTypes": [
    "@n8n/n8n-nodes-langchain.agent",
    "n8n-nodes-base.httpRequest",
    "n8n-nodes-base.splitInBatches",
    "n8n-nodes-base.code",
    "n8n-nodes-base.linkedIn",
    "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
    "n8n-nodes-base.aggregate",
    "n8n-nodes-base.wait",
    "n8n-nodes-base.stickyNote",
    "n8n-nodes-base.scheduleTrigger",
    "n8n-nodes-base.googleSheets",
    "@n8n/n8n-nodes-langchain.outputParserStructured",
    "n8n-nodes-base.filter",
    "n8n-nodes-base.googleSheetsTrigger"
  ]
}