{
  "name": "Generate and track invoices with HubSpot, Gmail, Slack, Sheets, and Notion",
  "nodes": [
    {
      "id": "17153603-4a79-431e-b288-fc6a6bcd0292",
      "name": "🎯 HubSpot - Deal Trigger",
      "type": "n8n-nodes-base.hubspotTrigger",
      "position": [
        3232,
        3104
      ]
    },
    {
      "id": "02d82b96-2db2-4350-95bd-7bc93adf6e30",
      "name": "🔀 IF - Is Deal Closed Won?",
      "type": "n8n-nodes-base.if",
      "position": [
        3456,
        3104
      ]
    },
    {
      "id": "4f351028-09b3-4464-a2db-82e34de58b07",
      "name": "🏷️ HTTP - Get Deal Details",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        3680,
        3104
      ]
    },
    {
      "id": "ab9333b3-fafa-4321-ab6c-7882a225fbca",
      "name": "🔗 HTTP - Get Deal Associations",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        3904,
        3104
      ]
    },
    {
      "id": "6501585d-bc0f-4558-9ada-03c805e939a6",
      "name": "⚙️ Code - Extract Contact ID",
      "type": "n8n-nodes-base.code",
      "position": [
        4112,
        3104
      ]
    },
    {
      "id": "bd29bc05-f2a9-4a2d-a253-c4a392cbc172",
      "name": "👤 HTTP - Get Contact Details",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        4336,
        3104
      ]
    },
    {
      "id": "ade25776-aa2f-4e09-8978-b030fd07f4cb",
      "name": "📄 Code - Build Invoice + HTML",
      "type": "n8n-nodes-base.code",
      "position": [
        4560,
        3104
      ]
    },
    {
      "id": "dc9aab04-faab-41e8-8162-30b298b289e8",
      "name": "🖨️ HTTP - Generate PDF",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        4784,
        3104
      ]
    },
    {
      "id": "05553481-1cae-48ca-b871-9c66839a79f9",
      "name": "📊 Google Sheets - Log Invoice",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        4992,
        3104
      ]
    },
    {
      "id": "4614313b-2803-49e0-8781-d9d0fcf8e8c8",
      "name": "📓 Notion - Create Invoice Record",
      "type": "n8n-nodes-base.notion",
      "position": [
        5216,
        3104
      ]
    },
    {
      "id": "076e9e1e-3b62-4528-9317-f955c7ef385d",
      "name": "📧 Gmail - Send Invoice Email",
      "type": "n8n-nodes-base.gmail",
      "position": [
        5440,
        3104
      ]
    },
    {
      "id": "03e00a09-730a-4d3a-b658-7454f48710cb",
      "name": "💬 Slack - Invoice Sent Alert",
      "type": "n8n-nodes-base.slack",
      "position": [
        5648,
        3104
      ]
    },
    {
      "id": "2ebdc39f-f729-4968-ac6c-80a63011c70c",
      "name": "⏳ Wait - 7 Day Payment Window",
      "type": "n8n-nodes-base.wait",
      "position": [
        5888,
        3104
      ]
    },
    {
      "id": "5167b736-46a7-467b-b2d2-e0913bec9828",
      "name": "🔍 HTTP - Recheck Deal Stage",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        6096,
        3104
      ]
    },
    {
      "id": "a21a6f44-0c56-4c72-bc2d-ceef3cd443c1",
      "name": "🔀 IF - Payment Received?",
      "type": "n8n-nodes-base.if",
      "position": [
        6304,
        3104
      ]
    },
    {
      "id": "ac494063-dcd8-47d8-b263-771f5e940490",
      "name": "✅ Slack - Payment Confirmed",
      "type": "n8n-nodes-base.slack",
      "position": [
        6560,
        2912
      ]
    },
    {
      "id": "d6cea393-d97f-4170-a769-a2f47ee15e21",
      "name": "📧 Gmail - Follow-up Email #1",
      "type": "n8n-nodes-base.gmail",
      "position": [
        6560,
        3328
      ]
    },
    {
      "id": "52083ac6-85bc-45c6-bc10-04beb18a5d4b",
      "name": "⏳ Wait - 5 More Days",
      "type": "n8n-nodes-base.wait",
      "position": [
        6784,
        3328
      ]
    },
    {
      "id": "41086544-3a90-4d57-b4c9-f4819ca3ac5a",
      "name": "🔍 HTTP - Final Payment Check",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        7008,
        3328
      ]
    },
    {
      "id": "fd161811-2aa6-4293-9c74-9bbd6e707f3e",
      "name": "🔀 IF - Still Unpaid? (Escalate)",
      "type": "n8n-nodes-base.if",
      "position": [
        7216,
        3328
      ]
    },
    {
      "id": "951d1ce9-ccc5-4280-9ccf-00cd2776b379",
      "name": "🚨 Slack - Escalation Alert",
      "type": "n8n-nodes-base.slack",
      "position": [
        7552,
        2976
      ]
    },
    {
      "id": "7ac58dd0-1e09-433b-b9c4-6ac905e249ac",
      "name": "📓 Notion - Flag as Overdue",
      "type": "n8n-nodes-base.notion",
      "position": [
        7552,
        3184
      ]
    },
    {
      "id": "d69aceed-3c66-4fac-b89b-79d731a2271f",
      "name": "✅ Slack - Late Payment Confirmed",
      "type": "n8n-nodes-base.slack",
      "position": [
        7552,
        3376
      ]
    },
    {
      "id": "40077fa5-b256-4c47-a23b-c13140546038",
      "name": "⚡ Error Trigger",
      "type": "n8n-nodes-base.errorTrigger",
      "position": [
        3216,
        3728
      ]
    },
    {
      "id": "15a3db2e-f1b1-4fe2-a004-e18a86f686d4",
      "name": "🚨 Slack - Workflow Error Alert",
      "type": "n8n-nodes-base.slack",
      "position": [
        3440,
        3728
      ]
    },
    {
      "id": "0a8a475c-9852-40bb-bbd8-e226f2383575",
      "name": "📋 SETUP INSTRUCTIONS",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2224,
        2880
      ],
      "parameters": {
        "width": 780,
        "height": 1020,
        "content": "# Automated Invoice & Follow-Up System\n\n### How it works\nThis workflow triggers when a HubSpot deal is marked as Closed Won. It fetches deal and contact data, generates a styled invoice, converts it i"
      }
    },
    {
      "id": "fdd9db77-bc88-48f7-bfcf-d8095afab68b",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3088,
        2864
      ],
      "parameters": {
        "width": 1376,
        "height": 704,
        "content": "##  Trigger & Data Collection\nTriggers on deal stage change.\nFetches deal + contact details from HubSpot."
      }
    },
    {
      "id": "0e8949e7-6db2-42da-b5ba-cacf017f80d6",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        4480,
        2864
      ],
      "parameters": {
        "width": null,
        "height": 704,
        "content": "## Invoice Generation\nBuilds invoice data and creates styled HTML."
      }
    },
    {
      "id": "c132b042-4213-4098-9eb8-e2a08d775afc",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        4736,
        2864
      ],
      "parameters": {
        "width": 1072,
        "height": 704,
        "content": "## Send & Store Invoice\nConverts to PDF, logs in systems,\nemails client, and alerts team."
      }
    },
    {
      "id": "6bb8af1d-e99b-4faa-a3b5-0d23b838b958",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        5824,
        2864
      ],
      "parameters": {
        "width": 1328,
        "height": 688,
        "content": "## Send & Store Invoice\nConverts to PDF, logs in systems,\nemails client, and alerts team."
      }
    },
    {
      "id": "a6b6d2c9-4409-478b-9320-729f4dc12f23",
      "name": "Sticky Note11",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        7168,
        2864
      ],
      "parameters": {
        "width": 720,
        "height": 688,
        "content": "##  Escalation & Errors\nHandles overdue invoices and workflow failures.\nAlerts team and updates records."
      }
    },
    {
      "id": "73f010c3-1287-44f8-a0b7-8afbef49ff89",
      "name": "Sticky Note12",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3088,
        3600
      ],
      "parameters": {
        "width": 576,
        "height": 304,
        "content": "## Error Handling\nCaptures any workflow failure\nand sends alert to Slack for quick action."
      }
    }
  ],
  "connections": {
    "⚡ Error Trigger": {
      "main": [
        [
          {
            "node": "🚨 Slack - Workflow Error Alert",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "⏳ Wait - 5 More Days": {
      "main": [
        [
          {
            "node": "🔍 HTTP - Final Payment Check",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "🎯 HubSpot - Deal Trigger": {
      "main": [
        [
          {
            "node": "🔀 IF - Is Deal Closed Won?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "🔀 IF - Payment Received?": {
      "main": [
        [
          {
            "node": "✅ Slack - Payment Confirmed",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "📧 Gmail - Follow-up Email #1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "🖨️ HTTP - Generate PDF": {
      "main": [
        [
          {
            "node": "📊 Google Sheets - Log Invoice",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "🔀 IF - Is Deal Closed Won?": {
      "main": [
        [
          {
            "node": "🏷️ HTTP - Get Deal Details",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "🔍 HTTP - Recheck Deal Stage": {
      "main": [
        [
          {
            "node": "🔀 IF - Payment Received?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "⏳ Wait - 7 Day Payment Window": {
      "main": [
        [
          {
            "node": "🔍 HTTP - Recheck Deal Stage",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "🏷️ HTTP - Get Deal Details": {
      "main": [
        [
          {
            "node": "🔗 HTTP - Get Deal Associations",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "👤 HTTP - Get Contact Details": {
      "main": [
        [
          {
            "node": "📄 Code - Build Invoice + HTML",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "💬 Slack - Invoice Sent Alert": {
      "main": [
        [
          {
            "node": "⏳ Wait - 7 Day Payment Window",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "📧 Gmail - Follow-up Email #1": {
      "main": [
        [
          {
            "node": "⏳ Wait - 5 More Days",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "📧 Gmail - Send Invoice Email": {
      "main": [
        [
          {
            "node": "💬 Slack - Invoice Sent Alert",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "🔍 HTTP - Final Payment Check": {
      "main": [
        [
          {
            "node": "🔀 IF - Still Unpaid? (Escalate)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "⚙️ Code - Extract Contact ID": {
      "main": [
        [
          {
            "node": "👤 HTTP - Get Contact Details",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "📄 Code - Build Invoice + HTML": {
      "main": [
        [
          {
            "node": "🖨️ HTTP - Generate PDF",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "📊 Google Sheets - Log Invoice": {
      "main": [
        [
          {
            "node": "📓 Notion - Create Invoice Record",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "🔗 HTTP - Get Deal Associations": {
      "main": [
        [
          {
            "node": "⚙️ Code - Extract Contact ID",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "🔀 IF - Still Unpaid? (Escalate)": {
      "main": [
        [
          {
            "node": "🚨 Slack - Escalation Alert",
            "type": "main",
            "index": 0
          },
          {
            "node": "📓 Notion - Flag as Overdue",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "✅ Slack - Late Payment Confirmed",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "📓 Notion - Create Invoice Record": {
      "main": [
        [
          {
            "node": "📧 Gmail - Send Invoice Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}