8
n8n 中文网amn8n.com

使用 Airtable、Gmail 和 OpenAI 自动回复客户邮件

中级

这是一个Ticket Management, AI Chatbot领域的自动化工作流,包含 12 个节点。主要使用 Gmail, Airtable, GmailTrigger, Agent, LmChatOpenAi 等节点。 使用 Airtable、Gmail 和 GPT-4.1 Mini 自动回复客户邮件

前置要求
  • Google 账号和 Gmail API 凭证
  • Airtable API Key
  • OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "GcjeYFWFTeThFDR3",
  "meta": {
    "instanceId": "18b0d04ad5030054be4ab49562e84ea4a079ab4cb036003697394140227c7e76",
    "templateId": "6287",
    "templateCredsSetupCompleted": true
  },
  "name": "使用 Airtable、Gmail 和 OpenAI 自动回复客户邮件",
  "tags": [],
  "nodes": [
    {
      "id": "91c45a87-a5e7-4446-ad36-52b779a04ff5",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1680,
        704
      ],
      "parameters": {
        "text": "=Tu es un agent support IA pour une solution SaaS B2B utilisée par des milliers d’entreprises.\nTu reçois énormément d’emails de clients et prospects tous les jours : demandes de devis, questions techniques, soucis de facturation, bugs, demandes d’infos sur les fonctionnalités.\nTon rôle est d’y répondre rapidement avec un style naturel, amical, clair, technique et très concis.\n\nStyle de réponse\n\nLa réponse doit être très très courte (juste l’essentiel, pas de bla-bla inutile).\n\nAdapte-toi au ton du client :\n\nSi le client tutoie, tu le tutoies.\n\nSi le client vouvoie, tu le vouvoies.\n\nSois amical et humain (comme si tu écrivais à un collègue).\n\nSois technique quand il faut (donne étapes précises ou solutions directes).\n\nToujours répondre point par point au contenu exact du mail reçu.\n\nSi une info manque, pose 1 seule question claire pour avancer.\n\nStructure de la réponse\n\nAccroche personnalisée → dire bonjour avec le prénom si possible.\n\nAccusé de réception → montrer que tu as bien compris sa demande.\n\nRéponse concrète → donner directement la solution ou la prochaine étape.\n\nNext step → proposer une action simple (test, lien, précision à donner).\n\nClôture amicale → courte, sympa.\n\n\nID {{ $json.id }}\n\nTHREAD ID {{ $json.threadId }}\n\nSNIPPET {{ $json.snippet }}\n\nEMAIL {{ $json.From }}\n\nSUJET {{ $json.Subject }}\n\n\nvoici le lien du reset mdp : https://www.0vni.fr/",
        "options": {},
        "promptType": "define"
      },
      "typeVersion": 2.2
    },
    {
      "id": "f10f7b53-8918-4c90-b7e8-8b573c01e78f",
      "name": "收到邮件",
      "type": "n8n-nodes-base.gmailTrigger",
      "position": [
        1296,
        704
      ],
      "parameters": {
        "filters": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        }
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "RpkU3PW6jAmCX8ih",
          "name": "Gmail account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "222701be-af4e-441a-8c95-199c631c331a",
      "name": "已向客户发送 GPT4.1 MINI 回复",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1648,
        880
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "eDzFw4LYXVKJQcfH",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "4972ea0f-8d5e-48eb-bb42-f00017a9d2ad",
      "name": "保存到 Airtable",
      "type": "n8n-nodes-base.airtable",
      "position": [
        2160,
        704
      ],
      "parameters": {
        "base": {
          "__rl": true,
          "mode": "list",
          "value": "appSgOTP5wQ6AM0X2",
          "cachedResultUrl": "https://airtable.com/appSgOTP5wQ6AM0X2",
          "cachedResultName": "BASE AGENT IA EMAIL"
        },
        "table": {
          "__rl": true,
          "mode": "list",
          "value": "tbl4i0bKynEypdgtn",
          "cachedResultUrl": "https://airtable.com/appSgOTP5wQ6AM0X2/tbl4i0bKynEypdgtn",
          "cachedResultName": "Email Support Logs"
        },
        "columns": {
          "value": {
            "Message": "={{ $('Email Reçu').item.json.snippet }}",
            "Subject": "={{ $('Email Reçu').item.json.Subject }}",
            "AI Response": "={{ $('AI Agent').item.json.output }}",
            "Customer Email": "={{ $('Email Reçu').item.json.From }}"
          },
          "schema": [
            {
              "id": "Subject",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Subject",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Date",
              "type": "dateTime",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Customer Email",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Customer Email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Message",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Message",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "AI Response",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "AI Response",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "create"
      },
      "credentials": {
        "airtableTokenApi": {
          "id": "vKZ5Wl43rmNFe0My",
          "name": "Airtable Personal Access Token account 3"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "3ae5bac1-4774-4daa-b516-a50492c5b3bc",
      "name": "回复客户",
      "type": "n8n-nodes-base.gmail",
      "position": [
        2592,
        704
      ],
      "webhookId": "f0ee3e32-5358-4869-99df-fb5779e21ae9",
      "parameters": {
        "message": "={{ $json.fields['AI Response'] }}",
        "options": {},
        "resource": "thread",
        "threadId": "={{ $('Email Reçu').item.json.id }}",
        "messageId": "={{ $('Email Reçu').item.json.id }}",
        "operation": "reply"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "RpkU3PW6jAmCX8ih",
          "name": "Gmail account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "d7d830d1-ea78-41f6-8261-aea5c7fb4dd4",
      "name": "对话记忆",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        1840,
        880
      ],
      "parameters": {
        "sessionKey": "={{ $('Email Reçu').item.json.id }}",
        "sessionIdType": "customKey"
      },
      "typeVersion": 1.3
    },
    {
      "id": "a7c1d4db-0539-4db9-8f98-59e250645e17",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        272,
        112
      ],
      "parameters": {
        "width": 928,
        "height": 912,
        "content": "# 使用 n8n、Airtable、Gmail 和 OpenAI 自动回复客户邮件"
      },
      "typeVersion": 1
    },
    {
      "id": "77461e99-0aab-4126-8019-424058945361",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1200,
        -560
      ],
      "parameters": {
        "color": 6,
        "width": 384,
        "height": 1584,
        "content": "## 1. 在 n8n 中设置 Gmail 触发器"
      },
      "typeVersion": 1
    },
    {
      "id": "f1d51f68-15fb-47b6-9ce2-0c64c1c41042",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1584,
        -560
      ],
      "parameters": {
        "color": 7,
        "width": 384,
        "height": 1584,
        "content": "## 2. 在 n8n 中设置 AI Agent"
      },
      "typeVersion": 1
    },
    {
      "id": "cce445a1-0b91-4533-9e6a-b7ecff97d9a0",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1968,
        -560
      ],
      "parameters": {
        "color": 5,
        "width": 496,
        "height": 1584,
        "content": "## 3. 在 Airtable 中保存邮件和回复"
      },
      "typeVersion": 1
    },
    {
      "id": "41d75e25-18db-4d52-bf1f-3799268e75b4",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2464,
        -560
      ],
      "parameters": {
        "color": 6,
        "width": 352,
        "height": 1584,
        "content": "## 4. 在 Gmail 中自动回复客户"
      },
      "typeVersion": 1
    },
    {
      "id": "bec8bbf3-c691-43bb-bb7e-b3e8dfcd7a1e",
      "name": "便签5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        272,
        -352
      ],
      "parameters": {
        "width": 928,
        "height": 464,
        "content": "![我的 Airtable 数据库](https://i.ibb.co/yF2XD9Jh/Base-airtable.png)"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {},
  "versionId": "62a88b6b-abfb-4cd9-b916-6ae73fd43efe",
  "connections": {
    "AI Agent": {
      "main": [
        [
          {
            "node": "Sauvegarde dans Airtable",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Email Reçu": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Sauvegarde dans Airtable": {
      "main": [
        [
          {
            "node": "Répondre au Client",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Mémoire des Conversations": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Réponse envoyée au client GPT4.1 MINI": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 工单管理, AI 聊天机器人

需要付费吗?

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

工作流信息
难度等级
中级
节点数量12
分类2
节点类型7
难度说明

适合有一定经验的用户,包含 6-15 个节点的中等复杂度工作流

作者
Baptiste Fort

Baptiste Fort

@baptistefort

Baptiste.fort.pro@gmail.com

外部链接
在 n8n.io 查看

分享此工作流