{
  "name": "Update Monday.com items with Local Falcon rankings",
  "nodes": [
    {
      "parameters": {
        "content": "## Update Monday.com Items with Local Falcon Rankings\n\n**Who is this for:** Agencies using Monday.com for client project management who want ranking data visible in their boards.\n\n**What this workflow does:**\n1. Fetches scan reports from Local Falcon\n2. Matches locations to Monday.com items via place_id column\n3. Updates item columns with latest ranking data\n4. Adds updates/comments for significant changes\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 Monday.com API credentials\n3. Create columns in your board: Place ID (text), Avg Rank (number), Last Scan (date), Platform (status)\n4. Update the Board ID and column IDs in the nodes\n5. Activate the workflow\n\n**Requirements:**\n- Local Falcon account with API access\n- Monday.com account with API access\n- Board with required columns configured\n\n**How to customize:**\n- Add automations in Monday.com for rank thresholds\n- Create dashboard widgets for ranking overview\n- Connect to status columns for visual indicators",
        "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 ranking 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 latest scan reports.",
        "height": 100,
        "width": 200
      },
      "id": "sticky-step2",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        300,
        660
      ]
    },
    {
      "parameters": {
        "content": "### Step 3: Get Board Items\nRetrieves Monday.com items.",
        "height": 100,
        "width": 200
      },
      "id": "sticky-step3",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        560,
        660
      ]
    },
    {
      "parameters": {
        "content": "### Step 4: Match & Update\nUpdates matching items.",
        "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": 7
            }
          ]
        }
      },
      "id": "schedule",
      "name": "Every Day 7am",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [
        140,
        440
      ]
    },
    {
      "parameters": {
        "resource": "scan",
        "operation": "listReports",
        "additionalFields": {
          "limit": 50
        }
      },
      "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": {
        "resource": "boardItem",
        "operation": "getAll",
        "boardId": "YOUR_BOARD_ID",
        "returnAll": true
      },
      "id": "get-items",
      "name": "Get Board Items",
      "type": "n8n-nodes-base.mondayCom",
      "typeVersion": 1,
      "position": [
        660,
        440
      ],
      "credentials": {
        "mondayComApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "jsCode": "const reports = $('Get Scan Reports').first().json.reports || [];\nconst items = $('Get Board Items').all();\n\nconst updates = [];\n\nfor (const item of items) {\n  const placeIdColumn = item.json.column_values?.find(c => c.id === 'place_id');\n  if (!placeIdColumn?.text) continue;\n  \n  const matchingReport = reports.find(r => r.place_id === placeIdColumn.text);\n  if (!matchingReport) continue;\n  \n  updates.push({\n    json: {\n      itemId: item.json.id,\n      avgRank: matchingReport.avg_rank,\n      scanDate: matchingReport.scan_date,\n      platform: matchingReport.platform,\n      keyword: matchingReport.keyword\n    }\n  });\n}\n\nreturn updates;"
      },
      "id": "match-update",
      "name": "Match and Prepare Updates",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        920,
        440
      ]
    }
  ],
  "connections": {
    "Every Day 7am": {
      "main": [
        [
          {
            "node": "Get Scan Reports",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Scan Reports": {
      "main": [
        [
          {
            "node": "Get Board Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Board Items": {
      "main": [
        [
          {
            "node": "Match and Prepare Updates",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "meta": {
    "templateCredsSetupCompleted": true
  }
}