{
  "name": "Google Maps contact enrichment with Apify",
  "nodes": [
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "weeks",
              "triggerAtDay": [
                1
              ],
              "triggerAtHour": 8
            }
          ]
        }
      },
      "id": "leads-schedule",
      "name": "Weekly schedule",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [
        -880,
        0
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.apify.com/v2/actors/benthepythondev~google-maps-email-scraper/run-sync-get-dataset-items",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendBody": true,
        "contentType": "raw",
        "rawContentType": "application/json",
        "body": "{\"mode\":\"search\",\"query\":\"dentists\",\"location\":\"Berlin, Germany\",\"maxResults\":25,\"requireEmail\":false,\"enableSmtpVerification\":false}",
        "options": {
          "timeout": 300000
        }
      },
      "id": "leads-maps",
      "name": "Run Google Maps Email Actor",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        -620,
        0
      ]
    },
    {
      "parameters": {
        "jsCode": "const input = $input.all().map(item => item.json);\nconst rows = input.length === 1 && Array.isArray(input[0]) ? input[0] : input;\nconst leads = rows.filter(row => row && row.primary_email && Number(row.email_confidence || 0) >= 75);\nconst lines = leads.map((row, index) => {\n  return `${index + 1}. ${row.name || row.domain || 'Company'}\\n${row.primary_email} | ${row.phone || 'No phone'} | confidence ${row.email_confidence || 0}\\n${row.website || row.google_maps_url || ''}`;\n});\nreturn [{ json: { count: leads.length, subject: `Google Maps leads: ${leads.length} verified contacts`, digest: lines.join('\\n\\n') || 'No contacts met the configured email-confidence threshold.' } }];"
      },
      "id": "leads-digest",
      "name": "Filter and build lead digest",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        -340,
        0
      ]
    },
    {
      "parameters": {
        "fromEmail": "alerts@example.com",
        "toEmail": "you@example.com",
        "subject": "={{ $json.subject }}",
        "emailFormat": "text",
        "text": "={{ $json.digest }}",
        "options": {}
      },
      "id": "leads-email",
      "name": "Email enriched leads",
      "type": "n8n-nodes-base.emailSend",
      "typeVersion": 2.1,
      "position": [
        -60,
        0
      ]
    }
  ],
  "connections": {
    "Weekly schedule": {
      "main": [
        [
          {
            "node": "Run Google Maps Email Actor",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Run Google Maps Email Actor": {
      "main": [
        [
          {
            "node": "Filter and build lead digest",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter and build lead digest": {
      "main": [
        [
          {
            "node": "Email enriched leads",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "maps-contact-enrichment-v1",
  "meta": {
    "templateCredsSetupCompleted": false
  },
  "tags": []
}