{
  "name": "Upload files to Dropbox and generate direct download links",
  "nodes": [
    {
      "id": "50809acd-5528-44cf-b2d8-993cddae08a9",
      "name": "When Executed by Another Workflow",
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "position": [
        -1568,
        -16
      ]
    },
    {
      "id": "eacbf743-344e-4ec7-8711-bbf3cbd28b27",
      "name": "Normalize Path1",
      "type": "n8n-nodes-base.set",
      "position": [
        -1264,
        -16
      ]
    },
    {
      "id": "5b40d0d7-f20f-4510-9e1a-05d5db31f4aa",
      "name": "Upload & Path Processing1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1568,
        -192
      ],
      "parameters": {
        "width": 416,
        "height": null,
        "content": "## Upload & Path Processing\n\n1. **Read Binary File**: Reads file from local filesystem\n2. **Upload a file**: Uploads to Dropbox using OAuth2\n3. **Normalize Path**: Prepares path for sharing API calls"
      }
    },
    {
      "id": "72d5f167-520b-417b-b2c0-0cd00f34c296",
      "name": "Sharing Link Management1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1008,
        -256
      ],
      "parameters": {
        "width": 480,
        "height": 224,
        "content": "## Sharing Link Management\n\n1. **List Shared Links**: Check if link already exists\n2. **Get Existing linlk (if any)**\n3. **IF Node**: Branch based on link existence\n5. **Get Access Token** for shared "
      }
    },
    {
      "id": "98b3b6d6-9918-46bf-bb71-569088f54081",
      "name": "Direct Link Processing1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -448,
        -192
      ],
      "parameters": {
        "width": 496,
        "height": null,
        "content": "## Direct Link Processing\n\n1. **Rewrite Host**: Process existing links\n2. **Build Direct Link**: Convert Shared to direct download URL\n3. **Success Response**: Return final formatted direct download U"
      }
    },
    {
      "id": "9678708f-8a78-423b-8877-4cb98814fe37",
      "name": "Dropbox: Create Shared Link",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -432,
        144
      ]
    },
    {
      "id": "d873e83d-7d0e-4264-bf4e-93700ae3c88c",
      "name": "If: Link Exists?",
      "type": "n8n-nodes-base.if",
      "position": [
        -688,
        -16
      ]
    },
    {
      "id": "ab00f2f0-5e52-4213-9ab1-4e03eb6a42b2",
      "name": "Extract Existing Link",
      "type": "n8n-nodes-base.set",
      "position": [
        -832,
        -16
      ]
    },
    {
      "id": "cb96c7eb-763d-4cd6-9198-bc7b54bf1f00",
      "name": "Dropbox: List Shared Links",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -992,
        -16
      ]
    },
    {
      "id": "108812a1-f6e4-4fb6-838f-d6c43d2e7ec2",
      "name": "Rewrite Dropbox Host",
      "type": "n8n-nodes-base.set",
      "position": [
        -432,
        16
      ]
    },
    {
      "id": "574020e5-9928-41c0-be49-a58033dd8b3b",
      "name": "Build Direct Link",
      "type": "n8n-nodes-base.set",
      "position": [
        -272,
        16
      ]
    },
    {
      "id": "4f2228ce-d31e-4a1a-bd55-c18d90851dc5",
      "name": "Final Response",
      "type": "n8n-nodes-base.set",
      "position": [
        -112,
        16
      ]
    },
    {
      "id": "528ab43e-04f8-44e4-a4b4-64aba2d924c0",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1696,
        176
      ],
      "parameters": {
        "width": 608,
        "height": 576,
        "content": "## Sample code to upload and host on dropbox \n**This works on both remote and local installs of N8N**\n\nInput: the file we are hosting on DropBox.\nOutput: the direct shared link in Dropbox.\n\nTo Do For "
      }
    },
    {
      "id": "2002c9c4-e6a6-4cd2-af23-bcfc0828d695",
      "name": "Upload a file",
      "type": "n8n-nodes-base.dropbox",
      "position": [
        -1408,
        -16
      ]
    },
    {
      "id": "3da92dc4-669e-42eb-846c-d4e77462742e",
      "name": "Get DropBox access token",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        -576,
        96
      ]
    },
    {
      "id": "107a77a9-c3c7-4d5b-9e8c-5ce85fc62a6d",
      "name": "Upload File",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -848,
        576
      ]
    },
    {
      "id": "c85db16f-40dd-4a64-8bf4-84e4b7d449a7",
      "name": "Completed",
      "type": "n8n-nodes-base.noOp",
      "position": [
        -480,
        576
      ]
    },
    {
      "id": "7f00f7d0-bed1-4660-9e3d-5ed9284d7575",
      "name": "Call '[SUB] Dropbox upload links'",
      "type": "n8n-nodes-base.executeWorkflow",
      "position": [
        -656,
        576
      ]
    },
    {
      "id": "35566c40-1451-4953-9935-6598baab7f94",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -864,
        432
      ],
      "parameters": {
        "width": 496,
        "height": 128,
        "content": "## Test workflow \n**Copy this out to its own workflow** then run it to test this workflow, remember to link the subworkflows together. "
      }
    }
  ],
  "connections": {
    "Upload File": {
      "main": [
        [
          {
            "node": "Call '[SUB] Dropbox upload links'",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload a file": {
      "main": [
        [
          {
            "node": "Normalize Path1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Normalize Path1": {
      "main": [
        [
          {
            "node": "Dropbox: List Shared Links",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If: Link Exists?": {
      "main": [
        [
          {
            "node": "Get DropBox access token",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Rewrite Dropbox Host",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build Direct Link": {
      "main": [
        [
          {
            "node": "Final Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Rewrite Dropbox Host": {
      "main": [
        [
          {
            "node": "Build Direct Link",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Existing Link": {
      "main": [
        [
          {
            "node": "If: Link Exists?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get DropBox access token": {
      "main": [
        [
          {
            "node": "Dropbox: Create Shared Link",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Dropbox: List Shared Links": {
      "main": [
        [
          {
            "node": "Extract Existing Link",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Dropbox: Create Shared Link": {
      "main": [
        [
          {
            "node": "Dropbox: List Shared Links",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Call '[SUB] Dropbox upload links'": {
      "main": [
        [
          {
            "node": "Completed",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When Executed by Another Workflow": {
      "main": [
        [
          {
            "node": "Upload a file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}