{
  "name": "meerkat-lead-capture",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "meerkat-lead",
        "responseMode": "responseNode",
        "options": {}
      },
      "id": "webhook-trigger",
      "name": "Webhook (POST /meerkat-lead)",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        240,
        300
      ]
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict"
          },
          "conditions": [
            {
              "id": "honeypot-check",
              "leftValue": "={{ $json.body.website }}",
              "rightValue": "",
              "operator": {
                "type": "string",
                "operation": "equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "honeypot-filter",
      "name": "Honeypot empty? (drop bots)",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [
        460,
        300
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.apollo.io/api/v1/people/match",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({ email: $('Webhook (POST /meerkat-lead)').item.json.body.email, reveal_personal_emails: false, reveal_phone_number: false }) }}",
        "options": {
          "response": {
            "response": {
              "neverError": true,
              "responseFormat": "json"
            }
          },
          "timeout": 8000
        }
      },
      "id": "apollo-enrich",
      "name": "Apollo: enrich by email",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        620,
        200
      ],
      "continueOnFail": true,
      "notes": "Header Auth credential: Name = X-Api-Key, Value = <Apollo Master API key from app.apollo.io/#/settings/integrations>. Free plan returns API_INACCESSIBLE; needs Basic plan or higher. continueOnFail keeps the lead flowing into Notion even if Apollo errors / rate-limits / no-match."
    },
    {
      "parameters": {
        "resource": "databasePage",
        "databaseId": "REPLACE-WITH-YOUR-ID",
        "title": "={{ $('Webhook (POST /meerkat-lead)').item.json.body.name || 'Unknown' }}",
        "propertiesUi": {
          "propertyValues": [
            {
              "key": "Email|email",
              "emailValue": "={{ $('Webhook (POST /meerkat-lead)').item.json.body.email }}"
            },
            {
              "key": "Phone|phone_number",
              "phoneValue": "={{ $('Webhook (POST /meerkat-lead)').item.json.body.phone }}"
            },
            {
              "key": "Business|rich_text",
              "textContent": "={{ $('Webhook (POST /meerkat-lead)').item.json.body.business }}"
            },
            {
              "key": "Message|rich_text",
              "textContent": "={{ $('Webhook (POST /meerkat-lead)').item.json.body.message }}"
            },
            {
              "key": "Page URL|url",
              "urlValue": "={{ $('Webhook (POST /meerkat-lead)').item.json.body.page_url }}"
            },
            {
              "key": "Submitted At|date",
              "date": "={{ $('Webhook (POST /meerkat-lead)').item.json.body.submitted_at }}",
              "includeTime": true
            },
            {
              "key": "Source|select",
              "selectValue": "meerkat-llc.com/contact-form"
            },
            {
              "key": "Status|status",
              "statusValue": "Not started"
            },
            {
              "key": "Next Action|select",
              "selectValue": "Send first reply"
            },
            {
              "key": "Next Action Date|date",
              "date": "={{ $now.toISO() }}",
              "includeTime": false
            },
            {
              "key": "Notes|rich_text",
              "textContent": "={{ ($('Apollo: enrich by email').item.json && $('Apollo: enrich by email').item.json.person) ? ('— Apollo enrichment —\\nName: ' + (($('Apollo: enrich by email').item.json.person.first_name || '') + ' ' + ($('Apollo: enrich by email').item.json.person.last_name || '')).trim() + '\\nTitle: ' + ($('Apollo: enrich by email').item.json.person.title || '(unknown)') + '\\nCompany: ' + (($('Apollo: enrich by email').item.json.person.organization && $('Apollo: enrich by email').item.json.person.organization.name) || '(unknown)') + '\\nIndustry: ' + (($('Apollo: enrich by email').item.json.person.organization && $('Apollo: enrich by email').item.json.person.organization.industry) || '(unknown)') + '\\nEmployees: ' + (($('Apollo: enrich by email').item.json.person.organization && $('Apollo: enrich by email').item.json.person.organization.estimated_num_employees) || '(unknown)') + '\\nLinkedIn: ' + ($('Apollo: enrich by email').item.json.person.linkedin_url || '(none)') + '\\nApollo person ID: ' + ($('Apollo: enrich by email').item.json.person.id || '')) : ('Apollo: no match for ' + $('Webhook (POST /meerkat-lead)').item.json.body.email + (($('Apollo: enrich by email').item.json && $('Apollo: enrich by email').item.json.error) ? ' — error: ' + $('Apollo: enrich by email').item.json.error : '')) }}"
            }
          ]
        },
        "options": {}
      },
      "id": "notion-create-lead",
      "name": "Notion: create lead row",
      "type": "n8n-nodes-base.notion",
      "typeVersion": 2.2,
      "position": [
        820,
        200
      ],
      "notes": "Database: Meerkat Leads (https://www.notion.so/857f7ba0be8a41118dd60f6ef367493b). Data source ID: d91a7dd0-8323-463d-b524-8b79fd871f34. Notes field receives the Apollo enrichment summary.",
      "credentials": {
        "notionApi": {
          "id": "REPLACE",
          "name": "Your notionApi credential"
        }
      }
    },
    {
      "parameters": {
        "sendTo": "you@example.com",
        "subject": "=New lead: {{ $('Webhook (POST /meerkat-lead)').item.json.body.name }} ({{ $('Webhook (POST /meerkat-lead)').item.json.body.business || ($('Apollo: enrich by email').item.json && $('Apollo: enrich by email').item.json.person && $('Apollo: enrich by email').item.json.person.organization && $('Apollo: enrich by email').item.json.person.organization.name) || 'no business' }})",
        "emailType": "text",
        "message": "=New lead just landed on meerkat-llc.com.\n\nName:     {{ $('Webhook (POST /meerkat-lead)').item.json.body.name }}\nEmail:    {{ $('Webhook (POST /meerkat-lead)').item.json.body.email }}\nPhone:    {{ $('Webhook (POST /meerkat-lead)').item.json.body.phone || '(none)' }}\nBusiness: {{ $('Webhook (POST /meerkat-lead)').item.json.body.business || '(none)' }}\n\nMessage:\n{{ $('Webhook (POST /meerkat-lead)').item.json.body.message }}\n\n--- Apollo enrichment ---\n{{ ($('Apollo: enrich by email').item.json && $('Apollo: enrich by email').item.json.person) ? ('Name:     ' + (($('Apollo: enrich by email').item.json.person.first_name || '') + ' ' + ($('Apollo: enrich by email').item.json.person.last_name || '')).trim() + '\\nTitle:    ' + ($('Apollo: enrich by email').item.json.person.title || '(unknown)') + '\\nCompany:  ' + (($('Apollo: enrich by email').item.json.person.organization && $('Apollo: enrich by email').item.json.person.organization.name) || '(unknown)') + '\\nIndustry: ' + (($('Apollo: enrich by email').item.json.person.organization && $('Apollo: enrich by email').item.json.person.organization.industry) || '(unknown)') + '\\nLinkedIn: ' + ($('Apollo: enrich by email').item.json.person.linkedin_url || '(none)')) : ('No Apollo match for ' + $('Webhook (POST /meerkat-lead)').item.json.body.email) }}\n\n---\nSubmitted: {{ $('Webhook (POST /meerkat-lead)').item.json.body.submitted_at }}\nFrom page: {{ $('Webhook (POST /meerkat-lead)').item.json.body.page_url }}\n\nReply within 2 hours. Notion row: https://www.notion.so/REPLACE-WITH-YOUR-ID\n",
        "options": {}
      },
      "id": "gmail-notify-greg",
      "name": "Gmail: notify Greg",
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.1,
      "position": [
        1020,
        200
      ],
      "credentials": {
        "gmailOAuth2": {
          "id": "REPLACE",
          "name": "Your gmailOAuth2 credential"
        }
      }
    },
    {
      "parameters": {
        "sendTo": "={{ $('Webhook (POST /meerkat-lead)').item.json.body.email }}",
        "subject": "Got your note — Meerkat LLC",
        "emailType": "text",
        "message": "=Hey {{ $('Webhook (POST /meerkat-lead)').item.json.body.name }},\n\nThis is the auto-confirm that your message landed. A real reply from Greg is coming — usually within a couple hours, always within 24.\n\nIf you'd rather just grab a 30-min slot now: https://calendly.com/ugwade8/30min\n\n— Greg\nMeerkat LLC • Anna, Texas\n",
        "options": {}
      },
      "id": "gmail-auto-reply",
      "name": "Gmail: auto-reply to lead",
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.1,
      "position": [
        1220,
        200
      ],
      "credentials": {
        "gmailOAuth2": {
          "id": "REPLACE",
          "name": "Your gmailOAuth2 credential"
        }
      }
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={ \"ok\": true, \"received\": true }",
        "options": {}
      },
      "id": "respond-success",
      "name": "Respond 200 OK",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.1,
      "position": [
        1420,
        200
      ]
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={ \"ok\": true, \"dropped\": \"honeypot\" }",
        "options": {}
      },
      "id": "respond-honeypot",
      "name": "Respond 200 (silent drop)",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.1,
      "position": [
        680,
        420
      ]
    },
    {
      "parameters": {
        "content": "## meerkat-lead-capture\n\nTriggered by an incoming webhook. Uses HTTP/API, Notion, Gmail, Webhook response.\n\n**Trigger:** Webhook\n**Integrations:** HTTP/API, Notion, Gmail, Webhook response\n**Status:** Inactive  •  8 nodes",
        "height": 280,
        "width": 440,
        "color": 4
      },
      "id": "583204e9-ad21-4b32-acac-505fcd88ffde",
      "name": "📝 Description",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        240,
        -160
      ]
    }
  ],
  "connections": {
    "Webhook (POST /meerkat-lead)": {
      "main": [
        [
          {
            "node": "Honeypot empty? (drop bots)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Honeypot empty? (drop bots)": {
      "main": [
        [
          {
            "node": "Apollo: enrich by email",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Respond 200 (silent drop)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Apollo: enrich by email": {
      "main": [
        [
          {
            "node": "Notion: create lead row",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Notion: create lead row": {
      "main": [
        [
          {
            "node": "Gmail: notify Greg",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gmail: notify Greg": {
      "main": [
        [
          {
            "node": "Gmail: auto-reply to lead",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gmail: auto-reply to lead": {
      "main": [
        [
          {
            "node": "Respond 200 OK",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "meta": {
    "templateCredsSetupCompleted": false
  }
}