私のワークフロー

中級

これはOther, AI分野の自動化ワークフローで、8個のノードを含みます。主にGmail, Aggregate, Agent, ScheduleTrigger, LmChatOpenRouterなどのノードを使用、AI技術を活用したスマート自動化を実現。 Google WorkspaceでSlackに送信する毎日のメール要約(Gmail、OpenRouter、LangChain)

前提条件
  • Googleアカウント + Gmail API認証情報

カテゴリー

ワークフロープレビュー
ノード接続関係を可視化、ズームとパンをサポート
ワークフローをエクスポート
以下のJSON設定をn8nにインポートして、このワークフローを使用できます
{
  "id": "lPYVaz2xbN5zFDIL",
  "meta": {
    "instanceId": "cbc68f6c587084f6fe53914a07ed22d475640cb7a6f4ade193e6f0c6d7a06ce8"
  },
  "name": "My workflow",
  "tags": [
    {
      "id": "DaQLpYItTEM2y8Gt",
      "name": "Product",
      "createdAt": "2025-06-17T10:48:17.486Z",
      "updatedAt": "2025-06-17T10:48:17.486Z"
    },
    {
      "id": "6X5c5WbCRWtxJbl2",
      "name": "AI",
      "createdAt": "2025-06-17T10:48:17.367Z",
      "updatedAt": "2025-06-17T10:48:17.367Z"
    },
    {
      "id": "ycHNTMiM8vy98zu1",
      "name": "Building blocks",
      "createdAt": "2025-06-17T10:48:17.563Z",
      "updatedAt": "2025-06-17T10:48:17.563Z"
    },
    {
      "id": "UJ6au0mv063gOupq",
      "name": "Finance",
      "createdAt": "2025-06-17T10:48:17.583Z",
      "updatedAt": "2025-06-17T10:48:17.583Z"
    },
    {
      "id": "CaWiGPzJpyfUHdxp",
      "name": "IT Ops",
      "createdAt": "2025-06-17T10:48:17.388Z",
      "updatedAt": "2025-06-17T10:48:17.388Z"
    },
    {
      "id": "6Uolue5XigSZ2IYx",
      "name": "OpenAI",
      "createdAt": "2025-06-17T10:48:17.508Z",
      "updatedAt": "2025-06-17T10:48:17.508Z"
    },
    {
      "id": "nA8GpDM4XoG5aJ0A",
      "name": "Marketing",
      "createdAt": "2025-06-17T10:48:17.532Z",
      "updatedAt": "2025-06-17T10:48:17.532Z"
    },
    {
      "id": "J4gTJX9lSPm3wByF",
      "name": "Support",
      "createdAt": "2025-06-17T10:48:17.464Z",
      "updatedAt": "2025-06-17T10:48:17.464Z"
    },
    {
      "id": "i294x7TPtUQgJkmv",
      "name": "HR",
      "createdAt": "2025-06-17T10:48:17.426Z",
      "updatedAt": "2025-06-17T10:48:17.426Z"
    }
  ],
  "nodes": [
    {
      "id": "895894ff-943d-4cd0-9311-791b35e4ca57",
      "name": "過去24時間のメール取得",
      "type": "n8n-nodes-base.gmail",
      "position": [
        -800,
        180
      ],
      "webhookId": "20f1d11d-8a69-43f3-9323-33eaf1b3b600",
      "parameters": {
        "filters": {
          "q": "={{ \n (() => {\n const yesterday = new Date();\n yesterday.setDate(yesterday.getDate() - 1);\n return `isb.quantana@quantana.in after:${yesterday.getFullYear()}/${(yesterday.getMonth() + 1).toString().padStart(2, '0')}/${yesterday.getDate().toString().padStart(2, '0')}`;\n })()\n}}"
        },
        "operation": "getAll",
        "returnAll": true
      },
      "typeVersion": 2.1
    },
    {
      "id": "5518a4f6-5d68-46bf-b29b-1830379917a9",
      "name": "午前のメールデータ整理",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        -580,
        180
      ],
      "parameters": {
        "include": "specifiedFields",
        "options": {},
        "aggregate": "aggregateAllItemData",
        "fieldsToInclude": "id, From, To, CC, snippet"
      },
      "typeVersion": 1
    },
    {
      "id": "d5598f1c-86a2-49b3-b659-bba4d063878c",
      "name": "午前の要約送信",
      "type": "n8n-nodes-base.gmail",
      "position": [
        16,
        180
      ],
      "webhookId": "83f2aeb9-7b6c-4336-b5ed-8acfcd259850",
      "parameters": {
        "sendTo": "team-email@example.com",
        "message": "=<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <title>Email Summary - isbonline@quantana.in</title>\n <style>\n body {\n font-family: Arial, sans-serif;\n margin: 0;\n padding: 0;\n background-color: #f9f9f9;\n color: #333;\n line-height: 1.6;\n }\n .email-container {\n max-width: 600px;\n margin: 20px auto;\n background: #ffffff;\n border: 1px solid #ddd;\n border-radius: 10px;\n box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);\n }\n .email-header {\n background-color: #0073e6;\n color: #fff;\n padding: 20px;\n text-align: center;\n border-top-left-radius: 10px;\n border-top-right-radius: 10px;\n }\n .email-header h1 {\n margin: 0;\n font-size: 24px;\n }\n .email-content {\n padding: 20px;\n }\n .section-title {\n font-size: 20px;\n color: #0073e6;\n margin-bottom: 10px;\n }\n ul {\n list-style: none;\n padding: 0;\n }\n ul li {\n margin: 10px 0;\n padding: 10px;\n background: #f4f4f4;\n border-left: 4px solid #0073e6;\n border-radius: 5px;\n }\n .action-item {\n font-weight: bold;\n margin: 5px 0;\n }\n .action-detail {\n margin-left: 10px;\n }\n .email-footer {\n background-color: #0073e6;\n color: #fff;\n text-align: center;\n padding: 10px;\n font-size: 14px;\n border-bottom-left-radius: 10px;\n border-bottom-right-radius: 10px;\n }\n </style>\n</head>\n<body>\n <div class=\"email-container\">\n <div class=\"email-header\">\n <h1>Email Summary</h1>\n </div>\n <div class=\"email-content\">\n <div>\n <h2 class=\"section-title\">Summary of Emails:</h2>\n <ul>\n {{ $json.message.content.summary_of_emails.map(email => `<li>${email}</li>`).join('') }}\n </ul>\n </div>\n <div>\n <h2 class=\"section-title\">Actions:</h2>\n <ul>\n {{ $json.message.content.actions.map(action => `\n <li>\n <span class=\"action-item\">${action.name}:</span>\n <span class=\"action-detail\">${action.action}</span>\n </li>\n `).join('') }}\n </ul>\n </div>\n </div>\n <div class=\"email-footer\">\n <p>Generated by Quantana ESAgent <br /> A Quantana AI Labs Initiative\n </div>\n </div>\n</body>\n</html>",
        "options": {
          "ccList": "cc-list@example.com",
          "appendAttribution": false,
          "replyToSenderOnly": false
        },
        "subject": "=ESAgent - {{ new Date(new Date().setDate(new Date().getDate() - 1)).toLocaleDateString('en-GB', { day: '2-digit', month: 'short', year: 'numeric' }) }}-00:00 to {{ new Date(new Date().setDate(new Date().getDate())).toLocaleDateString('en-GB', { day: '2-digit', month: 'short', year: 'numeric' }) }}-07:00AM"
      },
      "typeVersion": 2.1
    },
    {
      "id": "7480f9af-2026-437c-800c-be49eef1895b",
      "name": "毎日午前8時トリガー",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -1020,
        180
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtHour": 7
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "ab7c5ea2-81a6-4d8d-932c-2de023164304",
      "name": "OpenRouterチャットモデル",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        -332,
        400
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "openRouterApi": {
          "id": "W9KyGINw1pnCGjLT",
          "name": "OpenRouter account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "ddf9f7ee-630e-4b3d-8e84-d157d129c671",
      "name": "シンプルメモリ",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        -212,
        400
      ],
      "parameters": {},
      "typeVersion": 1.3
    },
    {
      "id": "309bfb47-72e1-4396-ad5f-dc656ea4eefa",
      "name": "メール要約ツール",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -360,
        180
      ],
      "parameters": {
        "options": {
          "systemMessage": "Email Processing System\n\nStep 1: Extract Key Details\nRead the email thoroughly and identify:\n\nMain topics discussed\n\nCritical data points (dates, numbers, names)\n\nExplicit requests or requirements\n\nProblems or concerns raised\n\nStep 2: Organize Output\nSummary of Email\nBullet-point list of key takeaways\n\nExample:\n\nProject deadline extended to March 15\n\nNew compliance rules apply to all vendors\n\nIssues Identified\nList problems with context:\n\nIssue: Vendor delay impacting timeline\n\nImpact: Risk to Q2 launch\n\nAction Items\nClear tasks with owners:\n\nTask: Approve revised budget\n\nOwner: Finance Team\n\nDeadline: EOD Friday\n\nFollow-Up Needed\nOpen questions or missing info:\n\n\"Confirm if the client approved the scope change?\"\n\nRules for Clarity\n✔ Be concise – 1 line per point\n✔ Prioritize – Flag urgent items with [!]\n✔ Ownership – Always note who needs to act\n✔ Use plain language – Avoid jargon\n\nExample Output:\n\nSummary\n\nMarketing campaign paused due to budget review\n\nNew analytics tool rollout delayed by 2 weeks\n\nIssues\n\n[!] Budget approval missing – blocking all spend\n\nLow engagement on recent social posts\n\nActions\n\nSend revised budget to CFO (Owner: Alex)\n\nAudit social content (Owner: Marketing, Due: Nov 30)\n\nFollow-Up\n\nIs the budget review meeting scheduled?"
        },
        "promptType": "define"
      },
      "typeVersion": 2
    },
    {
      "id": "5b97bbf7-5259-4554-a81e-330494bdcc45",
      "name": "付箋メモ",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1460,
        -160
      ],
      "parameters": {
        "width": 1960,
        "height": 860,
        "content": "# 📧 Email Auto-Summary Flow (n8n)\n\n**Purpose**: Daily digest of `isb.quantana@quantana.in` emails  \n**Runs**: 8AM IST (7AM UTC) weekdays  \n\n## 🔄 Workflow\n1. ⏰ **Trigger**: Scheduled daily run  \n2. 📥 **Input**: Fetch last 24h emails via Gmail API  \n3. 🤖 **Process**:  \n   - Filter non-essential emails  \n   - Extract key metadata (sender, subject, body)  \n4. ✍️ **AI Summary**:  \n   - Langchain analyzes content  \n   - Identifies: Updates/Issues/Actions  \n5. 📤 **Output**: Formatted email to team via Gmail API  \n\n## 🔑 APIs Needed:\n- Gmail API (OAuth2)  \n- OpenRouter API (LLM access)  \n- (Optional) Slack API for alerts  \n\n## ⚙️ Config:\n- `OPENROUTER_KEY` for AI  \n- `GMAIL_CREDS` for email access  \n- Recipient list in flow vars  \n\n💡 Processes ~50 emails/day | Error alerts via email"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "54b5fc42-b14e-4949-8b95-d956680caf69",
  "connections": {
    "ddf9f7ee-630e-4b3d-8e84-d157d129c671": {
      "ai_memory": [
        [
          {
            "node": "309bfb47-72e1-4396-ad5f-dc656ea4eefa",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "309bfb47-72e1-4396-ad5f-dc656ea4eefa": {
      "main": [
        [
          {
            "node": "d5598f1c-86a2-49b3-b659-bba4d063878c",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "7480f9af-2026-437c-800c-be49eef1895b": {
      "main": [
        [
          {
            "node": "895894ff-943d-4cd0-9311-791b35e4ca57",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ab7c5ea2-81a6-4d8d-932c-2de023164304": {
      "ai_languageModel": [
        [
          {
            "node": "309bfb47-72e1-4396-ad5f-dc656ea4eefa",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "895894ff-943d-4cd0-9311-791b35e4ca57": {
      "main": [
        [
          {
            "node": "5518a4f6-5d68-46bf-b29b-1830379917a9",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "5518a4f6-5d68-46bf-b29b-1830379917a9": {
      "main": [
        [
          {
            "node": "309bfb47-72e1-4396-ad5f-dc656ea4eefa",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
よくある質問

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

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

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

中級 - その他, 人工知能

有料ですか?

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

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

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

外部リンク
n8n.ioで表示

このワークフローを共有

カテゴリー

カテゴリー: 34