{
  "name": "10 — Tygodniowy raport KPI: CRM + Ads + faktury → Slack (klinweb.pl)",
  "nodes": [
    {
      "parameters": {
        "content": "## Tygodniowy raport KPI — poniedziałek 8:00\nSzablon KlinWeb. Zbiera dane z 3 źródeł równolegle (CRM, Google Ads, arkusz faktur), scala je i wysyła podsumowanie na Slack. Podłącz własne API/arkusz. Węzeł „Merge\" czeka na wszystkie 3 gałęzie zanim zbuduje raport.",
        "height": 160,
        "width": 820,
        "color": 4
      },
      "id": "note-a3",
      "name": "Sticky Note a3",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        0,
        -200
      ]
    },
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "weeks",
              "triggerAtDay": [
                1
              ],
              "triggerAtHour": 8
            }
          ]
        }
      },
      "id": "n3-cron",
      "name": "Poniedziałek 8:00",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [
        0,
        0
      ]
    },
    {
      "parameters": {
        "url": "https://api.twoj-crm.pl/v1/reports/leads?range=7d",
        "options": {}
      },
      "id": "n3-crm",
      "name": "CRM: nowe leady (7 dni)",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        240,
        -160
      ]
    },
    {
      "parameters": {
        "url": "https://googleads.googleapis.com/v17/customers/CID/googleAds:searchStream",
        "options": {}
      },
      "id": "n3-ads",
      "name": "Google Ads: koszt/konwersje",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        240,
        0
      ]
    },
    {
      "parameters": {
        "operation": "read",
        "documentId": {
          "mode": "list",
          "value": ""
        },
        "sheetName": {
          "mode": "list",
          "value": "Faktury"
        },
        "options": {}
      },
      "id": "n3-sheet",
      "name": "Arkusz faktur (przychód)",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.5,
      "position": [
        240,
        160
      ]
    },
    {
      "parameters": {
        "numberInputs": 3
      },
      "id": "n3-merge",
      "name": "Scal źródła",
      "type": "n8n-nodes-base.merge",
      "typeVersion": 3,
      "position": [
        480,
        0
      ]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "r1",
              "name": "tekst",
              "type": "string",
              "value": "=📊 *Raport tygodniowy*\\n• Nowe leady: {{ $(\"CRM: nowe leady (7 dni)\").all().length }}\\n• Koszt Ads: {{ $(\"Google Ads: koszt/konwersje\").first().json.cost || \"—\" }} zł\\n• Przychód (faktury): {{ $(\"Arkusz faktur (przychód)\").all().reduce((s,r)=>s+(r.json.kwota||0),0) }} zł"
            }
          ]
        },
        "options": {}
      },
      "id": "n3-agg",
      "name": "Zbuduj raport",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        700,
        0
      ]
    },
    {
      "parameters": {
        "select": "channel",
        "channelId": {
          "mode": "name",
          "value": "zarzad"
        },
        "text": "={{ $json.tekst }}",
        "otherOptions": {}
      },
      "id": "n3-slack",
      "name": "Wyślij na Slack",
      "type": "n8n-nodes-base.slack",
      "typeVersion": 2.3,
      "position": [
        920,
        0
      ]
    }
  ],
  "connections": {
    "Poniedziałek 8:00": {
      "main": [
        [
          {
            "node": "CRM: nowe leady (7 dni)",
            "type": "main",
            "index": 0
          },
          {
            "node": "Google Ads: koszt/konwersje",
            "type": "main",
            "index": 0
          },
          {
            "node": "Arkusz faktur (przychód)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "CRM: nowe leady (7 dni)": {
      "main": [
        [
          {
            "node": "Scal źródła",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Ads: koszt/konwersje": {
      "main": [
        [
          {
            "node": "Scal źródła",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Arkusz faktur (przychód)": {
      "main": [
        [
          {
            "node": "Scal źródła",
            "type": "main",
            "index": 2
          }
        ]
      ]
    },
    "Scal źródła": {
      "main": [
        [
          {
            "node": "Zbuduj raport",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Zbuduj raport": {
      "main": [
        [
          {
            "node": "Wyślij na Slack",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "meta": {
    "templateCredsSetupCompleted": false,
    "instanceId": "klinweb-n8n-templates-pl"
  },
  "tags": [
    {
      "name": "klinweb.pl"
    },
    {
      "name": "szablon-PL"
    }
  ],
  "pinData": {}
}