AIを活用したメール受信箱管理システム、GPT-4、Gmail、Slackとの統合

上級

これはTicket Management, AI Summarization分野の自動化ワークフローで、22個のノードを含みます。主にIf, Gmail, Slack, GmailTrigger, OpenAiなどのノードを使用。 AIを活用したメール受信箱管理システム、GPT-4、Gmail、Slackとの統合

前提条件
  • Googleアカウント + Gmail API認証情報
  • Slack Bot Token または Webhook URL
  • OpenAI API Key
ワークフロープレビュー
ノード接続関係を可視化、ズームとパンをサポート
ワークフローをエクスポート
以下のJSON設定をn8nにインポートして、このワークフローを使用できます
{
  "id": "TbwP9QUjXidVVh4Z",
  "meta": {
    "instanceId": "53ff9c683c80138a3de625634237ce4a4994b3a21e1a7a30490f99aca9a547c5",
    "templateCredsSetupCompleted": true
  },
  "name": "AI-Powered Email Inbox Manager with GPT-4, Gmail, and Slack Integration",
  "tags": [],
  "nodes": [
    {
      "id": "bbe4335e-71cd-480d-b021-b9e650fe8378",
      "name": "Gmail Trigger",
      "type": "n8n-nodes-base.gmailTrigger",
      "position": [
        -704,
        128
      ],
      "parameters": {
        "simple": false,
        "filters": {
          "labelIds": [
            "UNREAD"
          ]
        },
        "options": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        }
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "x421CCYwRnlCAGVd",
          "name": "Gmail account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "4a50fc40-2859-42d4-87d3-6513e193fe17",
      "name": "Text Classifier",
      "type": "@n8n/n8n-nodes-langchain.textClassifier",
      "position": [
        -480,
        128
      ],
      "parameters": {
        "options": {},
        "inputText": "={{ $json.text }}",
        "categories": {
          "categories": [
            {
              "category": "Internal",
              "description": "=Emails from the parent domain (prvndigital.com) from employees. Keywords: request, inquiry,\nsupport, question, follow-up, feedback"
            },
            {
              "category": "Customer Support",
              "description": "=Emails related to ongoing communication with current clients or customers, including service\nrequests, feedback, support tickets, and inquiries. Keywords: request, inquiry, support, question,\nfollow-up, feedback"
            },
            {
              "category": "Promotions",
              "description": "=Emails related to marketing campaigns, promotional offers, newsletters, or business updates\nfrom partners. Typically these emails contain content aimed at engaging an audience or\nupdating them on promotions. Keywords: newsletter, promotion, offer, sale, campaign,\nmarketing, launch"
            },
            {
              "category": "Admin/Finance",
              "description": "=Emails related to admin or financial matters, such as invoices, billing statements, payment\nreminders, or expense reports. Anything involving transactions or accounting should fall under\nthis label. Keywords: invoice, payment, billing, receipt, financial, expense, account"
            },
            {
              "category": "Sales Opportunities",
              "description": "=Emails related to sales. These could include service inquiries, pricing requests, referrals etc."
            }
          ]
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "ed818fb1-8087-4c2e-b175-c9bc8ea36f82",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -408,
        448
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "vtB7cRl8RPBNwKAO",
          "name": "n8n free OpenAI API credits"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "b10b46ad-13df-4c1d-8608-21d3f8ba34f9",
      "name": "プロモーション",
      "type": "n8n-nodes-base.gmail",
      "position": [
        -128,
        128
      ],
      "webhookId": "b90ee8a2-30b5-4bc9-8458-cedc60302fa9",
      "parameters": {
        "labelIds": [
          "Label_1545496588916418018"
        ],
        "messageId": "={{ $json.id }}",
        "operation": "addLabels"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "x421CCYwRnlCAGVd",
          "name": "Gmail account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "50754308-afe4-4299-acc0-02aebf248af3",
      "name": "内部",
      "type": "n8n-nodes-base.gmail",
      "position": [
        -128,
        -256
      ],
      "webhookId": "b90ee8a2-30b5-4bc9-8458-cedc60302fa9",
      "parameters": {
        "labelIds": [
          "Label_1524539159551949340"
        ],
        "messageId": "={{ $json.id }}",
        "operation": "addLabels"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "x421CCYwRnlCAGVd",
          "name": "Gmail account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "06cf291a-6f8d-4743-b8a1-1a17164508f0",
      "name": "カスタマーサポート",
      "type": "n8n-nodes-base.gmail",
      "position": [
        -128,
        -64
      ],
      "webhookId": "b90ee8a2-30b5-4bc9-8458-cedc60302fa9",
      "parameters": {
        "labelIds": [
          "Label_4804911835581558556"
        ],
        "messageId": "={{ $json.id }}",
        "operation": "addLabels"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "x421CCYwRnlCAGVd",
          "name": "Gmail account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "f333483a-4d84-4d8b-846d-13b408d264a8",
      "name": "管理/財務",
      "type": "n8n-nodes-base.gmail",
      "position": [
        -128,
        320
      ],
      "webhookId": "b90ee8a2-30b5-4bc9-8458-cedc60302fa9",
      "parameters": {
        "labelIds": [
          "Label_1226745938983889262"
        ],
        "messageId": "={{ $json.id }}",
        "operation": "addLabels"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "x421CCYwRnlCAGVd",
          "name": "Gmail account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "f7883340-b00d-4c77-b1a6-f2a2512190bc",
      "name": "営業案件",
      "type": "n8n-nodes-base.gmail",
      "position": [
        -128,
        512
      ],
      "webhookId": "b90ee8a2-30b5-4bc9-8458-cedc60302fa9",
      "parameters": {
        "labelIds": [
          "Label_7406356819911928694"
        ],
        "messageId": "={{ $json.id }}",
        "operation": "addLabels"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "x421CCYwRnlCAGVd",
          "name": "Gmail account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "0c1e22e5-492d-48f9-bb9c-3387a85b16ee",
      "name": "Mark a message as read1",
      "type": "n8n-nodes-base.gmail",
      "position": [
        656,
        160
      ],
      "webhookId": "f669746f-295f-4acd-8ee2-04467f90b3ca",
      "parameters": {
        "messageId": "={{$ ('Text Classifier').item.json.id}}",
        "operation": "markAsRead"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "x421CCYwRnlCAGVd",
          "name": "Gmail account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "bc5bb950-c03a-4b3c-a70d-6a75f1c5f953",
      "name": "Message a model",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        96,
        128
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini",
          "cachedResultName": "GPT-4O-MINI"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "content": "=You are the Promotions Analyst in an AI email management system.\nYour role is to review incoming promotional emails, summarize the offer, and decide whether it’s\nworth pursuing further.\nInput:\n{{ $('Gmail Trigger').item.json.text }}\nOutput:\n• Summary – What is being offered?\n• Recommendation – Is this worth exploring further? (Yes/No + brief reason)"
            }
          ]
        },
        "jsonOutput": true
      },
      "credentials": {
        "openAiApi": {
          "id": "vtB7cRl8RPBNwKAO",
          "name": "n8n free OpenAI API credits"
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "dcfd27a4-6345-40e5-8edd-125f3b5438dc",
      "name": "If",
      "type": "n8n-nodes-base.if",
      "position": [
        448,
        128
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "ba4b6577-5d8e-495c-8ab5-a591f22af93e",
              "operator": {
                "type": "string",
                "operation": "contains"
              },
              "leftValue": "={{ $json.message.content.Recommendation }}",
              "rightValue": "yes"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "9fcf2dac-7101-42d8-9264-f84f0bd9bb47",
      "name": "Message a model1",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        96,
        -256
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini",
          "cachedResultName": "GPT-4O-MINI"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "content": "=You are an executive assistant handling internal emails from my team.\nRespond to high-priority emails with clarity and accuracy.\nInput:\n{{ $('Gmail Trigger').item.json.text }}\nOutput:\n• Subject\n• Message"
            }
          ]
        },
        "jsonOutput": true
      },
      "credentials": {
        "openAiApi": {
          "id": "vtB7cRl8RPBNwKAO",
          "name": "n8n free OpenAI API credits"
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "3f937b75-9107-4ea6-b2ab-3008eed89964",
      "name": "Message a model2",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        96,
        -64
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini",
          "cachedResultName": "GPT-4O-MINI"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "content": "=You are a customer service representative.\nRespond to customer inquiries clearly and accurately.\nIf the request is outside your scope, direct the user to: support@prvndigital.com\nInput:\n{{ $('Gmail Trigger').item.json.text }}\nOutput:\n• Subject\n• Message"
            }
          ]
        },
        "jsonOutput": true
      },
      "credentials": {
        "openAiApi": {
          "id": "vtB7cRl8RPBNwKAO",
          "name": "n8n free OpenAI API credits"
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "f5496329-133e-438b-a946-e064deb03874",
      "name": "Message a model3",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        96,
        320
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini",
          "cachedResultName": "GPT-4O-MINI"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "content": "=You are a Finance & Billing Assistant.\nReview incoming emails related to payments, invoices, or account charges. Summarize the key\ndetails clearly and concisely.\nInput:\n{{ $('Gmail Trigger').item.json.text }}\nOutput:\n• Subject\n• Summary"
            }
          ]
        },
        "jsonOutput": true
      },
      "credentials": {
        "openAiApi": {
          "id": "vtB7cRl8RPBNwKAO",
          "name": "n8n free OpenAI API credits"
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "e0523a68-8870-43fd-a879-c6f57e825e8f",
      "name": "Message a model4",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        96,
        512
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini",
          "cachedResultName": "GPT-4O-MINI"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "content": "=Your job is to read incoming emails related to the sale of our products or services and draft a\nconcise, professional response. Include relevant details such as the contact’s name, email,\nphone number, and any specific questions or requests they mentioned.\nInput:\n{{ $('Gmail Trigger').item.json.text }}\nOutput:\n• Subject – Appropriate subject line for your reply\n• Message – Drafted email response including relevant details\n- Notification - create a concise notification to be sent to a slack channel with the first line as\n\"New Sales Opportunity\" along with any relevant details"
            }
          ]
        },
        "jsonOutput": true
      },
      "credentials": {
        "openAiApi": {
          "id": "vtB7cRl8RPBNwKAO",
          "name": "n8n free OpenAI API credits"
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "5211bfae-d7f2-4002-bb91-9268fbbbc0ba",
      "name": "下書きを作成",
      "type": "n8n-nodes-base.gmail",
      "position": [
        448,
        -256
      ],
      "webhookId": "32f52fd7-8ef7-4867-be94-b63100ffdfab",
      "parameters": {
        "message": "={{ $json,message.context.Message }}",
        "options": {},
        "subject": "={{ $json,message.context.Subject }}",
        "resource": "draft"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "x421CCYwRnlCAGVd",
          "name": "Gmail account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "7311a8ce-e2e4-41e5-9eb1-5a66115d6d68",
      "name": "Slack",
      "type": "n8n-nodes-base.slack",
      "position": [
        656,
        -256
      ],
      "webhookId": "ec7b1337-9db1-475f-b353-79dbbeb56587",
      "parameters": {
        "text": "Internal: New Draft Created ",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": "C08KU6HK28H",
          "cachedResultName": "playground"
        },
        "otherOptions": {},
        "authentication": "oAuth2"
      },
      "typeVersion": 2.3
    },
    {
      "id": "204628dd-5ba3-40ca-91e7-7a91ef742a8b",
      "name": "下書きを作成2",
      "type": "n8n-nodes-base.gmail",
      "position": [
        432,
        -80
      ],
      "webhookId": "8ce3b709-9213-48af-9813-3e76a69dcec5",
      "parameters": {
        "message": "={{ $json.message.content.Message }}",
        "options": {},
        "subject": "={{ $json.message.content.Subject }}",
        "resource": "draft"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "x421CCYwRnlCAGVd",
          "name": "Gmail account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "bf4ed803-6429-4de1-9b73-5bc3186e6cc2",
      "name": "下書きを作成1",
      "type": "n8n-nodes-base.gmail",
      "position": [
        448,
        320
      ],
      "webhookId": "8ce3b709-9213-48af-9813-3e76a69dcec5",
      "parameters": {
        "message": "={{ $json.message.content.Message }}",
        "options": {},
        "subject": "={{ $json.message.content.Subject }}",
        "resource": "draft"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "x421CCYwRnlCAGVd",
          "name": "Gmail account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "76540b20-6619-4aec-9312-89e27940420c",
      "name": "Slack1",
      "type": "n8n-nodes-base.slack",
      "position": [
        656,
        496
      ],
      "webhookId": "3e098b85-9de9-44ae-80ce-7a0adeece2c6",
      "parameters": {
        "text": "={{ $('OpenAI4').item.json.message.content.Notification }}",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": "C08KU6HK28H",
          "cachedResultName": "playground"
        },
        "otherOptions": {},
        "authentication": "oAuth2"
      },
      "typeVersion": 2.3
    },
    {
      "id": "23bafb22-a05a-4635-a698-c1bfd4b0d9e2",
      "name": "下書きを作成3",
      "type": "n8n-nodes-base.gmail",
      "position": [
        432,
        496
      ],
      "webhookId": "8ce3b709-9213-48af-9813-3e76a69dcec5",
      "parameters": {
        "message": "={{ $json.message.content.Message }}",
        "options": {},
        "subject": "={{ $json.message.content.Subject }}",
        "resource": "draft"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "x421CCYwRnlCAGVd",
          "name": "Gmail account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "f9c7bbdf-e802-4f68-968a-ebf68ca521b6",
      "name": "付箋",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1376,
        -352
      ],
      "parameters": {
        "width": 1088,
        "height": 1680,
        "content": "## AI-Powered Email Inbox Manager \n\nThis automation system intelligently handles your Gmail inbox using OpenAI and Slack to classify, label, respond to, and manage emails all without human input.\n\n**Gmail Trigger**\n\n-Checks Gmail every 1 minute\n\n-Filters for only UNREAD emails\n\n-Triggers the entire workflow pipeline\n\n-Ensures you're always processing fresh, unseen messages\n\n**Text Classifier**\n\nPowered by GPT-4 to analyzes email text and assigns one of 5 categories:\n\nInternal – Team messages from company domain\n\nCustomer Support – Inquiries, issues, or feedback\n\nPromotions – Campaigns, newsletters, sales\n\nAdmin/Finance - Invoices, payments, financial info\n\nSales Opportunity - Potential clients, pricing requests, referrals\n\n---Provides context aware categorization not just keyword-based\n\n**GPT-4 Support Node**\n\n-Enhances classifier accuracy\n\n-Handles classification logic and reasoning\n\n-Ensures consistent results over time\n\n**Gmail Labeling Nodes (x5)**\n\n-Applies the correct Gmail label depending on the classification\n\n-Keeps your inbox clean, organized, and filterable\n\n-Example: A customer complaint is instantly tagged under \"Customer Support\"\n\n**OpenAI Reply Generation (x5)**\n\nEach category has its own custom GPT-4 prompt:\n\nInternal: Replies on behalf of exec assistant\n\nCustomer Support: Friendly and clear client service\n\nPromotions: Summarizes the offer, evaluates usefulness\n\nFinance: Extracts payment/invoice summaries\n\nSales: Drafts responses, includes lead details + Slack alert\n\n**Draft Responses in Gmail**\n\n-GPT-4 outputs are saved as draft emails\n\n-Ready for your review or auto-send\n\n-Replies are well-formatted, concise, and personalized\n\n**Slack Notifications**\n\nNotifies your team on Slack when:\n\n-A new sales opportunity arrives\n\n-A high-priority internal message comes in\n\n-Boosts real-time awareness without inbox monitoring\n\n**Promotion Filter Logic**\n\n-GPT analyzes if a promo email is worth acting on\n\n-If not valuable, it’s marked as read and ignored\n\n-Reduces inbox noise without missing opportunities"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "696854cc-592d-419d-9daf-8de6bb90b7af",
  "connections": {
    "dcfd27a4-6345-40e5-8edd-125f3b5438dc": {
      "main": [
        [],
        [
          {
            "node": "0c1e22e5-492d-48f9-bb9c-3387a85b16ee",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "50754308-afe4-4299-acc0-02aebf248af3": {
      "main": [
        [
          {
            "node": "9fcf2dac-7101-42d8-9264-f84f0bd9bb47",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "b10b46ad-13df-4c1d-8608-21d3f8ba34f9": {
      "main": [
        [
          {
            "node": "bc5bb950-c03a-4b3c-a70d-6a75f1c5f953",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "f333483a-4d84-4d8b-846d-13b408d264a8": {
      "main": [
        [
          {
            "node": "f5496329-133e-438b-a946-e064deb03874",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "bbe4335e-71cd-480d-b021-b9e650fe8378": {
      "main": [
        [
          {
            "node": "4a50fc40-2859-42d4-87d3-6513e193fe17",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "bc5bb950-c03a-4b3c-a70d-6a75f1c5f953": {
      "main": [
        [
          {
            "node": "dcfd27a4-6345-40e5-8edd-125f3b5438dc",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "4a50fc40-2859-42d4-87d3-6513e193fe17": {
      "main": [
        [
          {
            "node": "50754308-afe4-4299-acc0-02aebf248af3",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "06cf291a-6f8d-4743-b8a1-1a17164508f0",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "b10b46ad-13df-4c1d-8608-21d3f8ba34f9",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "f333483a-4d84-4d8b-846d-13b408d264a8",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "f7883340-b00d-4c77-b1a6-f2a2512190bc",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "06cf291a-6f8d-4743-b8a1-1a17164508f0": {
      "main": [
        [
          {
            "node": "3f937b75-9107-4ea6-b2ab-3008eed89964",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "9fcf2dac-7101-42d8-9264-f84f0bd9bb47": {
      "main": [
        [
          {
            "node": "5211bfae-d7f2-4002-bb91-9268fbbbc0ba",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ed818fb1-8087-4c2e-b175-c9bc8ea36f82": {
      "ai_languageModel": [
        [
          {
            "node": "4a50fc40-2859-42d4-87d3-6513e193fe17",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "f7883340-b00d-4c77-b1a6-f2a2512190bc": {
      "main": [
        [
          {
            "node": "e0523a68-8870-43fd-a879-c6f57e825e8f",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "0c1e22e5-492d-48f9-bb9c-3387a85b16ee": {
      "main": [
        []
      ]
    }
  }
}
よくある質問

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

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

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

上級 - チケット管理, AI要約

有料ですか?

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

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

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

外部リンク
n8n.ioで表示

このワークフローを共有

カテゴリー

カテゴリー: 34