{
  "name": "Scrape LinkedIn comments and score lead intent using ConnectSafely, Azure OpenAI, and Google Sheets",
  "nodes": [
    {
      "id": "9b77dd56-68b5-418c-a142-a3537374c6c7",
      "name": "When clicking ‘Execute workflow’",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -528,
        1040
      ]
    },
    {
      "id": "4ad7e46d-e4fd-4646-be54-70a2038a0c1a",
      "name": "Main Overview",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1104,
        768
      ],
      "parameters": {
        "width": 480,
        "height": 824,
        "content": "### How it works\n\nThis workflow scrapes LinkedIn posts that signal lead-generation pain points, extracts every comment on those posts, scores each commenter for buying intent using AI, and saves the r"
      }
    },
    {
      "id": "26b9f48a-b5fc-417a-ba77-58d3a685be55",
      "name": "Section: Search & Scrape",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -560,
        880
      ],
      "parameters": {
        "width": 700,
        "height": 116,
        "content": "## Search & Scrape\n\nTriggers a Google search for pain-point posts on LinkedIn, parses the results, and fetches comments from each matched post via ConnectSafely."
      }
    },
    {
      "id": "f014517f-3998-4c2b-baa0-496b1be32683",
      "name": "Section: Comment Processing",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        192,
        816
      ],
      "parameters": {
        "width": 260,
        "height": 196,
        "content": "## Comment Processing\n\nReceives raw comment arrays from each post and flattens them into individual rows, one per commenter, ready for AI scoring."
      }
    },
    {
      "id": "64cea62a-6624-49b0-a2f1-41329dd61953",
      "name": "Section: AI Intent Scoring",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        496,
        864
      ],
      "parameters": {
        "width": 600,
        "height": 100,
        "content": "## AI Intent Scoring\n\nEach comment is analysed by an AI agent that returns a 0–100 intent score and a label (no-intent → high-intent). Output is parsed into clean rows."
      }
    },
    {
      "id": "d3084ff1-14ff-4ad9-b601-bc923b41a772",
      "name": "Warning: SerpAPI",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -336,
        1248
      ],
      "parameters": {
        "width": 268,
        "height": 136,
        "content": "⚠️ **SerpAPI Key Required**\n\nThis node calls the Google Search API. A valid SerpAPI credential must be configured, or every execution will fail at this step."
      }
    },
    {
      "id": "1a50334f-cfcb-41fe-8652-967df975a40e",
      "name": "Warning: ConnectSafely",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        80,
        1216
      ],
      "parameters": {
        "width": 252,
        "height": 152,
        "content": "⚠️ **ConnectSafely Credential Required**\n\nFetching post comments depends on an active ConnectSafely account. An invalid or expired API key will block the entire scrape."
      }
    },
    {
      "id": "5be1f1fb-c185-4d54-a2aa-6fe5674bae5d",
      "name": "Warning: Azure OpenAI",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        576,
        1232
      ],
      "parameters": {
        "width": 268,
        "height": 152,
        "content": "⚠️ **Azure OpenAI Credential Required**\n\nThe AI intent agent uses gpt-4o-mini. Ensure the Azure deployment name matches and the credential is active; otherwise scoring will fail."
      }
    },
    {
      "id": "1b825249-cc0d-46d5-9399-4b0a54e11f64",
      "name": "Search LinkedIn Posts via SerpAPI",
      "type": "n8n-nodes-serpapi.serpApi",
      "position": [
        -288,
        1040
      ]
    },
    {
      "id": "8b562ae9-e9e4-4c5f-808f-6c627d9ac2b9",
      "name": "Fetch Post Comments via ConnectSafely",
      "type": "n8n-nodes-connectsafely-ai.connectSafelyLinkedIn",
      "position": [
        144,
        1040
      ]
    },
    {
      "id": "1d901be4-4abd-44ce-9c9d-7597381d84a8",
      "name": "Parse & Filter Search Results",
      "type": "n8n-nodes-base.code",
      "position": [
        -96,
        1040
      ]
    },
    {
      "id": "a77130f6-5705-4267-9ca7-5a80e17b68da",
      "name": "AI Intent Detection Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        560,
        1040
      ]
    },
    {
      "id": "9ccedfae-79a5-402a-85d3-554cee94fae4",
      "name": "Azure OpenAI GPT-4o-mini",
      "type": "@n8n/n8n-nodes-langchain.lmChatAzureOpenAi",
      "position": [
        432,
        1248
      ]
    },
    {
      "id": "64643688-528f-456d-aaec-e19baff2137f",
      "name": "Flatten Comments into Rows",
      "type": "n8n-nodes-base.code",
      "position": [
        352,
        1040
      ]
    },
    {
      "id": "27741bee-6896-460a-8bb2-333065225462",
      "name": "Parse AI Intent Output",
      "type": "n8n-nodes-base.code",
      "position": [
        912,
        1040
      ]
    },
    {
      "id": "1d190ab7-11b2-40db-bc24-a7a2f16df196",
      "name": "Save Leads to Google Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1136,
        1040
      ]
    }
  ],
  "connections": {
    "Parse AI Intent Output": {
      "main": [
        [
          {
            "node": "Save Leads to Google Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Azure OpenAI GPT-4o-mini": {
      "ai_languageModel": [
        [
          {
            "node": "AI Intent Detection Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "AI Intent Detection Agent": {
      "main": [
        [
          {
            "node": "Parse AI Intent Output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Flatten Comments into Rows": {
      "main": [
        [
          {
            "node": "AI Intent Detection Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse & Filter Search Results": {
      "main": [
        [
          {
            "node": "Fetch Post Comments via ConnectSafely",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Search LinkedIn Posts via SerpAPI": {
      "main": [
        [
          {
            "node": "Parse & Filter Search Results",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Execute workflow’": {
      "main": [
        [
          {
            "node": "Search LinkedIn Posts via SerpAPI",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Post Comments via ConnectSafely": {
      "main": [
        [
          {
            "node": "Flatten Comments into Rows",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}