{
  "name": "Nodbot - Dropbox file upload with path normalization",
  "nodes": [
    {
      "parameters": {
        "path": "integration-dropbox-n8n-file-upload-sync",
        "httpMethod": "POST",
        "responseMode": "responseNode"
      },
      "id": "39d848e2-3cc7-4924-ad87-961bbeff2781",
      "name": "Webhook file input",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        0,
        260
      ]
    },
    {
      "parameters": {
        "jsCode": "const src = $json.body ?? $json;\nconst original = String(src.filename ?? 'file.bin').trim();\nconst ext = (original.match(/\\.[a-z0-9]{1,12}$/i)?.[0] ?? '').toLowerCase();\nconst base = original.replace(/\\.[a-z0-9]{1,12}$/i, '')\n  .normalize('NFKD')\n  .replace(/[^\\w\\-а-яА-Я]+/g, '-')\n  .replace(/-+/g, '-')\n  .replace(/^-|-$/g, '')\n  .slice(0, 80) || 'file';\nconst folder = String(src.folder ?? 'uploads')\n  .replace(/\\/g, '/')\n  .replace(/\\.\\./g, '')\n  .replace(/\\/+/g, '/')\n  .replace(/^\\/+|\\/+$/g, '');\nconst size = Number(src.size_bytes ?? 0);\nif (size <= 0) throw new Error('Empty file payload');\nif (size > 50 * 1024 * 1024) throw new Error('File is too large for this workflow');\nconst safeName = `${base}${ext}`;\nconst sourceId = String(src.source_id ?? '').trim();\nconst checksum = String(src.checksum ?? '').trim();\nreturn [{ json: {\n  dropbox_path: `/${folder}/${safeName}`,\n  dedupe_key: `dropbox:${sourceId || checksum || safeName}`.toLowerCase(),\n  filename: safeName,\n  mime_type: src.mime_type ?? 'application/octet-stream',\n  source: src.source ?? 'unknown',\n  deal_id: src.deal_id ?? '',\n  uploaded_at: new Date().toISOString()\n}}];"
      },
      "id": "990cb05f-a42b-4898-930c-5ffaf6b8fc04",
      "name": "Validate and normalize path",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        280,
        260
      ]
    },
    {
      "parameters": {},
      "id": "80f949f9-89b3-419f-9879-7704a35462b3",
      "name": "Check file dedupe",
      "type": "n8n-nodes-base.postgres",
      "typeVersion": 2,
      "position": [
        560,
        260
      ]
    },
    {
      "parameters": {},
      "id": "639ef364-6481-4147-ae9e-475430ff6e5b",
      "name": "Upload to Dropbox",
      "type": "n8n-nodes-base.dropbox",
      "typeVersion": 2,
      "position": [
        840,
        260
      ]
    },
    {
      "parameters": {},
      "id": "6584c045-c6b8-43ac-81dd-af2db89dcf69",
      "name": "Save Dropbox link",
      "type": "n8n-nodes-base.dropbox",
      "typeVersion": 2,
      "position": [
        1120,
        260
      ]
    },
    {
      "parameters": {},
      "id": "2ed99c53-4b58-478c-a8a7-1d67e7250a50",
      "name": "Respond to source",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 2,
      "position": [
        1400,
        260
      ]
    }
  ],
  "connections": {
    "Webhook file input": {
      "main": [
        [
          {
            "node": "Validate and normalize path",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Validate and normalize path": {
      "main": [
        [
          {
            "node": "Check file dedupe",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check file dedupe": {
      "main": [
        [
          {
            "node": "Upload to Dropbox",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload to Dropbox": {
      "main": [
        [
          {
            "node": "Save Dropbox link",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Save Dropbox link": {
      "main": [
        [
          {
            "node": "Respond to source",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "staticData": null,
  "tags": [
    "nodbot",
    "integration",
    "production"
  ],
  "triggerCount": 1,
  "updatedAt": "2026-05-30T00:00:00.000Z",
  "versionId": "1a6d0ef0-451e-4b3f-a258-86771b82c22f",
  "meta": {
    "templateCredsSetupCompleted": false
  }
}