{
  "name": "Code-Cap: Shopware Low Stock → NocoDB",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "shopware-low-stock",
        "responseMode": "responseNode",
        "options": {}
      },
      "id": "a1b2c3d4-0001-4001-8001-a1b2c3d40001",
      "name": "Shopware Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [250, 300],
      "webhookId": "shopware-low-stock"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose"
          },
          "conditions": [
            {
              "id": "a1b2c3d4-0001-4001-8001-a1b2c3d40010",
              "leftValue": "={{ $json.headers['x-webhook-secret'] ?? '' }}",
              "rightValue": "YOUR_WEBHOOK_SECRET",
              "operator": {
                "type": "string",
                "operation": "equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "a1b2c3d4-0001-4001-8001-a1b2c3d40002",
      "name": "Secret Valid?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [500, 300]
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={\"status\": \"ok\"}",
        "options": {
          "responseCode": 200
        }
      },
      "id": "a1b2c3d4-0001-4001-8001-a1b2c3d40004",
      "name": "Respond 200",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1,
      "position": [760, 180]
    },
    {
      "parameters": {
        "mode": "manual",
        "duplicateItem": false,
        "assignments": {
          "assignments": [
            {
              "id": "a1b2c3d4-0001-4001-8001-a1b2c3d40021",
              "name": "Sales Channel",
              "value": "={{ $('Shopware Webhook').item.json.body.salesChannelName }}",
              "type": "string"
            },
            {
              "id": "a1b2c3d4-0001-4001-8001-a1b2c3d40022",
              "name": "Timestamp",
              "value": "={{ $('Shopware Webhook').item.json.body.timestamp }}",
              "type": "string"
            },
            {
              "id": "a1b2c3d4-0001-4001-8001-a1b2c3d40023",
              "name": "Product ID",
              "value": "={{ $('Shopware Webhook').item.json.body.product.id }}",
              "type": "string"
            },
            {
              "id": "a1b2c3d4-0001-4001-8001-a1b2c3d40024",
              "name": "Product Name",
              "value": "={{ $('Shopware Webhook').item.json.body.product.name }}",
              "type": "string"
            },
            {
              "id": "a1b2c3d4-0001-4001-8001-a1b2c3d40025",
              "name": "Product Number",
              "value": "={{ $('Shopware Webhook').item.json.body.product.productNumber }}",
              "type": "string"
            },
            {
              "id": "a1b2c3d4-0001-4001-8001-a1b2c3d40026",
              "name": "Stock",
              "value": "={{ $('Shopware Webhook').item.json.body.product.stock }}",
              "type": "number"
            }
          ]
        },
        "options": {}
      },
      "id": "a1b2c3d4-0001-4001-8001-a1b2c3d40006",
      "name": "Prepare Fields",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [1000, 180],
      "notes": "Flattens the nested Shopware webhook payload into flat fields whose names match the NocoDB column names exactly. The NocoDB node then uses Auto-Map to insert them without any manual field configuration."
    },
    {
      "parameters": {
        "resource": "row",
        "operation": "create",
        "workspaceId": "",
        "projectId": "YOUR_BASE_NAME_OR_ID",
        "table": "YOUR_TABLE_NAME_OR_ID",
        "dataToSend": "autoMapInputData",
        "inputsToIgnore": ""
      },
      "id": "a1b2c3d4-0001-4001-8001-a1b2c3d40003",
      "name": "Add Row to NocoDB",
      "type": "n8n-nodes-base.nocoDb",
      "typeVersion": 3,
      "position": [1240, 180],
      "credentials": {
        "noCoDB": {
          "id": "REPLACE_AFTER_IMPORT",
          "name": "NocoDB account"
        }
      }
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={\"status\": \"unauthorized\"}",
        "options": {
          "responseCode": 401
        }
      },
      "id": "a1b2c3d4-0001-4001-8001-a1b2c3d40005",
      "name": "Respond 401",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1,
      "position": [760, 420]
    }
  ],
  "connections": {
    "Shopware Webhook": {
      "main": [
        [
          {
            "node": "Secret Valid?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Secret Valid?": {
      "main": [
        [
          {
            "node": "Respond 200",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Respond 401",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Respond 200": {
      "main": [
        [
          {
            "node": "Prepare Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Fields": {
      "main": [
        [
          {
            "node": "Add Row to NocoDB",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "id": "shopware-low-stock-nocodb-v1"
}
