使用 n8n API 和表单触发器备份和删除工作流到 Google Drive
中级
这是一个DevOps领域的自动化工作流,包含 13 个节点。主要使用 N8n, Code, Telegram, FormTrigger, GoogleDrive 等节点。 使用 n8n API 和表单触发器备份和删除工作流到 Google Drive
前置要求
- •Telegram Bot Token
- •Google Drive API 凭证
分类
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"meta": {
"instanceId": "0a82a9d5784b67ad963ceff89283b2e40cb771be10fe58ba2682f3598a37c6e1",
"templateCredsSetupCompleted": true
},
"nodes": [
{
"id": "76cdbf3e-e25b-4998-bf56-6cd13140e166",
"name": "表单提交时",
"type": "n8n-nodes-base.formTrigger",
"position": [
0,
80
],
"webhookId": "350d8518-e91c-4fd0-af83-b6649e7965bd",
"parameters": {
"options": {
"buttonLabel": "Backup & Delete",
"appendAttribution": false
},
"formTitle": "🧾 Backup & Delete Workflow",
"formFields": {
"values": [
{
"fieldLabel": "Paste the full workflow URL below.",
"placeholder": " https://n8n-miinstancia.com/workflow/abc123",
"requiredField": true
}
]
},
"formDescription": "This tool backs up the full JSON file of a workflow to a Google Drive folder before safely deleting it from your n8n instance."
},
"typeVersion": 2.2
},
{
"id": "10ef7ab2-86ca-4e62-b94f-77a6e18f920d",
"name": "发送文本消息",
"type": "n8n-nodes-base.telegram",
"position": [
1936,
80
],
"webhookId": "192a1c25-6efc-465a-b77d-c250fee9a57b",
"parameters": {
"text": "=✅ Workflow Backup Successful\n\nThe workflow titled: {{ $json.name }} \nwith ID: {{ $json.id }} \nhas been successfully backed up to your selected Google Drive Folder.\n\n📄 You can view the backup at the following link:\n(USE YOUR GOOGLE DRIVE FOLDER LINK HERE)\n\n📅 Backup Date: {{ $now }}\n",
"chatId": "8019473661",
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"id": "BjU1NgO9AIM86N5W",
"name": "EMPTY"
}
},
"typeVersion": 1.2
},
{
"id": "b038653e-afd6-4c59-b291-7caddf8cca7a",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
-768,
-560
],
"parameters": {
"width": 624,
"height": 1360,
"content": "## 🔍 描述:"
},
"typeVersion": 1
},
{
"id": "9da23a3f-d899-4eab-a12e-17ff8fa3c816",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-112,
-560
],
"parameters": {
"color": 7,
"width": 352,
"height": 1360,
"content": "## 📝 1. 表单节点:\"获取工作流 URL\""
},
"typeVersion": 1
},
{
"id": "2ed52c3b-1898-4c06-adc2-d81708ae3679",
"name": "便签2",
"type": "n8n-nodes-base.stickyNote",
"position": [
272,
-560
],
"parameters": {
"color": 7,
"width": 352,
"height": 1360,
"content": "## 🔍 2. n8n 节点:\"获取工作流\""
},
"typeVersion": 1
},
{
"id": "775f86f7-2daf-45ae-9ab6-0bf6a1ab56ef",
"name": "便签4",
"type": "n8n-nodes-base.stickyNote",
"position": [
1040,
-560
],
"parameters": {
"color": 7,
"width": 352,
"height": 1360,
"content": "## 📁 Google Drive 节点:\"上传工作流备份\""
},
"typeVersion": 1
},
{
"id": "fc18f562-569a-48fa-9faa-14b0dc6349db",
"name": "便利贴5",
"type": "n8n-nodes-base.stickyNote",
"position": [
1424,
-560
],
"parameters": {
"color": 7,
"width": 352,
"height": 1360,
"content": "## 🗑️ 5. n8n 节点:\"删除工作流\""
},
"typeVersion": 1
},
{
"id": "e19ae6be-61e2-414b-af70-2069dc3925a5",
"name": "便签 6",
"type": "n8n-nodes-base.stickyNote",
"position": [
1808,
-560
],
"parameters": {
"color": 7,
"width": 352,
"height": 1360,
"content": "## 📬 6. Telegram 节点:\"发送通知\""
},
"typeVersion": 1
},
{
"id": "cbef6523-6186-4a83-b70c-5b3c4a619615",
"name": "上传工作流",
"type": "n8n-nodes-base.googleDrive",
"position": [
1168,
80
],
"parameters": {
"name": "={{ $('Get a Workflow').item.json.name }}",
"driveId": {
"__rl": true,
"mode": "list",
"value": "My Drive",
"cachedResultUrl": "https://drive.google.com/drive/my-drive",
"cachedResultName": "My Drive"
},
"options": {},
"folderId": {
"__rl": true,
"mode": "list",
"value": "1Wv8HI8jUu-XbpC4mRJH78WNMAD_xM8f8",
"cachedResultUrl": "https://drive.google.com/drive/folders/1Wv8HI8jUu-XbpC4mRJH78WNMAD_xM8f8",
"cachedResultName": "N8N - Deleted Workflows Backup"
},
"authentication": "serviceAccount"
},
"credentials": {
"googleApi": {
"id": "Ru2YSsIPYQIOlnvD",
"name": "EMPTY"
}
},
"typeVersion": 3
},
{
"id": "e31a574e-a952-43f0-89cc-e385e46f6075",
"name": "便签 7",
"type": "n8n-nodes-base.stickyNote",
"position": [
656,
-560
],
"parameters": {
"color": 7,
"width": 352,
"height": 1360,
"content": "## 📦 5. 代码节点:\"生成 .json 文件\""
},
"typeVersion": 1
},
{
"id": "1b9ef445-9385-4b2c-a0c0-391bb5799887",
"name": "删除工作流",
"type": "n8n-nodes-base.n8n",
"position": [
1568,
80
],
"parameters": {
"operation": "delete",
"workflowId": {
"__rl": true,
"mode": "id",
"value": "={{ $('Get a Workflow').item.json.id }}"
},
"requestOptions": {}
},
"credentials": {
"n8nApi": {
"id": "VSxAuLMW3kDlXjYA",
"name": "EMPTY"
}
},
"typeVersion": 1
},
{
"id": "5d540bb7-99f0-4202-8eb7-d37200468163",
"name": "获取工作流",
"type": "n8n-nodes-base.n8n",
"position": [
400,
80
],
"parameters": {
"operation": "get",
"workflowId": {
"__rl": true,
"mode": "url",
"value": "={{ $json['Paste the full workflow URL below.'] }}"
},
"requestOptions": {}
},
"credentials": {
"n8nApi": {
"id": "VSxAuLMW3kDlXjYA",
"name": "EMPTY"
}
},
"typeVersion": 1
},
{
"id": "2da4e84a-20f3-4d3c-905e-eb884218e3b1",
"name": "JSON 到文件",
"type": "n8n-nodes-base.code",
"position": [
784,
80
],
"parameters": {
"jsCode": "const fileName = `${$json.name.replace(/[^a-z0-9_-]/gi, \"_\") || \"workflow\"}.json`;\nconst jsonContent = JSON.stringify($json, null, 2);\n\nreturn [\n {\n binary: {\n data: await this.helpers.prepareBinaryData(Buffer.from(jsonContent), fileName, 'application/json'),\n },\n json: {\n fileName,\n },\n },\n];\n"
},
"typeVersion": 2
}
],
"pinData": {},
"connections": {
"JSON to File": {
"main": [
[
{
"node": "Upload Workflow",
"type": "main",
"index": 0
}
]
]
},
"Get a Workflow": {
"main": [
[
{
"node": "JSON to File",
"type": "main",
"index": 0
}
]
]
},
"Upload Workflow": {
"main": [
[
{
"node": "Delete a Workflow",
"type": "main",
"index": 0
}
]
]
},
"Delete a Workflow": {
"main": [
[
{
"node": "Send a text message",
"type": "main",
"index": 0
}
]
]
},
"On form submission": {
"main": [
[
{
"node": "Get a Workflow",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
中级 - 开发运维
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
自动化执行清理系统
使用n8n API和自定义保留规则的自动化执行清理系统
N8n
Set
Code
+2
12 节点Arlin Perez
开发运维
n8n 工作流备份与恢复
使用 Telegram、Google Drive 和表单上传备份与恢复 n8n 工作流
If
N8n
Code
+11
28 节点Daniel Nkencho
高级 n8n 工作流与 GitHub 同步
使用 GitHub 的智能变更检测自动化工作流备份
If
N8n
Set
+10
38 节点Maksym Brashenko
开发运维
自动化工作流备份至 Google Drive 并智能清理
自动化工作流备份至 Google Drive 并智能清理
N8n
Set
Code
+6
17 节点Luca Olovrap
开发运维
Telegram-n8n-指挥官
通过 Telegram 机器人命令远程控制 n8n 实例
If
N8n
Set
+11
67 节点Arthur Braghetto
开发运维
智能工作流维护系统
具备智能AI过滤和Google Workspace集成的智能工作流维护系统
If
N8n
Code
+10
42 节点Jimmy Gay
开发运维
工作流信息
难度等级
中级
节点数量13
分类1
节点类型6
作者
Arlin Perez
@arlindeveloper👋 Hi! I'm Arlin - a QA Engineer with 2 years of experience and a background in Dart & Flutter for mobile app development. ⚙️ I'm passionate about automation and love building efficient workflows using n8n. 📬 Reach out for any help with custom workflows
外部链接
在 n8n.io 查看 →
分享此工作流