{
  "name": "Route Tally affiliate leads to Google Sheets and notify teams in Slack",
  "nodes": [
    {
      "id": "24150f37-a6ce-42b2-b134-b68387218a53",
      "name": "Send Lead Notification",
      "type": "n8n-nodes-base.slack",
      "position": [
        608,
        -48
      ]
    },
    {
      "id": "508dbddc-a251-4a1e-9048-7bc3ed5451c5",
      "name": "Submission Trigger",
      "type": "n8n-nodes-tallyforms.tallyTrigger",
      "position": [
        -832,
        -32
      ]
    },
    {
      "id": "a8222f5f-7529-42db-b053-b728e256a49b",
      "name": "Append Data (New Sheet)",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        176,
        208
      ]
    },
    {
      "id": "487993ac-9c89-4a71-bedb-c44b0665c516",
      "name": "Append Data (Existing Sheet)",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        96,
        -48
      ]
    },
    {
      "id": "ea09e9e1-9c11-4fbf-8e88-dc43cf90785d",
      "name": "Extract Form Fields",
      "type": "n8n-nodes-base.set",
      "position": [
        -608,
        -32
      ]
    },
    {
      "id": "6a75e48c-c5d0-43e0-b0db-69bac678adb0",
      "name": "Find Affiliate Sheet",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        -384,
        -32
      ]
    },
    {
      "id": "ec92c2ad-f863-41d4-a5e9-321c37a63679",
      "name": "Sheet Exists?",
      "type": "n8n-nodes-base.if",
      "position": [
        -192,
        -32
      ]
    },
    {
      "id": "88049984-cdfe-40e0-bda8-575405d275d6",
      "name": "Create Affiliate Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -384,
        208
      ]
    },
    {
      "id": "74bbe628-29f5-4758-a85b-49a5ae34bb80",
      "name": "Format Row Data",
      "type": "n8n-nodes-base.code",
      "position": [
        16,
        208
      ]
    },
    {
      "id": "b7da68d6-7f5c-429f-bb21-61e84b18dda1",
      "name": "Build Slack Message",
      "type": "n8n-nodes-base.code",
      "position": [
        368,
        -48
      ]
    },
    {
      "id": "b3f6b059-75a8-483d-abda-6f32b65ed6f8",
      "name": "Move to Target Folder",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        -192,
        208
      ]
    },
    {
      "id": "fb116606-8992-4e53-88b4-7dd37ea2391b",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1552,
        -144
      ],
      "parameters": {
        "width": 656,
        "height": 560,
        "content": "## How it works\n1. **Form Trigger**: Listens for new public submissions via a Tally.so webhook.\n2. **Data Routing**: Extracts the affiliation code and searches Google Drive for an existing matching sp"
      }
    },
    {
      "id": "92d0aad1-555e-42e6-9b30-b494c65a7466",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -880,
        -144
      ],
      "parameters": {
        "width": 416,
        "height": 272,
        "content": "## Capture Form Submissions\nTriggers the workflow instantly when a new lead submits the Tally form and extracts their data."
      }
    },
    {
      "id": "9bee6577-47e4-4a80-8e5c-a20d40e63fbd",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -448,
        -144
      ],
      "parameters": {
        "width": 416,
        "height": 528,
        "content": "## Affiliate Sheet Management\nSearches for an existing affiliate spreadsheet in Google Drive, branching to create and organize a new one if missing."
      }
    },
    {
      "id": "52184583-ccbc-404a-826b-224fb1582f95",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -16,
        -144
      ],
      "parameters": {
        "width": 320,
        "height": 528,
        "content": "## Record Lead Data\nAppends the captured lead information as a new row in the appropriate Google Sheet."
      }
    },
    {
      "id": "513b8123-92cb-4a92-be10-a900191a1296",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        320,
        -144
      ],
      "parameters": {
        "width": 464,
        "height": 368,
        "content": "## Team Notification\nConstructs a formatted message summarizing the lead and delivers it to a Slack channel."
      }
    },
    {
      "id": "e2f5f5b0-fd29-4889-9916-95174574a11d",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        560,
        -64
      ],
      "parameters": {
        "width": 192,
        "height": 272,
        "content": "\n\n\n\n\n\n\n\n\n\n\n\nThe Slack app must be added/invited to the target channel to successfully post messages."
      }
    }
  ],
  "connections": {
    "Sheet Exists?": {
      "main": [
        [
          {
            "node": "Append Data (Existing Sheet)",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Create Affiliate Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Row Data": {
      "main": [
        [
          {
            "node": "Append Data (New Sheet)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Submission Trigger": {
      "main": [
        [
          {
            "node": "Extract Form Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build Slack Message": {
      "main": [
        [
          {
            "node": "Send Lead Notification",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Form Fields": {
      "main": [
        [
          {
            "node": "Find Affiliate Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Find Affiliate Sheet": {
      "main": [
        [
          {
            "node": "Sheet Exists?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Move to Target Folder": {
      "main": [
        [
          {
            "node": "Format Row Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Affiliate Sheet": {
      "main": [
        [
          {
            "node": "Move to Target Folder",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Lead Notification": {
      "main": [
        []
      ]
    },
    "Append Data (New Sheet)": {
      "main": [
        [
          {
            "node": "Build Slack Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Append Data (Existing Sheet)": {
      "main": [
        [
          {
            "node": "Build Slack Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}