{
  "name": "Automate Marketing Revenue Attribution & ROI Analytics with Airtable and Slack",
  "nodes": [
    {
      "id": "15341b2a-14b2-4341-8b18-8cd1fc5c79f1",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -400,
        144
      ]
    },
    {
      "id": "639b483f-1347-4361-990a-499d7a985398",
      "name": "Search Lead Source",
      "type": "n8n-nodes-base.airtable",
      "position": [
        176,
        144
      ]
    },
    {
      "id": "d2904611-761a-4c85-8445-b2f60caf5672",
      "name": "Code in JavaScript",
      "type": "n8n-nodes-base.code",
      "position": [
        400,
        144
      ]
    },
    {
      "id": "0542491a-d85d-4431-8ac0-fa8278a58088",
      "name": "Deals",
      "type": "n8n-nodes-base.airtable",
      "position": [
        -80,
        144
      ]
    },
    {
      "id": "e92d2b3c-16ac-4979-8368-4208b533bab0",
      "name": "Loop Over Items",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        624,
        144
      ]
    },
    {
      "id": "fbe7af8c-9d26-4f68-a78b-f35ece1c958e",
      "name": "Search records",
      "type": "n8n-nodes-base.airtable",
      "position": [
        832,
        160
      ]
    },
    {
      "id": "85233782-5af1-44e7-80e6-4385c5c0f279",
      "name": "Update record",
      "type": "n8n-nodes-base.airtable",
      "position": [
        1040,
        160
      ]
    },
    {
      "id": "3e7d6497-552d-4639-a911-23ce6412ee90",
      "name": "Send a message",
      "type": "n8n-nodes-base.slack",
      "position": [
        1264,
        160
      ]
    },
    {
      "id": "9eb3a37c-bb4b-4c82-967a-d0c365456eea",
      "name": "Send a message1",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1472,
        160
      ]
    },
    {
      "id": "b9f57a73-014e-4364-ac84-e51895d8f7d7",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1072,
        -784
      ],
      "parameters": {
        "width": 752,
        "height": 752,
        "content": "# 📊 REVENUE ATTRIBUTION & ROI CALCULATOR\n\nThis workflow calculates which lead sources generate actual revenue.\n\nRuns: Daily at midnight\nDuration: ~2-3 minutes\nPurpose: Update Lead Sources table with R"
      }
    },
    {
      "id": "68282373-6e14-4b27-8e7c-17caf82c1dc9",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -192,
        -352
      ],
      "parameters": {
        "width": 512,
        "height": 592,
        "content": "## 📥 STEP 1 & 2: COLLECT DATA FROM AIRTABLE\n\nNODE 1 - Fetch Closed Won Deals:\nGets deals from last 30 days where Stage = \"Closed Won\"\n\nRequired fields:\n- Stage (Single select)\n- Deal Value (Currency)\n"
      }
    },
    {
      "id": "91441ad1-38f5-4b5b-a103-66f5b769d3d4",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        352,
        -336
      ],
      "parameters": {
        "width": 432,
        "height": 560,
        "content": "## 🧮 STEP 3 & 4: CALCULATE ROI & PROCESS\n\nNODE 3 - Code: Calculate Metrics\nFor each source, calculates:\n- Total Revenue = Sum of Deal Values\n- Total Cost = Cost per Lead × Total Leads  \n- ROI = ((Reve"
      }
    },
    {
      "id": "f992e5a9-3a68-4b07-86a2-12b07ea3e417",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        816,
        -272
      ],
      "parameters": {
        "width": 800,
        "height": 464,
        "content": "## UPDATE DATA & SEND REPORT\n\nSearches to ensure the lead source exists, if it doesn't exist, it gets skipped to the next. \nUpdate record node updates the existing lead source record with the calculat"
      }
    },
    {
      "id": "77f9cd46-e398-4151-a549-4d929979a703",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1664,
        -496
      ],
      "parameters": {
        "width": 432,
        "height": 640,
        "content": "## ⚠️ TROUBLESHOOTING GUIDE\n\nISSUE: No deals returned from first node\nFIX: \n- Check date filter (last 30 days)\n- Verify \"Closed Won\" spelling in Stage\n- Ensure Actual Close Date is filled\n\nISSUE: Code"
      }
    },
    {
      "id": "3265038a-842d-47fc-bb2b-8c604709f009",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -496,
        80
      ],
      "parameters": {
        "width": 256,
        "height": 224,
        "content": "## Start Here"
      }
    }
  ],
  "connections": {
    "Deals": {
      "main": [
        [
          {
            "node": "Search Lead Source",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update record": {
      "main": [
        [
          {
            "node": "Send a message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Search records": {
      "main": [
        [
          {
            "node": "Update record",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send a message": {
      "main": [
        [
          {
            "node": "Send a message1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [
          {
            "node": "Search records",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Deals",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code in JavaScript": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Search Lead Source": {
      "main": [
        [
          {
            "node": "Code in JavaScript",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}