8
n8n 中文网amn8n.com

完整的 Airtable 数据库管理与 AI 代理和 Redis 存储

高级

这是一个AI RAG, Multimodal AI领域的自动化工作流,包含 24 个节点。主要使用 RedisTool, Agent, HttpRequestTool, McpTrigger, ChatTrigger 等节点。 使用 AI 代理和 Redis 存储进行完整的 Airtable 数据库管理

前置要求
  • Redis 服务器连接信息
  • 可能需要目标 API 的认证凭证
  • OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "1e7a9324ab9334116f824c649ad91453265a99b04bad06eba0c9ec33cc653365"
  },
  "nodes": [
    {
      "id": "2bf31ff0-fdb2-4a63-8cb4-7dd77c25e3a0",
      "name": "create_custom_table",
      "type": "n8n-nodes-base.httpRequestTool",
      "position": [
        -432,
        736
      ],
      "parameters": {
        "url": "=https://api.airtable.com/v0/meta/bases/{{ $fromAI('base_id') }}/tables",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"name\": \"{{ $fromAI('table_name') }}\",\n  \"fields\": {{ $fromAI('fields_json') }}\n}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "predefinedCredentialType",
        "toolDescription": "Creates a custom table with user-specified name and fields. For advanced users who want additional tables.\n\n{\n  \"name\": \"Bookings\",\n  \"fields\": [\n    {\"name\": \"Name\", \"type\": \"singleLineText\"},\n    {\"name\": \"Phone Number\", \"type\": \"phoneNumber\"},\n    {\"name\": \"starttime\", \"type\": \"dateTime\", \"options\": {\"dateFormat\": {\"name\": \"european\"}, \"timeFormat\": {\"name\": \"24hour\"}, \"timeZone\": \"utc\"}},\n    {\"name\": \"endtime\", \"type\": \"dateTime\", \"options\": {\"dateFormat\": {\"name\": \"european\"}, \"timeFormat\": {\"name\": \"24hour\"}, \"timeZone\": \"utc\"}},\n    {\"name\": \"eventid\", \"type\": \"singleLineText\"},\n    {\"name\": \"Service\", \"type\": \"singleLineText\"},\n    {\"name\": \"Status\", \"type\": \"singleSelect\", \"options\": {\"choices\": [{\"name\": \"confirmed\"}, {\"name\": \"cancelled\"}, {\"name\": \"completed\"}]}},\n    {\"name\": \"Notes\", \"type\": \"multilineText\"}\n  ]\n}\n\nFor create_custom_table:\n- date fields MUST have: \"options\":{\"dateFormat\":{\"name\":\"iso\"}}\n- dateTime fields MUST have: \"options\":{\"dateFormat\":{\"name\":\"iso\"},\"timeFormat\":{\"name\":\"24hour\"},\"timeZone\":\"utc\"}\n- number fields MUST have: \"options\":{\"precision\":0} or 2\n- singleSelect MUST have: \"options\":{\"choices\":[{\"name\":\"Option1\"}]}",
        "nodeCredentialType": "airtableTokenApi"
      },
      "credentials": {
        "airtableTokenApi": {
          "id": "wmXRN8LPtIYfZqS2",
          "name": "Airtable N8N"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "4d7a86f7-2e87-4d9d-8f8a-5e6b9cea6e99",
      "name": "rename_table",
      "type": "n8n-nodes-base.httpRequestTool",
      "position": [
        -1280,
        1568
      ],
      "parameters": {
        "url": "=https://api.airtable.com/v0/meta/bases/{{ $fromAI('base_id') }}/tables/{{ $fromAI('table_id') }}",
        "method": "PATCH",
        "options": {},
        "jsonBody": "={\n  \"name\": \"{{ $fromAI('new_name') }}\"\n}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "predefinedCredentialType",
        "toolDescription": "Rename an existing table in the Airtable base. Requires base_id, table_id, and new_name.",
        "nodeCredentialType": "airtableTokenApi"
      },
      "credentials": {
        "airtableTokenApi": {
          "id": "wmXRN8LPtIYfZqS2",
          "name": "Airtable N8N"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "198daf19-98d5-45ab-b025-b0fec8f8db16",
      "name": "get_existing_records",
      "type": "n8n-nodes-base.httpRequestTool",
      "position": [
        -1648,
        1104
      ],
      "parameters": {
        "url": "=https://api.airtable.com/v0/{{ $fromAI('base_id') }}/{{ $fromAI('table_id') }}",
        "options": {},
        "authentication": "predefinedCredentialType",
        "toolDescription": "Gets current records from a specific table. Requires base_id and table_id. Use before updating records to show user current values.",
        "nodeCredentialType": "airtableTokenApi"
      },
      "credentials": {
        "airtableTokenApi": {
          "id": "wmXRN8LPtIYfZqS2",
          "name": "Airtable N8N"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "71d07559-3927-402c-9527-a3ac209c83a1",
      "name": "get_table_ids",
      "type": "n8n-nodes-base.httpRequestTool",
      "position": [
        -1648,
        1296
      ],
      "parameters": {
        "url": "=https://api.airtable.com/v0/meta/bases/{{ $fromAI('base_id') }}/tables",
        "options": {},
        "authentication": "predefinedCredentialType",
        "toolDescription": "Fetches all table IDs and names from the base. Critical for getting table_id needed for data operations. Use after creating tables and before adding/updating records.",
        "nodeCredentialType": "airtableTokenApi"
      },
      "credentials": {
        "airtableTokenApi": {
          "id": "wmXRN8LPtIYfZqS2",
          "name": "Airtable N8N"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "87f84943-3ecf-4d37-88c8-58652cd3409d",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1840,
        800
      ],
      "parameters": {
        "color": 4,
        "width": 496,
        "height": 624,
        "content": "### 📖 读取操作"
      },
      "typeVersion": 1
    },
    {
      "id": "50965ac1-256d-452c-b7f7-57a80c7b6386",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1840,
        1456
      ],
      "parameters": {
        "color": 5,
        "width": 880,
        "height": 256,
        "content": "### ✏️ 更新操作"
      },
      "typeVersion": 1
    },
    {
      "id": "5c39b558-961b-4828-be8d-17a9cd5bba63",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -784,
        1456
      ],
      "parameters": {
        "color": 3,
        "width": 640,
        "height": 256,
        "content": "🗑️ 删除操作"
      },
      "typeVersion": 1
    },
    {
      "id": "ab251dd7-4686-44e1-a601-6fc5074e247c",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -640,
        432
      ],
      "parameters": {
        "color": 6,
        "width": 496,
        "height": 976,
        "content": "### ➕ 创建操作"
      },
      "typeVersion": 1
    },
    {
      "id": "e1cd5c63-31df-4e5e-a014-75f5cf168ee9",
      "name": "Redis 聊天记忆",
      "type": "@n8n/n8n-nodes-langchain.memoryRedisChat",
      "position": [
        -1280,
        2176
      ],
      "parameters": {
        "sessionKey": "=salon_owner_agent",
        "sessionIdType": "customKey",
        "contextWindowLength": 15
      },
      "credentials": {
        "redis": {
          "id": "TGXwMeCNAC8NdQNU",
          "name": "Redis account"
        }
      },
      "typeVersion": 1.5
    },
    {
      "id": "63854117-36a6-4a3b-a90a-08fdc3ed6e76",
      "name": "Airtable 代理",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -1200,
        1840
      ],
      "parameters": {
        "text": "={{ $json.chatInput }}",
        "options": {
          "systemMessage": "=You are an Airtable Database Assistant helping users create and manage Airtable databases.\n\n## Storage Tools Available:\n- get_base_id / set_base_id - Store and retrieve base IDs\n- get_workspace_id / set_workspace_id - Store and retrieve workspace ID\n\n## For EXISTING databases:\n1. Use get_base_id to check for stored base ID\n2. If found, use that base_id for all operations\n3. User only needs to provide base_id (NO workspace needed)\n\n## For NEW database creation ONLY:\n1. Check get_workspace_id for stored workspace\n2. If not found, ask user for workspace_id ONCE\n3. Store it with set_workspace_id for future use\n4. Create base with workspace_id\n5. Store new base_id with set_base_id\n\n## Important:\n- Only ask for workspace_id when creating NEW bases\n- For existing bases, ONLY need base_id\n- Always check stored values first before asking user\n- Store IDs after getting them to avoid asking again\n\n## Process Guidelines:\n- Be conversational and guide step-by-step\n- Create working system first, then customize\n- Use plain text only. No markdown formatting or asterisks\n- Don't assume what they want to change, ask for clarification\n- Fetch table IDs before operations unless stored in memory\n- Never lie or invent just to please the user\n"
        },
        "promptType": "define"
      },
      "typeVersion": 2.1
    },
    {
      "id": "923e63e8-b6fc-4199-840e-e7fc13b657f3",
      "name": "gpt-5-mini",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -1472,
        2176
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-5-mini",
          "cachedResultName": "gpt-5-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "yFsTgVI1r1htMsxI",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "602ce2b4-dd59-42c0-b5fe-dcf4b3bdbc7b",
      "name": "当收到聊天消息时",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        -1552,
        1840
      ],
      "webhookId": "47c9de1d-71db-4906-a52a-d96e0126ae77",
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.3
    },
    {
      "id": "9b06d16d-200a-493e-b9d6-ac029dd54086",
      "name": "MCP 客户端",
      "type": "@n8n/n8n-nodes-langchain.mcpClientTool",
      "position": [
        -496,
        2176
      ],
      "parameters": {
        "endpointUrl": "https://primary-production-8fde8.up.railway.app/mcp/airtable-database-builder-mcp",
        "serverTransport": "httpStreamable"
      },
      "typeVersion": 1.1
    },
    {
      "id": "ddce06f4-7e87-4915-8ea4-99b5de8cc42e",
      "name": "MCP 服务器触发器",
      "type": "@n8n/n8n-nodes-langchain.mcpTrigger",
      "position": [
        -1120,
        896
      ],
      "webhookId": "97f2d73e-dfec-40b9-89b5-5af6a43b32c1",
      "parameters": {
        "path": "airtable-database-builder-mcp"
      },
      "typeVersion": 2
    },
    {
      "id": "18f9e358-1a5e-4be3-afff-325c00a07cf6",
      "name": "delete_record",
      "type": "n8n-nodes-base.httpRequestTool",
      "position": [
        -288,
        1552
      ],
      "parameters": {
        "url": "=https://api.airtable.com/v0/{{ $fromAI('base_id') }}/{{ $fromAI('table_id') }}/{{ $fromAI('record_id') }}",
        "method": "DELETE",
        "options": {},
        "authentication": "predefinedCredentialType",
        "toolDescription": "Deletes a specific record from Services table. Requires base_id, table_id, and record_id.",
        "nodeCredentialType": "airtableTokenApi"
      },
      "credentials": {
        "airtableTokenApi": {
          "id": "wmXRN8LPtIYfZqS2",
          "name": "Airtable N8N"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "a5ca9a63-5da9-4b2f-84b4-bbcebfbe48ab",
      "name": "create_record",
      "type": "n8n-nodes-base.httpRequestTool",
      "position": [
        -432,
        896
      ],
      "parameters": {
        "url": "=https://api.airtable.com/v0/{{ $fromAI('base_id') }}/{{ $fromAI('table_id') }}",
        "method": "POST",
        "options": {},
        "jsonBody": "={\"records\": [{\"fields\": {{ $fromAI('fields_json') }}}]}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "predefinedCredentialType",
        "toolDescription": "Adds a new service to the Services table. Requires base_id and table_id. Required params: service_name, price. Use after getting table_ids to populate services.",
        "nodeCredentialType": "airtableTokenApi"
      },
      "credentials": {
        "airtableTokenApi": {
          "id": "wmXRN8LPtIYfZqS2",
          "name": "Airtable N8N"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "191bd7d2-38f4-4122-864a-158c38b885cf",
      "name": "update_record",
      "type": "n8n-nodes-base.httpRequestTool",
      "position": [
        -432,
        1248
      ],
      "parameters": {
        "url": "=https://api.airtable.com/v0/{{ $fromAI('base_id') }}/{{ $fromAI('table_id') }}",
        "method": "POST",
        "options": {},
        "jsonBody": "={\"fields\": {{ $fromAI('fields_json') }}}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "predefinedCredentialType",
        "toolDescription": "Adds a new service to the Services table. Requires base_id and table_id. Required params: service_name, price. Use after getting table_ids to populate services.",
        "nodeCredentialType": "airtableTokenApi"
      },
      "credentials": {
        "airtableTokenApi": {
          "id": "wmXRN8LPtIYfZqS2",
          "name": "Airtable N8N"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "fe4aff37-0b9b-479e-9a37-b07e4537d5bf",
      "name": "create_base",
      "type": "n8n-nodes-base.httpRequestTool",
      "position": [
        -432,
        1056
      ],
      "parameters": {
        "url": "https://api.airtable.com/v0/meta/bases",
        "method": "POST",
        "options": {},
        "jsonBody": "={\"name\": \"{{ $fromAI('base_name') }}\", \"workspaceId\": \"{{ $fromAI('workspace_id') }}\", \"tables\": [{\"name\":\"Main\",\"fields\":[{\"name\":\"Name\",\"type\":\"singleLineText\"}]}]}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "predefinedCredentialType",
        "toolDescription": "Create a base with Workspace ID:\n\nWhen creating bases with tables_json, use only these exact field types:\n- singleLineText (for text)\n- multilineText (for long text - NOT multiLineText)\n- number (for numbers)\n- phoneNumber (for phone - NOT phone)\n- email (for emails)\n- date (for dates only)\n- dateTime (for date and time)\n- singleSelect (needs options)\n- multipleSelect (needs options)\n\nDO NOT use:\n- multiLineText (wrong capitalization)\n- phone (use phoneNumber)\n- linkedRecord fields (add after base creation)\n- \"primary\" property (automatic)\n\n\nFor number fields, MUST include options:\n{\"name\": \"Price\", \"type\": \"number\", \"options\": {\"precision\": 2}}\n- precision: 0 for integers\n- precision: 2 for money/decimals\n\nExample valid tables_json:\n[{\"name\":\"Services\",\"fields\":[{\"name\":\"ServiceName\",\"type\":\"singleLineText\"},{\"name\":\"Description\",\"type\":\"multilineText\"}, ",
        "nodeCredentialType": "airtableTokenApi"
      },
      "credentials": {
        "airtableTokenApi": {
          "id": "wmXRN8LPtIYfZqS2",
          "name": "Airtable N8N"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "3cf80b36-0a67-41aa-ae9e-c5b847cb3563",
      "name": "set_workspace_id",
      "type": "n8n-nodes-base.redisTool",
      "position": [
        -1088,
        2176
      ],
      "parameters": {
        "key": "=workspace_id",
        "value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Value', `Store Workspace ID`, 'string') }}",
        "operation": "set",
        "descriptionType": "manual",
        "toolDescription": "Store Workspace ID"
      },
      "credentials": {
        "redis": {
          "id": "TGXwMeCNAC8NdQNU",
          "name": "Redis account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "f6a633cb-6031-4c77-8a7c-8d2e213b382d",
      "name": "get_workspace_id",
      "type": "n8n-nodes-base.redisTool",
      "position": [
        -912,
        2176
      ],
      "parameters": {
        "key": "=workspace_id",
        "options": {},
        "operation": "get",
        "propertyName": "WorkspaceID",
        "descriptionType": "manual",
        "toolDescription": "Get Workspace ID"
      },
      "credentials": {
        "redis": {
          "id": "TGXwMeCNAC8NdQNU",
          "name": "Redis account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "7ccbd0fa-8c0e-4f3a-9632-e6a12412327a",
      "name": "get_base_id",
      "type": "n8n-nodes-base.redisTool",
      "position": [
        -624,
        2176
      ],
      "parameters": {
        "key": "=base_id",
        "options": {},
        "operation": "get",
        "propertyName": "BaseID",
        "descriptionType": "manual",
        "toolDescription": "Get Base ID"
      },
      "credentials": {
        "redis": {
          "id": "TGXwMeCNAC8NdQNU",
          "name": "Redis account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "f6a1c55c-8cae-424d-a947-877903f614ad",
      "name": "set_base_id",
      "type": "n8n-nodes-base.redisTool",
      "position": [
        -768,
        2176
      ],
      "parameters": {
        "key": "=base_id",
        "value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Value', `Store Base ID`, 'string') }}",
        "operation": "set",
        "descriptionType": "manual",
        "toolDescription": "Store Base ID"
      },
      "credentials": {
        "redis": {
          "id": "TGXwMeCNAC8NdQNU",
          "name": "Redis account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "548aaf33-852a-4bf7-bea8-a1b964b522b0",
      "name": "rename_fields",
      "type": "n8n-nodes-base.httpRequestTool",
      "position": [
        -1120,
        1568
      ],
      "parameters": {
        "url": "=https://api.airtable.com/v0/meta/bases/{{ $fromAI('base_id') }}/tables/{{ $fromAI('table_id') }}/fields/{{ $fromAI('field_id') }}",
        "method": "PATCH",
        "options": {},
        "jsonBody": "={\"name\": \"{{ $fromAI('new_field_name') }}\", \"description\": \"{{ $fromAI('description') }}\"}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "predefinedCredentialType",
        "toolDescription": "Rename a field/column in a table. Requires base_id, table_id, field_id, and new_name",
        "nodeCredentialType": "airtableTokenApi"
      },
      "credentials": {
        "airtableTokenApi": {
          "id": "wmXRN8LPtIYfZqS2",
          "name": "Airtable N8N"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "74eeee0e-0f2d-42b5-8248-925a3818fac8",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2320,
        800
      ],
      "parameters": {
        "color": 7,
        "width": 432,
        "height": 2128,
        "content": "## 📌 AIRTABLE ID 指南"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "MCP Client": {
      "ai_tool": [
        [
          {
            "node": "Airtable Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "gpt-5-mini": {
      "ai_languageModel": [
        [
          {
            "node": "Airtable Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "create_base": {
      "ai_tool": [
        [
          {
            "node": "MCP Server Trigger",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "get_base_id": {
      "ai_tool": [
        [
          {
            "node": "Airtable Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "set_base_id": {
      "ai_tool": [
        [
          {
            "node": "Airtable Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "rename_table": {
      "ai_tool": [
        [
          {
            "node": "MCP Server Trigger",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "create_record": {
      "ai_tool": [
        [
          {
            "node": "MCP Server Trigger",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "delete_record": {
      "ai_tool": [
        [
          {
            "node": "MCP Server Trigger",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "get_table_ids": {
      "ai_tool": [
        [
          {
            "node": "MCP Server Trigger",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "rename_fields": {
      "ai_tool": [
        [
          {
            "node": "MCP Server Trigger",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "update_record": {
      "ai_tool": [
        [
          {
            "node": "MCP Server Trigger",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Airtable Agent": {
      "main": [
        []
      ]
    },
    "get_workspace_id": {
      "ai_tool": [
        [
          {
            "node": "Airtable Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "set_workspace_id": {
      "ai_tool": [
        [
          {
            "node": "Airtable Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Redis Chat Memory": {
      "ai_memory": [
        [
          {
            "node": "Airtable Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "create_custom_table": {
      "ai_tool": [
        [
          {
            "node": "MCP Server Trigger",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "get_existing_records": {
      "ai_tool": [
        [
          {
            "node": "MCP Server Trigger",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "Airtable Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级 - AI RAG 检索增强, 多模态 AI

需要付费吗?

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

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

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

外部链接
在 n8n.io 查看

分享此工作流