E-Mail-Zusammenfassung

Fortgeschritten

Dies ist ein Personal Productivity, AI Summarization-Bereich Automatisierungsworkflow mit 11 Nodes. Hauptsächlich werden If, Code, Gmail, Limit, GoogleDocs und andere Nodes verwendet. Tägliche E-Mail-Zusammenfassung mit GPT-4-Zusammenfassung in Google Docs

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
{
  "id": "p5e76vbOIDIaf29H",
  "meta": {
    "instanceId": "6304e8877aa0fde3913b14034debe07006963fb497d63f280a91bbd75c6c24e1",
    "templateCredsSetupCompleted": true
  },
  "name": "Email Summary",
  "tags": [
    {
      "id": "TNPHEZ52JXA88tV0",
      "name": "AI",
      "createdAt": "2025-06-28T18:46:13.842Z",
      "updatedAt": "2025-06-28T18:46:13.842Z"
    },
    {
      "id": "pD2RVg49fBlIR8pA",
      "name": "Gmail",
      "createdAt": "2025-06-28T19:24:47.979Z",
      "updatedAt": "2025-06-28T19:24:47.979Z"
    },
    {
      "id": "wZ14hcyo2pYAOVlF",
      "name": "OpenAI",
      "createdAt": "2025-06-28T18:46:13.462Z",
      "updatedAt": "2025-06-28T18:46:13.462Z"
    },
    {
      "id": "M3TlU8Xdj7ZlK0PE",
      "name": "Project Management",
      "createdAt": "2025-06-28T18:46:13.681Z",
      "updatedAt": "2025-06-28T18:46:13.681Z"
    },
    {
      "id": "bpJw62xLnDDElGob",
      "name": "Building blocks",
      "createdAt": "2025-06-28T18:46:13.530Z",
      "updatedAt": "2025-06-28T18:46:13.530Z"
    },
    {
      "id": "3nY5Wk7HNEt9e9gW",
      "name": "DevOps",
      "createdAt": "2025-06-28T18:46:13.916Z",
      "updatedAt": "2025-06-28T18:46:13.916Z"
    },
    {
      "id": "1Z9wnauckk6RWoYl",
      "name": "Email",
      "createdAt": "2025-07-19T17:42:50.746Z",
      "updatedAt": "2025-07-19T17:42:50.746Z"
    }
  ],
  "nodes": [
    {
      "id": "10e1dc39-0561-4bfd-b80f-e60a91af3cb5",
      "name": "Haftnotiz",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -80,
        -60
      ],
      "parameters": {
        "width": 1880,
        "height": 460,
        "content": "Telegram Email Summary Workflow"
      },
      "typeVersion": 1
    },
    {
      "id": "ef07131c-2d2c-42ed-a1de-7e5625c8057c",
      "name": "Haftnotiz1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -80,
        -720
      ],
      "parameters": {
        "color": 3,
        "width": 580,
        "height": 640,
        "content": "Email Summary Workflow:\n\nThis n8n workflow automatically summarizes the latest email in your inbox and saves the summary to a Google Doc. It's designed as a simple, modular starting point that users can easily expand or customize.\n\nHow It Works\n- Trigger: A Schedule Trigger runs the workflow daily at 8 AM.\n\n- Get Email: The Gmail node fetches the most recent email.\n\n- Limit: Only the most recent email is passed through.\n\n- Check for New Email: An IF node determines whether a new email was found.\n\nIf yes, the email content is cleaned (HTML stripped, base64 decoded).\n\nIf no, a fallback message is created noting there are no new emails.\n\n- Summarization: The content is passed to OpenAI with a detailed prompt to summarize:\n\nSender\nDate\nSubject\nMain points, requests, and action items\n\n- Google Docs Output:\nA new Google Doc titled Email Summary is created (or reused).\nThe summary is inserted into the document for future reference.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "28c3ca0d-9397-41e3-b8b9-13a577e0ca98",
      "name": "Zeitplan-Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -40,
        100
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtHour": 8
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "da1aaa80-87a6-4d98-b14f-e08e327553bc",
      "name": "Begrenzen",
      "type": "n8n-nodes-base.limit",
      "position": [
        340,
        100
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "54653ec9-413f-4656-955c-3dcaacdee6cf",
      "name": "If",
      "type": "n8n-nodes-base.if",
      "position": [
        540,
        100
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "621c437c-e857-4e21-9aa6-ed75ae360775",
              "operator": {
                "type": "string",
                "operation": "notEquals"
              },
              "leftValue": "={{ $('Get Gmail').item.json.headers.from }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "f6b7ea0d-b521-459d-856c-f39a26962356",
      "name": "E-Mail",
      "type": "n8n-nodes-base.code",
      "position": [
        800,
        0
      ],
      "parameters": {
        "jsCode": "// This function will strip out HTML tags to leave only the plain text.\nfunction extractCleanText(html) {\n  if (!html) {\n    return '';\n  }\n  // A regular expression to remove HTML tags and extra whitespace.\n  return html.replace(/<[^>]*>/g, \"\").replace(/\\s+/g, ' ').trim();\n}\n\n// Process each email item passed to the node.\nreturn $input.all().map(item => {\n  const payload = item.json.payload || {};\n  const headers = payload.headers || [];\n  \n  // A helper function to find a specific header's value.\n  const getHeader = (name) => headers.find(h => h.name.toLowerCase() === name.toLowerCase())?.value || 'N/A';\n\n  const from = getHeader('From');\n  const subject = getHeader('Subject');\n  const date = getHeader('Date');\n\n  let bodyData = '';\n  // Check for multipart emails first.\n  if (payload.parts) {\n    // Prefer plain text over HTML for simplicity.\n    const plainPart = payload.parts.find(p => p.mimeType === 'text/plain');\n    const htmlPart = payload.parts.find(p => p.mimeType === 'text/html');\n    \n    // Use the data from the preferred part.\n    if (plainPart && plainPart.body && plainPart.body.data) {\n      bodyData = plainPart.body.data;\n    } else if (htmlPart && htmlPart.body && htmlPart.body.data) {\n      bodyData = htmlPart.body.data;\n    }\n  } else if (payload.body && payload.body.data) {\n    // Fallback for single-part emails.\n    bodyData = payload.body.data;\n  }\n\n  // The body content is Base64 encoded, so it needs to be decoded.\n  const decodedBody = Buffer.from(bodyData, 'base64').toString('utf-8');\n  \n  // Clean the decoded body to remove any lingering HTML.\n  const cleanBody = extractCleanText(decodedBody);\n\n  return {\n    json: {\n      from,\n      subject,\n      date,\n      body: cleanBody\n    }\n  };\n});"
      },
      "typeVersion": 2
    },
    {
      "id": "6967e64d-32ac-4981-969b-76719d0b0377",
      "name": "No E-Mail",
      "type": "n8n-nodes-base.code",
      "position": [
        800,
        240
      ],
      "parameters": {
        "jsCode": "return [\n  {\n    json: {\n      from: \"N/A\",\n      subject: \"No Email Found\",\n      date: new Date().toISOString(),\n      body: \"No new emails were found during this summary check. There is nothing to summarize at this time.\"\n    }\n  }\n];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "a0e30b66-7329-4731-9401-5896855a7a22",
      "name": "Get Gmail",
      "type": "n8n-nodes-base.gmail",
      "position": [
        160,
        100
      ],
      "webhookId": "efcd3ee6-26a7-4c3d-84c2-c1cdef8a8d7c",
      "parameters": {
        "limit": 1,
        "simple": false,
        "filters": {},
        "options": {},
        "operation": "getAll"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "B0oVer8pX52LHrvw",
          "name": "Gmail account 2"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "a931d85d-40ea-4bde-a0aa-8f9a7ef14c04",
      "name": "Summary E-Mail OpenAI",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        1060,
        120
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1",
          "cachedResultName": "GPT-4.1"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "content": "=You are a professional AI assistant tasked with summarizing the most recent email received.\n\nYour goal is to deliver a clear, concise, and accurate summary that saves the user time by eliminating the need to read the full email. The summary should convey all essential details and maintain a professional tone.\n\nPlease include the following in your response:\n\nSender's name and email address: {{ $('Get Gmail').item.json.headers.from }}\n\nDate and time received: {{ $('Get Gmail').item.json.headers.date }}\n\nSubject line (if available): {{ $('Get Gmail').item.json.headers.subject }}\n\nMain purpose or topic of the email\n\nKey points, requests, or required actions\n\nAny additional relevant context that helps the user understand the email at a glance\n\nAvoid unnecessary repetition or filler. The summary should be easy to scan, but detailed enough that the user can fully understand the message without opening the original email.\n\nSummarize the following content:\n\n{{ $('Get Gmail').item.json.text }}"
            }
          ]
        },
        "simplify": false
      },
      "credentials": {
        "openAiApi": {
          "id": "Yks1Eic3YR07Cpm6",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "537c41f8-5cea-46d6-92a9-a2cffdd65bb2",
      "name": "Create Google Docs",
      "type": "n8n-nodes-base.googleDocs",
      "position": [
        1420,
        120
      ],
      "parameters": {
        "title": "Email Summary",
        "folderId": "1ihoRENubwDmcwMqhFzbdnfuYQdU2YXVR"
      },
      "credentials": {
        "googleDocsOAuth2Api": {
          "id": "dSGiWWxQdhY5ywpg",
          "name": "Google Docs account"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "96ca547a-cb62-4eef-a9dc-765654c13e1d",
      "name": "Update Google Docs",
      "type": "n8n-nodes-base.googleDocs",
      "position": [
        1620,
        120
      ],
      "parameters": {
        "simple": false,
        "actionsUi": {
          "actionFields": [
            {
              "text": "={{ $('Summary Email OpenAI').item.json.choices[0].message.content }}",
              "action": "insert"
            }
          ]
        },
        "operation": "update",
        "documentURL": "={{ $json.id }}"
      },
      "credentials": {
        "googleDocsOAuth2Api": {
          "id": "dSGiWWxQdhY5ywpg",
          "name": "Google Docs account"
        }
      },
      "typeVersion": 2
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "bf63aae4-7580-4cb7-93ab-9631974dc104",
  "connections": {
    "54653ec9-413f-4656-955c-3dcaacdee6cf": {
      "main": [
        [
          {
            "node": "Email",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "No Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Email": {
      "main": [
        [
          {
            "node": "Summary Email OpenAI",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Limit": {
      "main": [
        [
          {
            "node": "54653ec9-413f-4656-955c-3dcaacdee6cf",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "No Email": {
      "main": [
        [
          {
            "node": "Summary Email OpenAI",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "a0e30b66-7329-4731-9401-5896855a7a22": {
      "main": [
        [
          {
            "node": "Limit",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "a0e30b66-7329-4731-9401-5896855a7a22",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "537c41f8-5cea-46d6-92a9-a2cffdd65bb2": {
      "main": [
        [
          {
            "node": "96ca547a-cb62-4eef-a9dc-765654c13e1d",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Summary Email OpenAI": {
      "main": [
        [
          {
            "node": "537c41f8-5cea-46d6-92a9-a2cffdd65bb2",
            "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 - Persönliche Produktivität, KI-Zusammenfassung

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
Kategorie2
Node-Typen8
Schwierigkeitsbeschreibung

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

Autor
Michael Gullo

Michael Gullo

@drdoom

I’m passionate about using n8n to create realistic workflows that help working class people simplify their daily tasks. My workflows aim to make life easier by eliminating mundane, repetitive responsibilities that take up valuable time. I love turning automation into a tool that lets people focus on what matters most to them.

Externe Links
Auf n8n.io ansehen

Diesen Workflow teilen

Kategorien

Kategorien: 34