{
  "name": "Send daily CRM summary reports to Mattermost from HubSpot",
  "nodes": [
    {
      "id": "0962a345-2873-414a-8c21-2c8ca0b39f98",
      "name": "📝 Workflow Overview",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1024,
        -48
      ],
      "parameters": {
        "width": 550,
        "height": 738,
        "content": "# Daily Report Generator\n\n## How it works\nThis workflow is triggered via an authenticated webhook and automatically downloads the latest sales and support statistics from two external REST APIs. Both "
      }
    },
    {
      "id": "ef1364ab-8239-4ee7-af9b-aeb85a1432e6",
      "name": "⚙️ Trigger & Config",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -144,
        -96
      ],
      "parameters": {
        "width": 450,
        "height": 798,
        "content": "## Trigger & Configuration\nThis group contains the Webhook Trigger that starts the workflow and the configuration Set node. The trigger accepts a simple POST request—no payload required unless you wan"
      }
    },
    {
      "id": "59b24194-f5f7-46da-af54-81229e628380",
      "name": "📡 Data Collection",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        304,
        -96
      ],
      "parameters": {
        "width": 450,
        "height": 798,
        "content": "## Data Collection\nThe two HTTP Request nodes run in parallel and retrieve daily statistics from your external systems. One call fetches yesterday’s closed-won revenue while the second pulls fresh sup"
      }
    },
    {
      "id": "889fc62a-78d1-46aa-825f-ba5641ed7a8c",
      "name": "🛠️ Data Processing",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        752,
        -96
      ],
      "parameters": {
        "width": 594,
        "height": 622,
        "content": "## Processing & PDF Generation\nAfter both datasets have been merged, the “Aggregate Metrics” Code node calculates the key performance indicators required by leadership—total revenue, open ticket count"
      }
    },
    {
      "id": "86fa47c6-6980-4d83-a386-c985a4d7956b",
      "name": "💾 Storage & Notification",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1344,
        -96
      ],
      "parameters": {
        "width": 978,
        "height": 622,
        "content": "## Storage & Notifications\nWith the PDF generated, the workflow uploads the file to HubSpot using the built-in File endpoint. Storing reports inside the CRM keeps historical documentation next to the "
      }
    },
    {
      "id": "47baaa6a-d357-480c-b546-7de38e915223",
      "name": "🚨 Error Handling",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1024,
        544
      ],
      "parameters": {
        "width": 626,
        "height": 446,
        "content": "## Error Handling\nAll failure paths converge in this section. Whenever an upstream IF node flags a problem—whether an HTTP request returns a non-200 status or HubSpot rejects the file—the item is rout"
      }
    },
    {
      "id": "20f01a9a-728a-4625-a405-a593fa98d95a",
      "name": "Webhook Trigger",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -48,
        352
      ]
    },
    {
      "id": "854477ac-e453-4e51-8bed-734df7b89f90",
      "name": "Prepare Config",
      "type": "n8n-nodes-base.set",
      "position": [
        160,
        352
      ]
    },
    {
      "id": "01483636-39ce-43f9-9a0d-cb2c960c1eae",
      "name": "Fetch Sales Data",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        368,
        240
      ]
    },
    {
      "id": "c3eb0baf-478d-4a68-a7ec-84fca55bc363",
      "name": "Sales Data OK?",
      "type": "n8n-nodes-base.if",
      "position": [
        560,
        240
      ]
    },
    {
      "id": "3353804f-1448-45bf-91b2-8a81e348bd40",
      "name": "Fetch Support Data",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        368,
        480
      ]
    },
    {
      "id": "1443f01f-0f66-400b-a73a-5cf8985a8465",
      "name": "Support Data OK?",
      "type": "n8n-nodes-base.if",
      "position": [
        560,
        480
      ]
    },
    {
      "id": "2e31d96a-f805-49cd-8913-087c5bf4fefd",
      "name": "Combine Results",
      "type": "n8n-nodes-base.merge",
      "position": [
        768,
        352
      ]
    },
    {
      "id": "2aa7ee13-6e8e-495e-b5b0-c91705f4124a",
      "name": "Aggregate Metrics",
      "type": "n8n-nodes-base.code",
      "position": [
        960,
        352
      ]
    },
    {
      "id": "8efba282-6729-45cc-8b37-fd64f98f065b",
      "name": "Generate PDF",
      "type": "n8n-nodes-base.code",
      "position": [
        1168,
        352
      ]
    },
    {
      "id": "131ad3ae-3852-4ea6-8c3e-448f1b453b78",
      "name": "Upload Report to HubSpot",
      "type": "n8n-nodes-base.hubspot",
      "position": [
        1392,
        272
      ]
    },
    {
      "id": "ec51f979-224f-4a1c-9366-ccaa108bbaf2",
      "name": "HubSpot Upload OK?",
      "type": "n8n-nodes-base.if",
      "position": [
        1568,
        272
      ]
    },
    {
      "id": "7253bd87-42f9-428f-86b5-570ff0151d47",
      "name": "Craft Mattermost Message",
      "type": "n8n-nodes-base.code",
      "position": [
        1760,
        256
      ]
    },
    {
      "id": "47d5b37e-9ded-4c14-b3c0-fe4b1b5e0a1f",
      "name": "Send Mattermost Notification",
      "type": "n8n-nodes-base.mattermost",
      "position": [
        1968,
        256
      ]
    },
    {
      "id": "ac1fb919-4804-4a14-a45f-46f2d9755968",
      "name": "Compose Error Message",
      "type": "n8n-nodes-base.code",
      "position": [
        1104,
        816
      ]
    },
    {
      "id": "417ce5b0-f0b1-43a0-9424-a67a2c714282",
      "name": "Send Mattermost Error",
      "type": "n8n-nodes-base.mattermost",
      "position": [
        1408,
        816
      ]
    },
    {
      "id": "46b38355-a115-4de5-b88b-f40d547d07e8",
      "name": "Respond to Caller",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        2160,
        352
      ]
    }
  ],
  "connections": {
    "Generate PDF": {
      "main": [
        [
          {
            "node": "Upload Report to HubSpot",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Config": {
      "main": [
        [
          {
            "node": "Fetch Sales Data",
            "type": "main",
            "index": 0
          },
          {
            "node": "Fetch Support Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Sales Data OK?": {
      "main": [
        [
          {
            "node": "Combine Results",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Compose Error Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Combine Results": {
      "main": [
        [
          {
            "node": "Aggregate Metrics",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook Trigger": {
      "main": [
        [
          {
            "node": "Prepare Config",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Sales Data": {
      "main": [
        [
          {
            "node": "Sales Data OK?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Support Data OK?": {
      "main": [
        [
          {
            "node": "Combine Results",
            "type": "main",
            "index": 1
          }
        ],
        [
          {
            "node": "Compose Error Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Aggregate Metrics": {
      "main": [
        [
          {
            "node": "Generate PDF",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Support Data": {
      "main": [
        [
          {
            "node": "Support Data OK?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HubSpot Upload OK?": {
      "main": [
        [
          {
            "node": "Craft Mattermost Message",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Compose Error Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Compose Error Message": {
      "main": [
        [
          {
            "node": "Send Mattermost Error",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Mattermost Error": {
      "main": [
        [
          {
            "node": "Respond to Caller",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Craft Mattermost Message": {
      "main": [
        [
          {
            "node": "Send Mattermost Notification",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload Report to HubSpot": {
      "main": [
        [
          {
            "node": "HubSpot Upload OK?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Mattermost Notification": {
      "main": [
        [
          {
            "node": "Respond to Caller",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}