{
  "name": "Generate Google Maps lead lists with SerpApi, Google Gemini and Sheets",
  "nodes": [
    {
      "id": "1c57131a-7ff0-4851-ab6c-7b41eb4d3e17",
      "name": "Google Gemini Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        1136,
        1424
      ]
    },
    {
      "id": "3fce3e64-036d-4dd1-b72d-0a31eab9a703",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        432,
        544
      ],
      "parameters": {
        "width": 1792,
        "height": 416,
        "content": "# Market intelligence AI agent for lead discovery and sales strategy\nThis workflow automates the process of identifying local businesses with a weak digital presence to offer them specialized marketin"
      }
    },
    {
      "id": "c633b41a-b91d-4ef9-823b-72a056077b7e",
      "name": "Sticky Note12",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -128,
        560
      ],
      "parameters": {
        "width": 448,
        "height": 112,
        "content": "##  JESUS ANTONIO PACAHUALA ARROYO"
      }
    },
    {
      "id": "04df2820-f5fa-464d-b9d5-23e871299fca",
      "name": "Lead Search Trigger",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -496,
        1248
      ]
    },
    {
      "id": "1222c612-92c6-4360-b54f-e1b2c0e417f4",
      "name": "Fetch Google Maps Data (SerpApi)",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -272,
        1248
      ]
    },
    {
      "id": "0f4f8249-40a7-4154-abbc-b15f985a5813",
      "name": "Extract Business List",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        -48,
        1248
      ]
    },
    {
      "id": "a3fca73c-a7f1-4c72-80cf-9d8a453602bf",
      "name": "Filter by Region (Peru)",
      "type": "n8n-nodes-base.filter",
      "position": [
        256,
        1248
      ]
    },
    {
      "id": "a7458e69-ce03-4316-839e-e8981f5cf7f1",
      "name": "Prioritize Low-Rating Leads",
      "type": "n8n-nodes-base.sort",
      "position": [
        448,
        1248
      ]
    },
    {
      "id": "26ed24ca-add9-4f97-911d-3537dc78b10a",
      "name": "Select Top 5 Critical Cases",
      "type": "n8n-nodes-base.limit",
      "position": [
        640,
        1248
      ]
    },
    {
      "id": "5cf3e969-1c54-4f3e-8816-106e89344515",
      "name": "Batch Leads for AI Processing",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        896,
        1248
      ]
    },
    {
      "id": "86dd9b0c-6b23-4526-a090-83eec2ebdc48",
      "name": "Market Intelligence Strategy Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1136,
        1248
      ]
    },
    {
      "id": "a0784339-5746-4969-ac14-bea2ef9f7c35",
      "name": "Clean AI Raw Response",
      "type": "n8n-nodes-base.set",
      "position": [
        1440,
        1248
      ]
    },
    {
      "id": "8317f5fb-6797-449a-9538-6da467bc6c3c",
      "name": "Parse AI Output to JSON",
      "type": "n8n-nodes-base.code",
      "position": [
        1648,
        1248
      ]
    },
    {
      "id": "4949dd9e-3dd6-4cf1-86e9-8cbab0913a21",
      "name": "Final Data Formatting",
      "type": "n8n-nodes-base.set",
      "position": [
        1968,
        1248
      ]
    },
    {
      "id": "636e46af-3463-44a1-9cbb-e1f4203ae2c4",
      "name": "Save Strategies to Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2240,
        1248
      ]
    },
    {
      "id": "16771ec8-0785-4c85-af2f-28c0894fdb82",
      "name": "Sticky Note13",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -544,
        1056
      ],
      "parameters": {
        "width": 640,
        "height": 512,
        "content": "## Data Acquisition\n\nCaptures search keywords from a form and retrieves raw business data from Google Maps via SerpApi, converting the results into individual items for processing."
      }
    },
    {
      "id": "72a72350-cf14-4991-b847-296c3976228d",
      "name": "Sticky Note14",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        192,
        1056
      ],
      "parameters": {
        "width": 672,
        "height": 512,
        "content": "## Lead Filtering & Selection\n\nFilters leads to ensure geographic relevance and sorts them by rating to identify the businesses with the highest need for improvement."
      }
    },
    {
      "id": "801e2569-5250-4034-92ea-a5febb876b84",
      "name": "Sticky Note15",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1040,
        1056
      ],
      "parameters": {
        "width": 784,
        "height": 512,
        "content": "## AI Intelligence & Strategy\n\nUses Gemini AI to analyze business gaps and generate a custom sales strategy, including a priority score and personalized outreach copy."
      }
    },
    {
      "id": "77d0511d-b372-41b0-adff-6932bc24a8a9",
      "name": "Sticky Note16",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1904,
        1056
      ],
      "parameters": {
        "width": 784,
        "height": 512,
        "content": "## Output & Storage\n\nStandardizes the enriched lead data and records it into a Google Spreadsheet for the sales team to follow up."
      }
    }
  ],
  "connections": {
    "Lead Search Trigger": {
      "main": [
        [
          {
            "node": "Fetch Google Maps Data (SerpApi)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Clean AI Raw Response": {
      "main": [
        [
          {
            "node": "Parse AI Output to JSON",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Business List": {
      "main": [
        [
          {
            "node": "Filter by Region (Peru)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Final Data Formatting": {
      "main": [
        [
          {
            "node": "Save Strategies to Google Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter by Region (Peru)": {
      "main": [
        [
          {
            "node": "Prioritize Low-Rating Leads",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse AI Output to JSON": {
      "main": [
        [
          {
            "node": "Final Data Formatting",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Market Intelligence Strategy Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Prioritize Low-Rating Leads": {
      "main": [
        [
          {
            "node": "Select Top 5 Critical Cases",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Select Top 5 Critical Cases": {
      "main": [
        [
          {
            "node": "Batch Leads for AI Processing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Batch Leads for AI Processing": {
      "main": [
        [
          {
            "node": "Market Intelligence Strategy Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Google Maps Data (SerpApi)": {
      "main": [
        [
          {
            "node": "Extract Business List",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Market Intelligence Strategy Agent": {
      "main": [
        [
          {
            "node": "Clean AI Raw Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}