8
n8n 中文网amn8n.com

Airtable完整备份

高级

这是一个Engineering, DevOps, AI领域的自动化工作流,包含 19 个节点。主要使用 If, Set, AwsS3, Slack, Airtable 等节点,结合人工智能技术实现智能自动化。 Airtable数据库备份到S3

前置要求
  • AWS Access Key 和 Secret
  • Slack Bot Token 或 Webhook URL
  • Airtable API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "YeYi657TmrNBAlHy",
  "meta": {
    "instanceId": "473c658c7288f697d42ad8adb392c78c9ea1b1c3a9d169c508028d7c271b8621",
    "templateCredsSetupCompleted": true
  },
  "name": "Airtable Full Backup",
  "tags": [],
  "nodes": [
    {
      "id": "2cfec4e1-08ad-4363-a3af-5aa77174ea1a",
      "name": "Airtable",
      "type": "n8n-nodes-base.airtable",
      "position": [
        380,
        -40
      ],
      "parameters": {
        "base": {
          "__rl": true,
          "mode": "list",
          "value": "yourbase",
          "cachedResultUrl": "https://airtable.com/yourbase",
          "cachedResultName": "Sample Base"
        },
        "resource": "base",
        "operation": "getSchema"
      },
      "credentials": {
        "airtableTokenApi": {
          "id": "U1WMD4Gt9NhWpX3s",
          "name": "Airtable"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "45e6e8e3-2b72-44ae-ae5a-84ade2dfb59b",
      "name": "遍历项目",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        600,
        -40
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "8c731bd7-54a7-443f-91de-1dedfcb79620",
      "name": "Create Table Metadata",
      "type": "n8n-nodes-base.set",
      "position": [
        1040,
        60
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "cea4432c-e31c-43bd-adea-446658a96ab5",
              "name": "fileName",
              "type": "string",
              "value": "={{ $json.name.replace(/[^\\p{L}\\p{N}\\s_-]+/gu, '').trim().replace(/\\s+/g, '_')                      \n}}"
            },
            {
              "id": "34f5e44c-1d62-47ac-875b-9bbe698ffc0d",
              "name": "tableName",
              "type": "string",
              "value": "={{ $json.name }}"
            },
            {
              "id": "4a06c76d-7ac3-4fe9-96e3-003e80e0bf1e",
              "name": "tableID",
              "type": "string",
              "value": "={{ $json.id }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "57d1b06e-5265-4beb-b53f-9be2f9f1f300",
      "name": "Pull Records",
      "type": "n8n-nodes-base.airtable",
      "position": [
        1260,
        60
      ],
      "parameters": {
        "base": {
          "__rl": true,
          "mode": "list",
          "value": "yourbase",
          "cachedResultUrl": "https://airtable.com/yourbase",
          "cachedResultName": "LifeOS"
        },
        "table": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $json.tableID }}"
        },
        "options": {},
        "operation": "search"
      },
      "credentials": {
        "airtableTokenApi": {
          "id": "U1WMD4Gt9NhWpX3s",
          "name": "Airtable"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "0872652a-6924-4a56-8058-69b51ecc8ee2",
      "name": "转换为文件",
      "type": "n8n-nodes-base.convertToFile",
      "position": [
        1480,
        60
      ],
      "parameters": {
        "options": {
          "fileName": "={{ $('Create Table Metadata').item.json.fileName }}.csv"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "167783d9-3fad-4a3c-827b-911b8d3587f7",
      "name": "AWS S3",
      "type": "n8n-nodes-base.awsS3",
      "position": [
        1700,
        60
      ],
      "parameters": {
        "fileName": "={{ $('Create Table Metadata').item.json.fileName }}.csv",
        "operation": "upload",
        "bucketName": "aired-out",
        "additionalFields": {
          "parentFolderKey": "={{ $('Set Week').item.json.currentWeek }}"
        }
      },
      "credentials": {
        "aws": {
          "id": "NijLkxXPqg88tIuO",
          "name": "AWS S3 Access"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "c766b901-e06c-457c-9407-a999b7eaecd0",
      "name": "Monthly Prune",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -320,
        500
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "months"
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "3fb466cd-90ad-4757-9df1-b7e2c317b454",
      "name": "Set Timestamps",
      "type": "n8n-nodes-base.set",
      "position": [
        -80,
        500
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "ca8f6d53-152c-44ea-b0c8-eb5a7ba7fbf4",
              "name": "cutoffDate",
              "type": "string",
              "value": "={{ $now.minus({ weeks: 4 }).toFormat(\"kkkk-'W'WW\") }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "dacaac6b-1025-4c57-82f2-d17b387c4258",
      "name": "如果",
      "type": "n8n-nodes-base.if",
      "position": [
        340,
        500
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "loose"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "9c09f6cc-9313-42ba-b48e-c8cc2faaebac",
              "operator": {
                "type": "dateTime",
                "operation": "before"
              },
              "leftValue": "={{ $json.Key.replace(/\\/$/, '') }}",
              "rightValue": "={{ $('Set Timestamps').item.json.cutoffDate }}"
            }
          ]
        },
        "looseTypeValidation": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "e279fa0d-af6c-4dc2-9ac3-89e3a08280f8",
      "name": "删除文件",
      "type": "n8n-nodes-base.awsS3",
      "position": [
        560,
        420
      ],
      "parameters": {
        "resource": "folder",
        "folderKey": "={{ $('List Folders').item.json.Key }}",
        "operation": "delete",
        "bucketName": "aired-out"
      },
      "credentials": {
        "aws": {
          "id": "NijLkxXPqg88tIuO",
          "name": "AWS S3 Access"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "8a2e4f1e-8a07-4f77-a05d-90cfca9d96da",
      "name": "Create Folder",
      "type": "n8n-nodes-base.awsS3",
      "position": [
        140,
        -40
      ],
      "parameters": {
        "resource": "folder",
        "bucketName": "aired-out",
        "folderName": "={{ $json.currentWeek }}",
        "additionalFields": {}
      },
      "credentials": {
        "aws": {
          "id": "NijLkxXPqg88tIuO",
          "name": "AWS S3 Access"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "69d7bfdc-657a-402c-b9ef-f230660be1f9",
      "name": "List Folders",
      "type": "n8n-nodes-base.awsS3",
      "position": [
        120,
        500
      ],
      "parameters": {
        "options": {},
        "resource": "folder",
        "operation": "getAll",
        "bucketName": "aired-out"
      },
      "credentials": {
        "aws": {
          "id": "NijLkxXPqg88tIuO",
          "name": "AWS S3 Access"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "35a136e1-4acc-4754-952e-69cf940219b0",
      "name": "Set Week",
      "type": "n8n-nodes-base.set",
      "position": [
        -80,
        -40
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "f5e7fb15-bf9c-4f6d-9476-15320ff150a6",
              "name": "currentWeek",
              "type": "string",
              "value": "={{ $now.toFormat(\"kkkk-'W'WW\") }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "ca332df0-313d-44fe-81da-f4fabcad8cf6",
      "name": "Weekly Backup",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -320,
        -40
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "weeks",
              "triggerAtHour": 12
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "68d97be1-f32f-4ada-85c3-7db8d3639262",
      "name": "Slack",
      "type": "n8n-nodes-base.slack",
      "position": [
        1260,
        -140
      ],
      "webhookId": "909deccb-0c0a-4243-ac3c-c69dd39f1ab4",
      "parameters": {
        "text": "=:floppy_disk: *Airtable Backup Complete*",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": "C08GPG2HTA4",
          "cachedResultName": "general"
        },
        "otherOptions": {}
      },
      "credentials": {
        "slackApi": {
          "id": "RKqLvV8Ij1tfFCYJ",
          "name": "Slack Content Bot"
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "8f7bf5dd-1e42-4979-808a-99c6db31f89c",
      "name": "无操作,不执行任何操作",
      "type": "n8n-nodes-base.noOp",
      "position": [
        560,
        600
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "c8ba25eb-0aed-42d0-8c55-420448eebce5",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -360,
        -220
      ],
      "parameters": {
        "width": 2240,
        "height": 520,
        "content": "## Airtable Weekly Backups\nEvery week backup all tables in an Airtable base into a dedicated week sub-folder in S3. Notify when complete."
      },
      "typeVersion": 1
    },
    {
      "id": "7c33f350-3f5c-4979-a176-bbdb3b8d663c",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -360,
        360
      ],
      "parameters": {
        "width": 1140,
        "height": 480,
        "content": "## Airtable Monthly Prune\nDelete backups > 1 month old"
      },
      "typeVersion": 1
    },
    {
      "id": "dcbb30d5-90da-44ef-991f-0a25cf67e01d",
      "name": "聚合",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        1040,
        -140
      ],
      "parameters": {
        "options": {},
        "aggregate": "aggregateAllItemData"
      },
      "typeVersion": 1
    }
  ],
  "active": true,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "6ae12e8e-f949-48f7-977e-65f5bb49be9b",
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "Delete File",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "No Operation, do nothing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AWS S3": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Airtable": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Week": {
      "main": [
        [
          {
            "node": "Create Folder",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Aggregate": {
      "main": [
        [
          {
            "node": "Slack",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "List Folders": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Pull Records": {
      "main": [
        [
          {
            "node": "Convert to File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Folder": {
      "main": [
        [
          {
            "node": "Airtable",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Monthly Prune": {
      "main": [
        [
          {
            "node": "Set Timestamps",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Weekly Backup": {
      "main": [
        [
          {
            "node": "Set Week",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Timestamps": {
      "main": [
        [
          {
            "node": "List Folders",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert to File": {
      "main": [
        [
          {
            "node": "AWS S3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [
          {
            "node": "Aggregate",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Create Table Metadata",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Table Metadata": {
      "main": [
        [
          {
            "node": "Pull Records",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级 - 工程, 开发运维, 人工智能

需要付费吗?

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

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

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

作者
Autonomous Work

Autonomous Work

@autonomouswork

Senior Solutions Architect · 10 years in Data, Cloud, & AI ⚡ Maximize the individual with low-friction systems for peak output 🌮 TACO stack. Views are my own.

外部链接
在 n8n.io 查看

分享此工作流