Täglicher E-Mail-Zusammenfassungs- und Zusammenfassungs-Bot

Fortgeschritten

Dies ist ein Automatisierungsworkflow mit 14 Nodes. Hauptsächlich werden If, Code, Gmail, Slack, Aggregate und andere Nodes verwendet. Automatischer E-Mail-Zusammenfassung von Gmail zu Slack mit GPT-4o-Zusammenfassung

Voraussetzungen
  • Google-Konto + Gmail API-Anmeldedaten
  • Slack Bot Token oder Webhook URL

Kategorie

-
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": "pjLIqJYyE8diFDeq",
  "meta": {
    "instanceId": "7036f994fcf077f382ea0edc134b49e1ce0556fa914b12051651961e7fbc3600",
    "templateCredsSetupCompleted": true
  },
  "name": "Daily Email Digest and Summary Bot",
  "tags": [],
  "nodes": [
    {
      "id": "b098a164-6c8a-4d51-9876-cfbde2e5da76",
      "name": "Zeitplan-Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -32,
        272
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "cronExpression",
              "expression": "0 0 8 * * *"
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "2aa30690-0b1b-49eb-bae4-eb3c48bc840c",
      "name": "Haftnotiz",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -96,
        -80
      ],
      "parameters": {
        "height": 304,
        "content": "## Daily Email Digest Workflow\nThis workflow runs daily at 8 AM to analyze yesterday's emails and send a summary to Slack.\n\n**Setup Required:**\n- Configure Gmail credentials\n- Configure Slack credentials\n- Adjust schedule time if needed"
      },
      "typeVersion": 1
    },
    {
      "id": "90dcdae6-5d2b-496f-8774-ee8d377bbd5a",
      "name": "Gmail - Get Yesterday's E-Mails",
      "type": "n8n-nodes-base.gmail",
      "position": [
        192,
        272
      ],
      "webhookId": "98420742-a7f3-4dde-8070-95c939a516a2",
      "parameters": {
        "filters": {
          "receivedAfter": "={{ $now.minus({days: 1}).startOf('day').toISO() }}",
          "receivedBefore": "={{ $now.startOf('day').toISO() }}"
        },
        "operation": "getAll"
      },
      "typeVersion": 2.1
    },
    {
      "id": "96501595-c231-4d53-b028-cbe0915b0a5c",
      "name": "Haftnotiz1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        128,
        464
      ],
      "parameters": {
        "color": 7,
        "height": 256,
        "content": "## Gmail Configuration\nRetrieves all emails from the previous day (midnight to midnight).\n\n**Credentials needed:**\n- Gmail OAuth2 connection\n- Grant necessary permissions for reading emails"
      },
      "typeVersion": 1
    },
    {
      "id": "5fa53f71-b724-489b-8492-767fdd972a26",
      "name": "KI-Agent - Analyze Emails",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        864,
        176
      ],
      "parameters": {
        "text": "=Analyze these emails from yesterday and create a concise daily digest summary:\n\nEmails to analyze:\n{{ JSON.stringify($json) }}\n\nCreate a structured summary that includes:\n1. Total number of emails received\n2. Important/urgent emails (if any)\n3. Key messages grouped by sender or topic\n4. Action items or requests that need attention\n5. Brief overview of main topics discussed\n\nFormat the output as a clean, readable summary suitable for Slack.",
        "options": {
          "systemMessage": "You are an intelligent email assistant that analyzes emails and creates concise, well-organized daily digest summaries. Focus on extracting the most important information, action items, and key messages. Group related emails together and highlight urgent matters. Keep the summary concise but comprehensive."
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 2
    },
    {
      "id": "888291d6-3791-4a85-bfba-39d00acced61",
      "name": "OpenRouter Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        864,
        400
      ],
      "parameters": {
        "model": "openai/gpt-4o-mini",
        "options": {
          "maxTokens": 2000,
          "temperature": 0.3
        }
      },
      "typeVersion": 1
    },
    {
      "id": "23577fe9-3338-4167-9edf-0acc4a77c5a0",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        1008,
        400
      ],
      "parameters": {
        "schemaType": "manual",
        "inputSchema": "{\n  \"type\": \"object\",\n  \"properties\": {\n    \"summary\": {\n      \"type\": \"string\",\n      \"description\": \"The complete daily email digest summary formatted for Slack\"\n    },\n    \"emailCount\": {\n      \"type\": \"number\",\n      \"description\": \"Total number of emails analyzed\"\n    },\n    \"urgentItems\": {\n      \"type\": \"array\",\n      \"description\": \"List of urgent or important items\",\n      \"items\": {\n        \"type\": \"string\"\n      }\n    },\n    \"actionItems\": {\n      \"type\": \"array\",\n      \"description\": \"List of action items or tasks\",\n      \"items\": {\n        \"type\": \"string\"\n      }\n    }\n  },\n  \"required\": [\"summary\", \"emailCount\"]\n}"
      },
      "typeVersion": 1.2
    },
    {
      "id": "d0ad860d-14d4-47f2-afef-4922e3bdf53e",
      "name": "Haftnotiz2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        864,
        560
      ],
      "parameters": {
        "color": 7,
        "height": 240,
        "content": "## AI Processing\nThe AI Agent analyzes all emails from yesterday and creates a structured summary.\n\n**OpenRouter Credentials needed:**\n- API key from OpenRouter\n- Model: GPT-4o-mini for cost efficiency"
      },
      "typeVersion": 1
    },
    {
      "id": "ec852ebf-1b9a-43a5-90c1-9f972bc101ad",
      "name": "Format for Slack",
      "type": "n8n-nodes-base.code",
      "position": [
        1216,
        176
      ],
      "parameters": {
        "jsCode": "// Format the AI summary for Slack\nconst output = $input.first().json.output;\nconst today = new Date().toLocaleDateString('en-US', { \n  weekday: 'long', \n  year: 'numeric', \n  month: 'long', \n  day: 'numeric' \n});\n\nlet slackMessage = `:email: *Daily Email Digest for ${today}*\\n\\n`;\nslackMessage += `*Total Emails Analyzed:* ${output.emailCount}\\n\\n`;\n\nif (output.urgentItems && output.urgentItems.length > 0) {\n  slackMessage += `:warning: *Urgent Items:*\\n`;\n  output.urgentItems.forEach(item => {\n    slackMessage += `• ${item}\\n`;\n  });\n  slackMessage += `\\n`;\n}\n\nif (output.actionItems && output.actionItems.length > 0) {\n  slackMessage += `:clipboard: *Action Items:*\\n`;\n  output.actionItems.forEach(item => {\n    slackMessage += `• ${item}\\n`;\n  });\n  slackMessage += `\\n`;\n}\n\nslackMessage += `:memo: *Summary:*\\n${output.summary}`;\n\nreturn {\n  message: slackMessage,\n  emailCount: output.emailCount\n};"
      },
      "typeVersion": 2
    },
    {
      "id": "1e20a30b-a265-47ac-850a-1b4ff962e271",
      "name": "Slack - Send Summary",
      "type": "n8n-nodes-base.slack",
      "position": [
        1440,
        176
      ],
      "webhookId": "970ab742-56bc-451d-9e29-85971c4d5328",
      "parameters": {
        "text": "={{ $json.message }}",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": "C09L12N8F45",
          "cachedResultName": "test"
        },
        "otherOptions": {},
        "authentication": "oAuth2"
      },
      "typeVersion": 2.2
    },
    {
      "id": "4f1132de-0ac8-49e1-a0c5-a4dbff364a08",
      "name": "Haftnotiz3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1376,
        336
      ],
      "parameters": {
        "color": 7,
        "height": 352,
        "content": "## Slack Configuration\nSends the formatted daily digest to your Slack channel.\n\n**Setup Required:**\n1. Configure Slack OAuth2 credentials\n2. Select the target channel (default: #general)\n3. Grant bot permissions to post messages\n\n**Note:** Adjust the channel name to your preference"
      },
      "typeVersion": 1
    },
    {
      "id": "b116a4a7-eb4d-43c7-99ef-f0f55d985273",
      "name": "Item Lists",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        640,
        176
      ],
      "parameters": {
        "options": {},
        "aggregate": "aggregateAllItemData"
      },
      "typeVersion": 1
    },
    {
      "id": "ccf5813b-4e0c-476c-99df-fae172256d3c",
      "name": "If",
      "type": "n8n-nodes-base.if",
      "position": [
        416,
        272
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "ee3a0b33-70b2-482a-9d3b-3dfe751952e8",
              "operator": {
                "type": "number",
                "operation": "gt"
              },
              "leftValue": "={{ $items().length }}",
              "rightValue": 0
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "eb88744e-7214-4c49-975e-525d0bf3614b",
      "name": "Slack - No E-Mails",
      "type": "n8n-nodes-base.slack",
      "position": [
        640,
        368
      ],
      "webhookId": "4f76c067-fbbd-4527-956c-72778225a4a7",
      "parameters": {
        "text": "=*:email: Daily Email Digest — No emails*\nTarget date (JST): {{$now.setZone('Asia/Tokyo').minus({days:1}).toFormat('yyyy-LL-dd (ccc)')}}\nNo emails were found for yesterday. The next digest will run as scheduled.",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": "C09L12N8F45",
          "cachedResultName": "test"
        },
        "otherOptions": {},
        "authentication": "oAuth2"
      },
      "typeVersion": 2.3
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "callerPolicy": "workflowsFromSameOwner",
    "errorWorkflow": "E2fdCmZVIRZ1HURh",
    "executionOrder": "v1"
  },
  "versionId": "3509e277-92f9-4748-8272-2ff915f900c6",
  "connections": {
    "ccf5813b-4e0c-476c-99df-fae172256d3c": {
      "main": [
        [
          {
            "node": "b116a4a7-eb4d-43c7-99ef-f0f55d985273",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Slack - No Emails",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "b116a4a7-eb4d-43c7-99ef-f0f55d985273": {
      "main": [
        [
          {
            "node": "AI Agent - Analyze Emails",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ec852ebf-1b9a-43a5-90c1-9f972bc101ad": {
      "main": [
        [
          {
            "node": "1e20a30b-a265-47ac-850a-1b4ff962e271",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Gmail - Get Yesterday's Emails",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "888291d6-3791-4a85-bfba-39d00acced61": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent - Analyze Emails",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "23577fe9-3338-4167-9edf-0acc4a77c5a0": {
      "ai_outputParser": [
        [
          {
            "node": "AI Agent - Analyze Emails",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent - Analyze Emails": {
      "main": [
        [
          {
            "node": "ec852ebf-1b9a-43a5-90c1-9f972bc101ad",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gmail - Get Yesterday's Emails": {
      "main": [
        [
          {
            "node": "ccf5813b-4e0c-476c-99df-fae172256d3c",
            "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

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 Nodes14
Kategorie-
Node-Typen10
Schwierigkeitsbeschreibung

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

Externe Links
Auf n8n.io ansehen

Diesen Workflow teilen

Kategorien

Kategorien: 34