8
n8n 中文网amn8n.com

使用TransferNow自动发送大文件

高级

这是一个Content Creation, Multimodal AI领域的自动化工作流,包含 19 个节点。主要使用 If, Set, Code, Form, Merge 等节点。 使用TransferNow自动上传并发送大文件

前置要求
  • 可能需要目标 API 的认证凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "IaP1PFerysorkzbn",
  "meta": {
    "instanceId": "a4bfc93e975ca233ac45ed7c9227d84cf5a2329310525917adaf3312e10d5462"
  },
  "name": "使用 TransferNow 自动发送大文件",
  "tags": [],
  "nodes": [
    {
      "id": "ae8b10cf-20ea-4975-beba-736b780d7103",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1488,
        160
      ],
      "parameters": {
        "color": 5,
        "width": 1104,
        "height": 176,
        "content": "## 步骤 1"
      },
      "typeVersion": 1
    },
    {
      "id": "d05475bf-b614-4838-a31f-5f42a6c725b2",
      "name": "表单提交时",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        1520,
        720
      ],
      "webhookId": "0e6f7af4-c78c-4ce0-a295-df94427ebc16",
      "parameters": {
        "options": {},
        "formTitle": "Upload Form",
        "formFields": {
          "values": [
            {
              "fieldLabel": "Title",
              "requiredField": true
            },
            {
              "fieldType": "textarea",
              "fieldLabel": "Message",
              "requiredField": true
            },
            {
              "fieldType": "email",
              "fieldLabel": "To",
              "requiredField": true
            },
            {
              "fieldType": "file",
              "fieldLabel": "data",
              "multipleFiles": false,
              "requiredField": true
            }
          ]
        },
        "formDescription": "Upload PDF files to send via TransferNow"
      },
      "typeVersion": 2.3
    },
    {
      "id": "d714bb39-527b-4c24-83c1-e715a984899a",
      "name": "计算大小",
      "type": "n8n-nodes-base.code",
      "position": [
        1952,
        544
      ],
      "parameters": {
        "jsCode": "const buffer = await this.helpers.getBinaryDataBuffer(0, 'data');\nconst name = $input.first().binary.data.fileName;\n\nreturn [\n  {\n    json: {\n      name: name,\n      size: buffer.length\n    },\n  },\n];"
      },
      "typeVersion": 2
    },
    {
      "id": "8d391955-47e7-4299-be6a-58e8d1f2bf21",
      "name": "设置 JSON",
      "type": "n8n-nodes-base.set",
      "position": [
        2384,
        544
      ],
      "parameters": {
        "mode": "raw",
        "options": {},
        "jsonOutput": "={\n  \"name\": \"{{ $json.name }}\",\n  \"size\": {{ $json.size }}\n}\n"
      },
      "typeVersion": 3.4
    },
    {
      "id": "d4bc1a9d-bffd-4b3b-889f-e605fd258e8d",
      "name": "设置传输",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2832,
        544
      ],
      "parameters": {
        "url": "https://api.transfernow.net/v1/transfers",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n        \"langCode\": \"it\",\n        \"toEmails\": [\"{{ $('On form submission').item.json.To }}\"],\n        \"files\": [{{ (JSON.stringify($json)) }}],\n        \"message\": \"{{ $('On form submission').item.json.Message }}\",\n        \"subject\": \"{{ $('On form submission').item.json.Title }}\",\n        \"validityStart\": \"{{ $now }}\",\n        \"validityEnd\": \"{{ $now.plus({week:1}) }}\",\n        \"allowPreview\": true,\n        \"maxDownloads\": 7\n      }\n\n",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "Ds6c0Jvwog49aQNO",
          "name": "Header Auth TransferNow"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "9e60b05f-3fa6-4e10-85ed-bb8e3a4c62bf",
      "name": "获取上传 URL",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        3312,
        544
      ],
      "parameters": {
        "url": "=https://api.transfernow.net/v1/transfers/{{ $json.transferId }}/files/{{ $json.files[0].id }}/parts/{{ $json.files[0].multipartUpload.parts[0].partNumber }}?uploadId={{ $json.files[0].multipartUpload.uploadId }}",
        "options": {},
        "sendHeaders": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "Ds6c0Jvwog49aQNO",
          "name": "Header Auth TransferNow"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "647c1e4d-4c33-43d0-aaea-c51daac874a6",
      "name": "上传完成",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        3312,
        752
      ],
      "parameters": {
        "url": "=https://api.transfernow.net/v1/transfers/{{ $('Set Transfer').item.json.transferId }}/upload-done",
        "method": "PUT",
        "options": {},
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "Ds6c0Jvwog49aQNO",
          "name": "Header Auth TransferNow"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "2397b257-bfa1-45c0-b80a-c31548019e54",
      "name": "获取传输数据",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        3312,
        960
      ],
      "parameters": {
        "url": "=https://api.transfernow.net/v1/transfers/{{ $('Set Transfer').item.json.transferId }}",
        "options": {},
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "Ds6c0Jvwog49aQNO",
          "name": "Header Auth TransferNow"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "6688b620-0365-401f-bb85-5a6a8e4b78b5",
      "name": "获取参数",
      "type": "n8n-nodes-base.set",
      "position": [
        3584,
        960
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "625867c4-2859-4b6f-93aa-89148c685328",
              "name": "url_transfer",
              "type": "string",
              "value": "=https://{{ $json.domain }}/dl/{{ $json.id }}/{{ $json.recipients[0].secret }}"
            },
            {
              "id": "f25130a0-d32b-4f0b-b2f0-11f4af955162",
              "name": "email",
              "type": "string",
              "value": "={{ $json.recipients[0].email }}"
            },
            {
              "id": "39ab045d-41cb-475c-940a-12c99e9ca773",
              "name": "name_transfer",
              "type": "string",
              "value": "={{ $json.name }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "c6ff7fd0-0376-4819-9bcb-cfac83d64a3b",
      "name": "表单",
      "type": "n8n-nodes-base.form",
      "position": [
        3808,
        960
      ],
      "webhookId": "1e0bfba1-6859-4767-a65e-600c831d7031",
      "parameters": {
        "options": {},
        "operation": "completion",
        "completionTitle": "Upload complete",
        "completionMessage": "=The files have been sent to the following email address: {{ $json.email }}\nDownload URL: {{ $json.url_transfer }}"
      },
      "typeVersion": 2.3
    },
    {
      "id": "533f9bed-2476-489e-8256-c12ad722d133",
      "name": "是否完成?",
      "type": "n8n-nodes-base.if",
      "position": [
        2848,
        880
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "78609385-4035-4bd1-8e06-36feb4115100",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.message }}",
              "rightValue": "OK"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "0824bec9-fdbd-4fd3-b3e5-5f0cce4aa488",
      "name": "发送传输",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2576,
        880
      ],
      "parameters": {
        "url": "=https://api.transfernow.net/v1/transfers/{{ $('Set Transfer').item.json.transferId }}/files/{{ $('Set Transfer').item.json.files[0].id }}/upload-done?uploadId={{ $('Set Transfer').item.json.files[0].multipartUpload.uploadId }}",
        "method": "PUT",
        "options": {},
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "Ds6c0Jvwog49aQNO",
          "name": "Header Auth TransferNow"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "59f81389-6f5a-4664-97fd-bb9b5131066c",
      "name": "发送上传 URL",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2272,
        880
      ],
      "parameters": {
        "url": "={{ $json.uploadUrl }}",
        "method": "PUT",
        "options": {
          "response": {
            "response": {
              "fullResponse": true
            }
          }
        },
        "sendBody": true,
        "contentType": "binaryData",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/octet-stream"
            }
          ]
        },
        "inputDataFieldName": "data"
      },
      "typeVersion": 4.2
    },
    {
      "id": "6b7de5f4-b215-4b2a-9e1b-95750a72b0cc",
      "name": "合并",
      "type": "n8n-nodes-base.merge",
      "position": [
        1968,
        880
      ],
      "parameters": {
        "mode": "combine",
        "options": {},
        "combineBy": "combineByPosition"
      },
      "typeVersion": 3.1
    },
    {
      "id": "3eeea705-5ce5-459d-b15f-8b60f9169a94",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1488,
        -32
      ],
      "parameters": {
        "color": 3,
        "width": 1104,
        "height": 144,
        "content": "# 使用 TransferNow 自动发送大文件"
      },
      "typeVersion": 1
    },
    {
      "id": "2b546114-5765-4596-98cd-728a554f97f0",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1920,
        448
      ],
      "parameters": {
        "width": 704,
        "height": 240,
        "content": "## 大小"
      },
      "typeVersion": 1
    },
    {
      "id": "ba8993da-18f0-4713-9fe0-399051e84246",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2768,
        448
      ],
      "parameters": {
        "width": 704,
        "height": 240,
        "content": "## 上传"
      },
      "typeVersion": 1
    },
    {
      "id": "5fb3a536-4893-4eaf-abbd-b7ef3758a31f",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2224,
        800
      ],
      "parameters": {
        "width": 544,
        "height": 240,
        "content": "## 传输"
      },
      "typeVersion": 1
    },
    {
      "id": "bc3a2893-112f-4dde-ade7-7f82252585e8",
      "name": "便签5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3280,
        880
      ],
      "parameters": {
        "width": 448,
        "height": 240,
        "content": "## 下载"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "45265b23-20ea-4e48-aea0-575853184536",
  "connections": {
    "Merge": {
      "main": [
        [
          {
            "node": "Send UploadUrl",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Json": {
      "main": [
        [
          {
            "node": "Set Transfer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Is complete?": {
      "main": [
        [
          {
            "node": "Upload done",
            "type": "main",
            "index": 0
          },
          {
            "node": "Get transfer data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Transfer": {
      "main": [
        [
          {
            "node": "Get Upload Url",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Transfer": {
      "main": [
        [
          {
            "node": "Is complete?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Calculate size": {
      "main": [
        [
          {
            "node": "Set Json",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Upload Url": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get parameters": {
      "main": [
        [
          {
            "node": "Form",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send UploadUrl": {
      "main": [
        [
          {
            "node": "Send Transfer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get transfer data": {
      "main": [
        [
          {
            "node": "Get parameters",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "On form submission": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          },
          {
            "node": "Calculate size",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

高级 - 内容创作, 多模态 AI

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
高级
节点数量19
分类2
节点类型8
难度说明

适合高级用户,包含 16+ 个节点的复杂工作流

作者

Full-stack Web Developer based in Italy specialising in Marketing & AI-powered automations. For business enquiries, send me an email at info@n3w.it or add me on Linkedin.com/in/davideboizza

外部链接
在 n8n.io 查看

分享此工作流