{
  "name": "Export Local Falcon rankings to Airtable",
  "nodes": [
    {
      "parameters": {
        "content": "## Export Local Falcon Rankings to Airtable\n\n**Who is this for:** Teams using Airtable for client management or reporting who want ranking data automatically synced for dashboards and tracking.\n\n**What this workflow does:**\n1. Fetches scan reports from Local Falcon on a schedule\n2. Transforms data into Airtable-friendly format\n3. Creates or updates records in your Airtable base\n4. Maintains historical ranking data for trend analysis\n\n**How to set up:**\n1. Add your Local Falcon API credentials (get your key at https://www.localfalcon.com/api/credentials)\n2. Add your Airtable API credentials\n3. Create an Airtable base with columns: location_name, keyword, avg_rank, platform, scan_date, place_id\n4. Update the Base ID and Table name in the Airtable node\n5. Activate the workflow\n\n**Requirements:**\n- Local Falcon account with API access\n- Airtable account with API access\n- Airtable base configured with proper columns\n\n**How to customize:**\n- Add calculated fields in Airtable for trends\n- Create Airtable automations for alerts\n- Build dashboards with Airtable interfaces",
        "height": 520,
        "width": 460,
        "color": 5
      },
      "id": "sticky-main",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        100,
        -180
      ]
    },
    {
      "parameters": {
        "content": "### Step 1: Schedule\nRuns daily to sync data.",
        "height": 100,
        "width": 200
      },
      "id": "sticky-step1",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        40,
        660
      ]
    },
    {
      "parameters": {
        "content": "### Step 2: Get Reports\nFetches scan data from API.",
        "height": 100,
        "width": 200
      },
      "id": "sticky-step2",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        300,
        660
      ]
    },
    {
      "parameters": {
        "content": "### Step 3: Transform\nFormats for Airtable schema.",
        "height": 100,
        "width": 200
      },
      "id": "sticky-step3",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        560,
        660
      ]
    },
    {
      "parameters": {
        "content": "### Step 4: Upsert\nCreates or updates records.",
        "height": 100,
        "width": 200
      },
      "id": "sticky-step4",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        820,
        660
      ]
    },
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "days",
              "triggerAtHour": 6
            }
          ]
        }
      },
      "id": "schedule",
      "name": "Every Day 6am",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [
        140,
        440
      ]
    },
    {
      "parameters": {
        "resource": "scan",
        "operation": "listReports",
        "additionalFields": {
          "limit": 100
        }
      },
      "id": "get-reports",
      "name": "Get Scan Reports",
      "type": "@local-falcon/n8n-nodes-localfalcon.localFalcon",
      "typeVersion": 1,
      "position": [
        400,
        440
      ],
      "credentials": {
        "localFalconApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "jsCode": "const reports = $input.first().json.reports || [];\n\nreturn reports.map(report => ({\n  json: {\n    fields: {\n      location_name: report.location_name || 'Unknown',\n      keyword: report.keyword || '',\n      avg_rank: parseFloat(report.avg_rank) || null,\n      platform: report.platform || 'google',\n      scan_date: report.scan_date || new Date().toISOString(),\n      place_id: report.place_id || '',\n      report_key: report.report_key || ''\n    }\n  }\n}));"
      },
      "id": "transform",
      "name": "Transform for Airtable",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        660,
        440
      ]
    },
    {
      "parameters": {
        "operation": "upsert",
        "base": {
          "__rl": true,
          "mode": "id",
          "value": "YOUR_AIRTABLE_BASE_ID"
        },
        "table": {
          "__rl": true,
          "mode": "name",
          "value": "Rankings"
        },
        "columns": {
          "mappingMode": "autoMapInputData",
          "value": {}
        },
        "options": {
          "bulkSize": 10
        }
      },
      "id": "upsert-airtable",
      "name": "Upsert to Airtable",
      "type": "n8n-nodes-base.airtable",
      "typeVersion": 2.1,
      "position": [
        920,
        440
      ],
      "credentials": {
        "airtableTokenApi": {
          "name": "<your credential>"
        }
      }
    }
  ],
  "connections": {
    "Every Day 6am": {
      "main": [
        [
          {
            "node": "Get Scan Reports",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Scan Reports": {
      "main": [
        [
          {
            "node": "Transform for Airtable",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Transform for Airtable": {
      "main": [
        [
          {
            "node": "Upsert to Airtable",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "meta": {
    "templateCredsSetupCompleted": true
  }
}