{
  "name": "Automated sales leaderboard with HighLevel CRM, GPT-4o, Notion & Slack",
  "nodes": [
    {
      "id": "e4b514d1-ceed-4308-bf24-a94abc9a01fc",
      "name": "When clicking ‘Execute workflow’",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -736,
        -128
      ]
    },
    {
      "id": "78510025-3729-4ff7-8349-a26ef82e1db1",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -544,
        -688
      ],
      "parameters": {
        "width": null,
        "height": 528,
        "content": "## 📦 Fetch All Deals from HighLevel CRM\n**Action:**  \n- Retrieves all opportunities (deals) from the connected HighLevel CRM.  \n\n**Description:**  \n- Uses `getAll` operation to pull unlimited deal rec"
      }
    },
    {
      "id": "b92239c9-9f54-4efc-9e9c-874bf8f66759",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -256,
        32
      ],
      "parameters": {
        "width": null,
        "height": 384,
        "content": "## 🔍 Validate Deal Fetch Success (IF Node)\n**Action:**  \nChecks if the fetched deal records contain valid IDs.  \n\n**Description:**  \nActs as a validation gate to ensure data integrity.  \nIf `deal_id` "
      }
    },
    {
      "id": "5e0496ef-bb97-44fa-8df4-ed773f3e7eb9",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        64,
        496
      ],
      "parameters": {
        "width": null,
        "height": 448,
        "content": "## 🚨 Log Fetch or Validation Errors (Error Handling Node)\n**Action:**  \nAppends failed records or errors into a Google Sheets error log.  \n\n**Description:**  \nLogs all failed deal records for manual r"
      }
    },
    {
      "id": "8f2b9f85-8750-4d8b-bba2-cb240a4954fe",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1056,
        400
      ],
      "parameters": {
        "width": null,
        "height": 432,
        "content": "## 🧠 GPT-4o Model Configuration\n**Action:**  \n- Configures GPT-4o (Azure OpenAI) model for language generation.  \n\n**Description:**  \n- Defines system role for generating short, friendly, motivational"
      }
    },
    {
      "id": "db313017-c7f5-4671-b994-c56e75d006ae",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        672,
        -912
      ],
      "parameters": {
        "width": null,
        "height": 544,
        "content": "## 🧾 Generate Notion Performance Dashboard\n**Action:**  \n- Creates a personalized performance page for each rep in Notion.  \n\n**Description:**  \n- Generates a Notion page titled “{rep_id} - Sales Rep "
      }
    },
    {
      "id": "08277d6f-c97f-46dd-ace1-8dc01a2ef297",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        624,
        176
      ],
      "parameters": {
        "width": null,
        "height": 416,
        "content": "## ⚙️ Transform Data for AI Input\n**Action:**  \n- Prepares formatted JSON data for AI-based Slack message generation.  \n\n**Description:**  \n- Collects summarized data per rep and flattens it for GPT i"
      }
    },
    {
      "id": "9518f7ae-ea95-44e1-af79-291151d1124a",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1168,
        -624
      ],
      "parameters": {
        "width": null,
        "height": 544,
        "content": "## 🤖 AI-Generated Motivational Slack Messages\n**Action:**  \n- Uses GPT-4o via LangChain to create custom Slack messages per rep.  \n\n**Description:**  \n- Takes summarized performance data and crafts 2–"
      }
    },
    {
      "id": "e052b33a-3d29-4eb1-aa8a-f497c121d9d1",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1472,
        192
      ],
      "parameters": {
        "width": null,
        "height": 464,
        "content": "## 💬 Notify Sales Team in Slack\n**Action:**  \n- Sends AI-generated motivational summaries to the Slack channel or user.  \n\n**Description:**  \n- Posts formatted messages directly in Slack via Slack API"
      }
    },
    {
      "id": "6956ad52-fc95-43b7-8194-fd952b56aea9",
      "name": "Fetch All Deals from HighLevel CRM",
      "type": "n8n-nodes-base.highLevel",
      "position": [
        -464,
        -128
      ]
    },
    {
      "id": "bad87d8a-9bf2-4194-995f-2619a222975f",
      "name": " Validate Deal Fetch Success",
      "type": "n8n-nodes-base.if",
      "position": [
        -192,
        -128
      ]
    },
    {
      "id": "8c390668-b627-4943-8d4a-adc0c6f84cd9",
      "name": " Log Fetch or Validation Errors ",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        128,
        320
      ]
    },
    {
      "id": "616feb11-a8c0-4955-9202-ed1a12e34208",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        32,
        -704
      ],
      "parameters": {
        "width": null,
        "height": 544,
        "content": "## 🧹 Clean & Structure Deal Data\n**Action:**  \n- Transforms raw CRM data into clean, structured records.  \n\n**Description:**  \n- Extracts and normalizes key fields into a consistent schema:  \n  - Deal"
      }
    },
    {
      "id": "c205c167-2333-43a9-a80b-43ebd068559d",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        304,
        -672
      ],
      "parameters": {
        "width": null,
        "height": 512,
        "content": "## 📊 Summarize Sales by Representative\n**Action:**  \n- Aggregates deal-level data into performance summaries per sales rep.  \n\n**Description:**  \n- Groups deals by `rep_id` and computes:  \n  - Total d"
      }
    },
    {
      "id": "eda6d196-9842-46f0-b077-31ab9ccd40fd",
      "name": "Clean & Structure Deal Data",
      "type": "n8n-nodes-base.code",
      "position": [
        128,
        -128
      ]
    },
    {
      "id": "de0e86ce-8d99-40bb-8e9a-a25773785f72",
      "name": " Summarize Sales by Representative",
      "type": "n8n-nodes-base.code",
      "position": [
        368,
        -128
      ]
    },
    {
      "id": "4014211b-b50d-46d2-a0dc-dba3e3bb7766",
      "name": "Generate Notion Performance Dashboard",
      "type": "n8n-nodes-base.notion",
      "position": [
        752,
        -336
      ]
    },
    {
      "id": "4c6b43f1-6397-46df-b4e2-880fb400dcb9",
      "name": " Transform Data for AI Input",
      "type": "n8n-nodes-base.code",
      "position": [
        704,
        0
      ]
    },
    {
      "id": "891ba41f-f222-4a41-b557-14808b3fabc4",
      "name": "GPT-4o Model Configuration",
      "type": "@n8n/n8n-nodes-langchain.lmChatAzureOpenAi",
      "position": [
        1072,
        224
      ]
    },
    {
      "id": "e676ef5c-e9f9-4b2b-b6b7-8a52b8b91179",
      "name": " AI-Generated Motivational Slack Messages",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1088,
        0
      ]
    },
    {
      "id": "45ff779d-dc4e-4a83-bcfc-5197aecdc91f",
      "name": "Notify Sales Team in Slack",
      "type": "n8n-nodes-base.slack",
      "position": [
        1520,
        0
      ]
    }
  ],
  "connections": {
    "GPT-4o Model Configuration": {
      "ai_languageModel": [
        [
          {
            "node": " AI-Generated Motivational Slack Messages",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Clean & Structure Deal Data": {
      "main": [
        [
          {
            "node": " Summarize Sales by Representative",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    " Transform Data for AI Input": {
      "main": [
        [
          {
            "node": " AI-Generated Motivational Slack Messages",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    " Validate Deal Fetch Success": {
      "main": [
        [
          {
            "node": "Clean & Structure Deal Data",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": " Log Fetch or Validation Errors ",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    " Summarize Sales by Representative": {
      "main": [
        [
          {
            "node": "Generate Notion Performance Dashboard",
            "type": "main",
            "index": 0
          },
          {
            "node": " Transform Data for AI Input",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch All Deals from HighLevel CRM": {
      "main": [
        [
          {
            "node": " Validate Deal Fetch Success",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Execute workflow’": {
      "main": [
        [
          {
            "node": "Fetch All Deals from HighLevel CRM",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    " AI-Generated Motivational Slack Messages": {
      "main": [
        [
          {
            "node": "Notify Sales Team in Slack",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}