毎日のメール要約&サマリーボット

中級

これは自動化ワークフローで、14個のノードを含みます。主にIf, Code, Gmail, Slack, Aggregateなどのノードを使用。 GmailからSlackへの自動メール要約(GPT-4oによるサマリー付き)

前提条件
  • Googleアカウント + Gmail API認証情報
  • Slack Bot Token または Webhook URL

カテゴリー

-
ワークフロープレビュー
ノード接続関係を可視化、ズームとパンをサポート
ワークフローをエクスポート
以下のJSON設定をn8nにインポートして、このワークフローを使用できます
{
  "id": "pjLIqJYyE8diFDeq",
  "meta": {
    "instanceId": "7036f994fcf077f382ea0edc134b49e1ce0556fa914b12051651961e7fbc3600",
    "templateCredsSetupCompleted": true
  },
  "name": "Daily Email Digest and Summary Bot",
  "tags": [],
  "nodes": [
    {
      "id": "b098a164-6c8a-4d51-9876-cfbde2e5da76",
      "name": "スケジュールトリガー",
      "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": "付箋",
      "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 - 前日のメール取得",
      "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": "付箋1",
      "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": "AIエージェント - メール分析",
      "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チャットモデル",
      "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": "構造化出力パーサー",
      "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": "付箋2",
      "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": "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 - 要約送信",
      "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": "付箋3",
      "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": "アイテムリスト",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        640,
        176
      ],
      "parameters": {
        "options": {},
        "aggregate": "aggregateAllItemData"
      },
      "typeVersion": 1
    },
    {
      "id": "ccf5813b-4e0c-476c-99df-fae172256d3c",
      "name": "条件分岐",
      "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 - メールなし",
      "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": "eb88744e-7214-4c49-975e-525d0bf3614b",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "b116a4a7-eb4d-43c7-99ef-f0f55d985273": {
      "main": [
        [
          {
            "node": "5fa53f71-b724-489b-8492-767fdd972a26",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ec852ebf-1b9a-43a5-90c1-9f972bc101ad": {
      "main": [
        [
          {
            "node": "1e20a30b-a265-47ac-850a-1b4ff962e271",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "b098a164-6c8a-4d51-9876-cfbde2e5da76": {
      "main": [
        [
          {
            "node": "90dcdae6-5d2b-496f-8774-ee8d377bbd5a",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "888291d6-3791-4a85-bfba-39d00acced61": {
      "ai_languageModel": [
        [
          {
            "node": "5fa53f71-b724-489b-8492-767fdd972a26",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "23577fe9-3338-4167-9edf-0acc4a77c5a0": {
      "ai_outputParser": [
        [
          {
            "node": "5fa53f71-b724-489b-8492-767fdd972a26",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "5fa53f71-b724-489b-8492-767fdd972a26": {
      "main": [
        [
          {
            "node": "ec852ebf-1b9a-43a5-90c1-9f972bc101ad",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "90dcdae6-5d2b-496f-8774-ee8d377bbd5a": {
      "main": [
        [
          {
            "node": "ccf5813b-4e0c-476c-99df-fae172256d3c",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
よくある質問

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

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

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

中級

有料ですか?

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

ワークフロー情報
難易度
中級
ノード数14
カテゴリー-
ノードタイプ10
難易度説明

経験者向け、6-15ノードの中程度の複雑さのワークフロー

外部リンク
n8n.ioで表示

このワークフローを共有

カテゴリー

カテゴリー: 34