AI 要約機能付きの毎日のメール要約

上級

これはPersonal Productivity, AI Summarization分野の自動化ワークフローで、16個のノードを含みます。主にIf, Set, Code, Gmail, ScheduleTriggerなどのノードを使用。 Gmail のタグを使用して OpenAI O4-Mini で AI 要約のメール要約を作成

前提条件
  • Googleアカウント + Gmail API認証情報
  • OpenAI API Key
ワークフロープレビュー
ノード接続関係を可視化、ズームとパンをサポート
ワークフローをエクスポート
以下のJSON設定をn8nにインポートして、このワークフローを使用できます
{
  "meta": {
    "instanceId": ""
  },
  "name": "Daily Email Digest with AI Summarization",
  "tags": [],
  "nodes": [
    {
      "id": "6e739c6d-8fe0-46ba-9f92-c88adff879cf",
      "name": "If",
      "type": "n8n-nodes-base.if",
      "position": [
        -260,
        440
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "c772f463-4fe1-4e8f-8cac-d9c1dec71f03",
              "operator": {
                "type": "number",
                "operation": "gt"
              },
              "leftValue": "={{$items().length}}",
              "rightValue": 0
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "572ca84c-f3b8-478d-aa51-4d63ae462671",
      "name": "OpenAI チャットモデル",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -40,
        260
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "o4-mini",
          "cachedResultName": "o4-mini"
        },
        "options": {}
      },
      "typeVersion": 1.2
    },
    {
      "id": "8f6dafea-8cf6-47d5-b117-58f748de860e",
      "name": "Default Data Loader",
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "position": [
        80,
        280
      ],
      "parameters": {
        "options": {},
        "jsonData": "={{ $json.text }}",
        "jsonMode": "expressionData",
        "textSplittingMode": "custom"
      },
      "typeVersion": 1.1
    },
    {
      "id": "ae79599f-c03c-4ca3-a074-89348c1d7d4e",
      "name": "再帰的文字テキストスプリッター",
      "type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter",
      "position": [
        180,
        460
      ],
      "parameters": {
        "options": {},
        "chunkSize": "={{ $json.text.length }}"
      },
      "typeVersion": 1
    },
    {
      "id": "646ced0e-cd43-449b-917c-bd376b748c15",
      "name": "操作なし, do nothing",
      "type": "n8n-nodes-base.noOp",
      "position": [
        40,
        660
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "d7c20f5e-f388-474a-975b-413292a1ad60",
      "name": "Edit Fields",
      "type": "n8n-nodes-base.set",
      "position": [
        460,
        240
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "165006bf-ec9c-4f7b-a840-28486ce1dba3",
              "name": "output.text",
              "type": "string",
              "value": "={{ $json.output.text }}"
            },
            {
              "id": "94bb7c0a-210a-484f-b363-3960cce119f2",
              "name": "subject",
              "type": "string",
              "value": "={{ $('Get mails (last 24h)').item.json.subject }}"
            },
            {
              "id": "30f4fd53-3c46-4e6c-8852-7fedb2a32301",
              "name": "headers.from",
              "type": "string",
              "value": "={{ $('If').item.json.headers.from }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "7681c2c6-ccbc-4675-8f5d-9ebfe52e1788",
      "name": "Combine Subject and Body",
      "type": "n8n-nodes-base.code",
      "position": [
        680,
        240
      ],
      "parameters": {
        "jsCode": "// Combine all items into one content block\nlet allContent = '';\n\n\n\nfor (const item of $input.all()) {\n  const originalFrom = `${item.json.headers.from}`;\n  const fromPrefix = \"From: \";\n  let trancatedFrom;\n  \n  if (originalFrom.startsWith(fromPrefix)) {\n    trancatedFrom = originalFrom.substring(fromPrefix.length);\n  } else {\n    trancatedFrom = originalFrom;\n  }\n  // Create H2 heading from subject\n  const heading = `<h3>${item.json.subject} [${trancatedFrom}]</h3>`;\n  \n  // Add heading and body to combined content\n  allContent += heading + `\\n\\n${item.json.output.text}\\n\\n`;\n}\n\n// Return a single item with all combined content\nreturn [{\n  json: {\n    combinedContent: allContent.trim(),\n    itemCount: $input.all().length\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "b39f8459-49b0-47e9-8848-71d76aac8149",
      "name": "Summarization Mails",
      "type": "@n8n/n8n-nodes-langchain.chainSummarization",
      "position": [
        -20,
        40
      ],
      "parameters": {
        "options": {
          "summarizationMethodAndPrompts": {
            "values": {
              "prompt": "Write a concise summary of the following email digest.\n- If the digest includes multiple topics, summarize each topic as a separate bullet point.\n- If the digest refers to external links for a topic preserve them and insert at appropriated places inside summorized text under ascending numbers ([1], [2], etc.).\n- Format the output as HTML, using <p> tags for paragraphs and <ul><li> for bullet points and <a href> for external links.\n- Reply directly with the summorized text.\n\nExample:\n<ul>\\n  <li>\\n    <p>Meta has recruited Apple's head of AI models, Ruoming Pang<a href=\"https://techcrunch.com/2025/07/07/meta-reportedly-recruits-apples-head-of-ai-models/\">[1]</a>, suggesting an intensifying talent war and possible work on its next-gen AI glasses<a href=\"https://www.androidauthority.com/meta-hypernova-smart-glasses-leaked-render-3572798/\">[2]</a>.</p>\\n  </li>\\n  <li>\\n    <p>Key AI headlines: Chinese firms ramp up; Samsung forecasts a 56% profit drop amid weak AI chip demand<a href=\"https://www.cnbc.com/2025/07/08/samsung-projects-second-quarter-profits-drop-56-percent-struggles-ai-demand-nvidia-sk-hynix-micron.html\">[3]</a>; Cursor blames costly models for business woes<a href=\"https://techcrunch.com/2025/07/07/cursor-apologizes-for-unclear-pricing-changes-that-upset-users/\">[4]</a>; CoreWeave to buy Core Scientific for $9 billion<a href=\"https://www.bloomberg.com/news/articles/2025-07-07/coreweave-to-buy-core-scientific-in-deal-valued-at-9-billion\">[5]</a>.\n\nDigest to summorize.\n\"{text}\"\n\nSUMMARY:",
              "summarizationMethod": "stuff"
            }
          }
        },
        "operationMode": "documentLoader"
      },
      "typeVersion": 2.1
    },
    {
      "id": "5176a79f-2d9b-43c9-a20a-819e60bda044",
      "name": "Send Digested mail",
      "type": "n8n-nodes-base.gmail",
      "position": [
        900,
        240
      ],
      "parameters": {
        "sendTo": "your-email@example.com",
        "message": "={{ $json.combinedContent }}",
        "options": {},
        "subject": "=Daily Tech-News Digest for {{ $now.toISODate() }}"
      },
      "typeVersion": 2.1
    },
    {
      "id": "67798876-7912-4597-9959-000bf8f870af",
      "name": "Get mails (last 24h)",
      "type": "n8n-nodes-base.gmail",
      "position": [
        -480,
        440
      ],
      "parameters": {
        "limit": 20,
        "simple": false,
        "filters": {
          "labelIds": [
            "YOUR_LABEL_ID"
          ],
          "receivedAfter": "={{$now.minus({days: 1}).toISO()}}"
        },
        "options": {},
        "operation": "getAll"
      },
      "typeVersion": 2.1
    },
    {
      "id": "de4aab88-76ea-4688-8385-47406e01c2e5",
      "name": "スケジュールトリガー",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -680,
        440
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtHour": 9
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "d45213a8-e076-48ac-8593-55a12ec18245",
      "name": "Main Workflow Explanation",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1180,
        0
      ],
      "parameters": {
        "width": 460,
        "height": 800,
        "content": "## Daily Email Digest with AI Summarization\n### This n8n workflow automatically creates AI-powered summaries of labeled emails and sends them as a daily digest.\n\nPerfect for staying on top of newsletters, news feeds, or any categorized emails without information overload!\n\n### How it works\n* **Scheduled daily** at 9 AM to check for new emails\n* **Fetches labeled emails** from the last 24 hours using Gmail\n* **AI summarization** using OpenAI to create concise summaries\n* **Combines multiple emails** into one formatted digest\n* **Sends digest email** with all summaries in HTML format\n\n### How to set up\n* Create a Gmail label for emails you want summarized\n* Update the label ID in the 'Get mails' node\n* Configure OpenAI API credentials\n* Set your email address in the 'Send Digested mail' node\n* Adjust the schedule trigger time as needed\n\n### Requirements\n* Gmail account with OAuth2 setup\n* OpenAI API account and credentials\n* Email label configured in Gmail\n\n### Customization options\n* Change the summarization prompt for different output styles\n* Adjust the time range for email retrieval\n* Modify the digest email template\n* Add additional processing or filtering logic\n\n### Who's it for\n* Content creators who follow multiple news sources\n* Professionals managing industry newsletters\n* Anyone wanting to reduce email overwhelm\n\n### Need Help?\nJoin the [Discord](https://discord.com/invite/XPKeKXeB7d) or ask in the [Forum](https://community.n8n.io/)!\n\nHappy Automating!"
      },
      "typeVersion": 1
    },
    {
      "id": "4bfbdef6-39fd-464e-9ccf-1d1bd71e2372",
      "name": "メール Retrieval Section",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -700,
        580
      ],
      "parameters": {
        "color": 7,
        "width": 300,
        "height": 300,
        "content": "## 1. Scheduled Email Retrieval\n[Read more about Schedule Trigger](https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.scheduletrigger/)\n[Read more about Gmail node](https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.gmail/)\n\nThe workflow runs daily at 9 AM and fetches emails from a specific Gmail label received in the last 24 hours. Configure your desired label in the Gmail node to categorize which emails should be included in your digest."
      },
      "typeVersion": 1
    },
    {
      "id": "290e0ef6-60a0-4f0a-8040-31ed41a91af8",
      "name": "AI Processing Section",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -160,
        -260
      ],
      "parameters": {
        "color": 7,
        "width": 520,
        "height": 360,
        "content": "## 2. AI-Powered Email Summarization\n[Read more about LangChain nodes](https://docs.n8n.io/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.chainSummarization/)\n\nEach email is processed through OpenAI's language model to create concise, readable summaries. The workflow:\n* Loads email content into the document processor\n* Splits text for optimal AI processing\n* Uses a custom prompt to generate HTML-formatted summaries\n* Preserves external links and formats them properly\n\nThe summarization prompt is specifically designed to create clean, scannable content with proper bullet points and link preservation."
      },
      "typeVersion": 1
    },
    {
      "id": "4a78b0ba-cdea-4da8-9929-a955eafbefa5",
      "name": "Formatting and Output Section",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        440,
        -80
      ],
      "parameters": {
        "color": 7,
        "width": 580,
        "height": 700,
        "content": "## 3. Content Formatting and Email Delivery\n[Read more about Code node](https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.code/)\n\nThe summarized emails are combined into a single digest:\n* **Edit Fields** extracts key data (subject, sender, summary)\n* **Combine Subject and Body** merges all summaries with proper headers\n* **Send Digested mail** delivers the final HTML-formatted digest\n\nThe final email includes organized summaries with sender information and maintains all formatting for easy reading."
      },
      "typeVersion": 1
    },
    {
      "id": "75c6d291-083b-416d-b8fa-ecfe24b875d7",
      "name": "Conditional Processing",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -340,
        580
      ],
      "parameters": {
        "color": 7,
        "width": 280,
        "height": 200,
        "content": "## Smart Processing\n[Read more about If node](https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.if/)\n\nThe workflow intelligently checks if any emails were found. If no emails match the criteria, it skips processing to avoid sending empty digests."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "",
  "connections": {
    "6e739c6d-8fe0-46ba-9f92-c88adff879cf": {
      "main": [
        [
          {
            "node": "b39f8459-49b0-47e9-8848-71d76aac8149",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "No Operation, do nothing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "d7c20f5e-f388-474a-975b-413292a1ad60": {
      "main": [
        [
          {
            "node": "7681c2c6-ccbc-4675-8f5d-9ebfe52e1788",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "67798876-7912-4597-9959-000bf8f870af",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "b39f8459-49b0-47e9-8848-71d76aac8149",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "8f6dafea-8cf6-47d5-b117-58f748de860e": {
      "ai_document": [
        [
          {
            "node": "b39f8459-49b0-47e9-8848-71d76aac8149",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    },
    "b39f8459-49b0-47e9-8848-71d76aac8149": {
      "main": [
        [
          {
            "node": "d7c20f5e-f388-474a-975b-413292a1ad60",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "67798876-7912-4597-9959-000bf8f870af": {
      "main": [
        [
          {
            "node": "6e739c6d-8fe0-46ba-9f92-c88adff879cf",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "7681c2c6-ccbc-4675-8f5d-9ebfe52e1788": {
      "main": [
        [
          {
            "node": "5176a79f-2d9b-43c9-a20a-819e60bda044",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Recursive Character Text Splitter": {
      "ai_textSplitter": [
        [
          {
            "node": "8f6dafea-8cf6-47d5-b117-58f748de860e",
            "type": "ai_textSplitter",
            "index": 0
          }
        ]
      ]
    }
  }
}
よくある質問

このワークフローの使い方は?

上記のJSON設定コードをコピーし、n8nインスタンスで新しいワークフローを作成して「JSONからインポート」を選択、設定を貼り付けて認証情報を必要に応じて変更してください。

このワークフローはどんな場面に適していますか?

上級 - 個人の生産性, AI要約

有料ですか?

このワークフローは完全無料です。ただし、ワークフローで使用するサードパーティサービス(OpenAI APIなど)は別途料金が発生する場合があります。

ワークフロー情報
難易度
上級
ノード数16
カテゴリー2
ノードタイプ11
難易度説明

上級者向け、16ノード以上の複雑なワークフロー

作成者
German Velibekov

German Velibekov

@germanv

Passionate about building intelligent systems and scalable infrastructure.

外部リンク
n8n.ioで表示

このワークフローを共有

カテゴリー

カテゴリー: 34