Gmail KI automatische Antworten

Fortgeschritten

Dies ist ein Multimodal AI-Bereich Automatisierungsworkflow mit 11 Nodes. Hauptsächlich werden If, Set, Gmail, GmailTrigger, Agent und andere Nodes verwendet. Gmail-Antwortgenerator mit GPT-4o-mini

Voraussetzungen
  • Google-Konto + Gmail API-Anmeldedaten
  • OpenAI API Key
Workflow-Vorschau
Visualisierung der Node-Verbindungen, mit Zoom und Pan
Workflow exportieren
Kopieren Sie die folgende JSON-Konfiguration und importieren Sie sie in n8n
{
  "name": "Gmail Auto-Reply with AI",
  "tags": [],
  "nodes": [
    {
      "id": "50972917-6da6-4b55-b18b-0bd96445e9f8",
      "name": "Trigger bei neuer E-Mail",
      "type": "n8n-nodes-base.gmailTrigger",
      "position": [
        0,
        -352
      ],
      "parameters": {
        "filters": {
          "readStatus": "unread"
        },
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "f42bb871-a182-4708-aa12-65f6c9c5ee28",
      "name": "Ungelesene E-Mail abrufen",
      "type": "n8n-nodes-base.gmail",
      "position": [
        224,
        -352
      ],
      "parameters": {
        "simple": false,
        "options": {},
        "messageId": "={{ $json.id }}",
        "operation": "get"
      },
      "typeVersion": 2.1
    },
    {
      "id": "c0ce4d37-a5ce-4926-9edf-5aa68d80426a",
      "name": "Erforderliche Felder abrufen",
      "type": "n8n-nodes-base.set",
      "position": [
        448,
        -352
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "name": "threadId",
              "type": "string",
              "value": "={{ $json.threadId }}"
            },
            {
              "name": "id",
              "type": "string",
              "value": "={{ $json.id }}"
            },
            {
              "name": "From",
              "type": "string",
              "value": "={{ $json.headers.from }}"
            },
            {
              "name": "message",
              "type": "string",
              "value": "={{ $json.text }}"
            },
            {
              "name": "subject",
              "type": "string",
              "value": "={{ $json.subject }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "64d9c2c7-0ef8-49f2-9c6c-5b0aabd27112",
      "name": "KI-Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        672,
        -352
      ],
      "parameters": {
        "text": "=You are an assistant that helps draft email replies.\n\nYour task:\n1. Read the email message below:\n\"{{ $json.message }}\"\n\n2. Decide if this is an email that requires a reply.  \n   - If it's spam, a notification, or irrelevant, set `isReply` to false.  \n   - If it's a genuine message that can be replied to, set `isReply` to true.  \n\n3. If `isReply` is true, draft a short and polite reply that:  \n   - Acknowledges the sender.  \n   - Is under 120 words.  \n   - Does not promise action you cannot take.  \n\n4. Return the result **only in valid JSON**, no extra text.\n\nJSON format to return:\n{\n  \"isReply\": true | false,\n  \"response\": \"string or empty if isReply is false\"\n}",
        "options": {},
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "5673e94b-82b0-407f-9db4-60b35dfb8253",
      "name": "OpenAI",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        680,
        -128
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini",
          "cachedResultName": "gpt-4o-mini"
        },
        "options": {}
      },
      "typeVersion": 1.2
    },
    {
      "id": "00fe0a38-cc10-492e-86d6-af0494c8afc9",
      "name": "Strukturierte Ausgabe",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        808,
        -128
      ],
      "parameters": {
        "schemaType": "manual",
        "inputSchema": "{\n  \"type\": \"object\",\n  \"properties\": {\n    \"isReply\": {\n      \"type\": \"boolean\",\n      \"description\": \"Whether the email requires a reply\"\n    },\n    \"response\": {\n      \"type\": \"string\",\n      \"description\": \"The drafted reply text if isReply is true, otherwise empty\"\n    }\n  },\n  \"required\": [\"isReply\", \"response\"]\n}\n"
      },
      "typeVersion": 1.3
    },
    {
      "id": "7fd55349-a8a3-4c1b-8dc8-221a50915a5e",
      "name": "Kann KI-Agent antworten?",
      "type": "n8n-nodes-base.if",
      "position": [
        1024,
        -352
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "loose"
          },
          "combinator": "and",
          "conditions": [
            {
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.output.isReply }}",
              "rightValue": "true"
            }
          ]
        },
        "looseTypeValidation": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "ba0480ca-4f1d-4813-b6d8-674ec1f2bafe",
      "name": "Entwurf erstellen",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1248,
        -352
      ],
      "parameters": {
        "message": "={{ $json.output.response }}",
        "options": {
          "threadId": "={{ $('Get Required Fields').item.json.threadId }}"
        },
        "subject": "={{ $('Get Required Fields').item.json.subject }}",
        "resource": "draft"
      },
      "typeVersion": 2.1
    },
    {
      "id": "be177f90-54e7-472f-8b30-3dd6c8c1f4a3",
      "name": "E-Mail als \"Aktion\" kennzeichnen",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1472,
        -352
      ],
      "parameters": {
        "labelIds": [
          "Label_4601850039988562325"
        ],
        "resource": "thread",
        "threadId": "={{ $('Get Required Fields').item.json.threadId }}",
        "operation": "addLabels"
      },
      "typeVersion": 2.1
    },
    {
      "id": "434ebfe4-410a-4f49-9285-cfd6256abb6f",
      "name": "Haftnotiz",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -192,
        0
      ],
      "parameters": {
        "width": 336,
        "content": "## 🛠️ Setup Instructions\n  - Connect Gmail and OpenAI credentials before activating.\n  - Make sure your Gmail has a label called `Action`."
      },
      "typeVersion": 1
    },
    {
      "id": "77831399-3e74-454e-8e27-b9d6e2af638c",
      "name": "Haftnotiz1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        608,
        -576
      ],
      "parameters": {
        "color": 5,
        "width": 368,
        "height": 656,
        "content": "## ⚠️ Reply Logic\n  - AI won't reply to spam, notifications, or irrelevant messages.\n  - Only genuine messages get responses. You can review drafts before sending.\n  - Tweak the AI agent's prompt to match your brand voice."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "connections": {
    "5673e94b-82b0-407f-9db4-60b35dfb8253": {
      "ai_languageModel": [
        [
          {
            "node": "64d9c2c7-0ef8-49f2-9c6c-5b0aabd27112",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "64d9c2c7-0ef8-49f2-9c6c-5b0aabd27112": {
      "main": [
        [
          {
            "node": "7fd55349-a8a3-4c1b-8dc8-221a50915a5e",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ba0480ca-4f1d-4813-b6d8-674ec1f2bafe": {
      "main": [
        [
          {
            "node": "be177f90-54e7-472f-8b30-3dd6c8c1f4a3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "f42bb871-a182-4708-aa12-65f6c9c5ee28": {
      "main": [
        [
          {
            "node": "c0ce4d37-a5ce-4926-9edf-5aa68d80426a",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "00fe0a38-cc10-492e-86d6-af0494c8afc9": {
      "ai_outputParser": [
        [
          {
            "node": "64d9c2c7-0ef8-49f2-9c6c-5b0aabd27112",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "c0ce4d37-a5ce-4926-9edf-5aa68d80426a": {
      "main": [
        [
          {
            "node": "64d9c2c7-0ef8-49f2-9c6c-5b0aabd27112",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "50972917-6da6-4b55-b18b-0bd96445e9f8": {
      "main": [
        [
          {
            "node": "f42bb871-a182-4708-aa12-65f6c9c5ee28",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "7fd55349-a8a3-4c1b-8dc8-221a50915a5e": {
      "main": [
        [
          {
            "node": "ba0480ca-4f1d-4813-b6d8-674ec1f2bafe",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Häufig gestellte Fragen

Wie verwende ich diesen Workflow?

Kopieren Sie den obigen JSON-Code, erstellen Sie einen neuen Workflow in Ihrer n8n-Instanz und wählen Sie "Aus JSON importieren". Fügen Sie die Konfiguration ein und passen Sie die Anmeldedaten nach Bedarf an.

Für welche Szenarien ist dieser Workflow geeignet?

Fortgeschritten - Multimodales KI

Ist es kostenpflichtig?

Dieser Workflow ist völlig kostenlos. Beachten Sie jedoch, dass Drittanbieterdienste (wie OpenAI API), die im Workflow verwendet werden, möglicherweise kostenpflichtig sind.

Workflow-Informationen
Schwierigkeitsgrad
Fortgeschritten
Anzahl der Nodes11
Kategorie1
Node-Typen8
Schwierigkeitsbeschreibung

Für erfahrene Benutzer, mittelkomplexe Workflows mit 6-15 Nodes

Autor
Matt Chong | n8n Creator

Matt Chong | n8n Creator

@mattxchong

Automation nerd fueled by good coffee, deep curiosity, and clean flows.

Externe Links
Auf n8n.io ansehen

Diesen Workflow teilen

Kategorien

Kategorien: 34