Azure OpenAI と Google テーブルを使ってメールを分類して Telegram へ通知を取得する

上級

これはTicket Management, AI Summarization分野の自動化ワークフローで、27個のノードを含みます。主にIf, Set, Telegram, Aggregate, GoogleSheetsなどのノードを使用。 Azure OpenAIとGoogleスプレッドシートでメールを分類し、Telegramへアラート

前提条件
  • Telegram Bot Token
  • Google Sheets API認証情報
  • OpenAI API Key
ワークフロープレビュー
ノード接続関係を可視化、ズームとパンをサポート
ワークフローをエクスポート
以下のJSON設定をn8nにインポートして、このワークフローを使用できます
{
  "meta": {
    "instanceId": "e8374ef357a4dd151dba539a0c026b33ff35e18a7f5d6e435d61090842b02c25",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "62007cb4-412a-4cea-8a10-fcc58f813e2f",
      "name": "メールトリガー (IMAP)",
      "type": "n8n-nodes-base.emailReadImap",
      "position": [
        96,
        48
      ],
      "parameters": {
        "options": {
          "customEmailConfig": "[\"UNSEEN\"]"
        }
      },
      "credentials": {
        "imap": {
          "id": "IxLAi5awFpDF110X",
          "name": "IMAP account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "8688b135-1382-4c4d-926a-a0ab7da0ebd1",
      "name": "Telegram トリガー",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        96,
        912
      ],
      "webhookId": "a066e218-8d0c-45bc-b88c-bbad04321cda",
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "id": "SHgYN8suaL9FpLHl",
          "name": "E-Mail Assistant"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "15329491-b4fb-4499-86dc-e1004de6d755",
      "name": "Send Security Message",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1392,
        -176
      ],
      "webhookId": "dc257d9b-7667-40b8-9af2-366b85f9bced",
      "parameters": {
        "text": "=Security Alert!\n\n{{ $('Mail Information').item.json.subject }}",
        "chatId": "={{ $('Get User ID').item.json.telegram_id }}",
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "id": "SHgYN8suaL9FpLHl",
          "name": "E-Mail Assistant"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "815a8df8-e8ee-4887-8830-83027e1d092d",
      "name": "Like im young again",
      "type": "n8n-nodes-base.noOp",
      "position": [
        1392,
        400
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "bb829d76-4f30-410f-9eb4-b0b422a5d086",
      "name": "Send Reply Message",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1392,
        208
      ],
      "webhookId": "dc257d9b-7667-40b8-9af2-366b85f9bced",
      "parameters": {
        "text": "=You have an update!\n\n{{ $('Mail Information').item.json.subject }}",
        "chatId": "={{ $('Get User ID').item.json.telegram_id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "SHgYN8suaL9FpLHl",
          "name": "E-Mail Assistant"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "3737550a-44c3-4bc4-8ec8-21a305ac0fb7",
      "name": "Send Personal Message",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1392,
        16
      ],
      "webhookId": "dc257d9b-7667-40b8-9af2-366b85f9bced",
      "parameters": {
        "text": "=Personal Message!\n\n{{ $('Mail Information').item.json.subject }}",
        "chatId": "={{ $('Get User ID').item.json.telegram_id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "SHgYN8suaL9FpLHl",
          "name": "E-Mail Assistant"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "dba90f07-f939-44da-b608-5a10177c8931",
      "name": "Nothing will change",
      "type": "n8n-nodes-base.noOp",
      "position": [
        1392,
        592
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "05b6c21c-3de2-48cb-994c-9d06ac1e6431",
      "name": "AI エージェント",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1024,
        1008
      ],
      "parameters": {
        "text": "={{ $('Telegram Trigger').item.json.message.text }}\n\n{{ $json.data }}",
        "options": {
          "systemMessage": "* You are a helpful e-mail assistant. \n\n* Call 'Update Status' tool when the user asks you to change the status of an e-mail row. \n\n* Every row has an e-mail description and a status (e.g, 'NOT CHECKED') except the first row (row_number = 1, this row mustn't be touched or changed)."
        },
        "promptType": "define"
      },
      "typeVersion": 2.1
    },
    {
      "id": "934bb1d5-3197-4d35-9748-9f572502a73f",
      "name": "Reply To User",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1456,
        1008
      ],
      "webhookId": "dc257d9b-7667-40b8-9af2-366b85f9bced",
      "parameters": {
        "text": "={{ $json.output }}",
        "chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "SHgYN8suaL9FpLHl",
          "name": "E-Mail Assistant"
        }
      },
      "executeOnce": true,
      "typeVersion": 1.2
    },
    {
      "id": "b363b0cd-093b-457d-b50a-9af72015d833",
      "name": "Azure OpenAI エージェント",
      "type": "@n8n/n8n-nodes-langchain.lmChatAzureOpenAi",
      "position": [
        992,
        1232
      ],
      "parameters": {
        "model": "gpt-4o-mini",
        "options": {}
      },
      "credentials": {
        "azureOpenAiApi": {
          "id": "kOa20xaefBLJqbOc",
          "name": "Azure Open AI account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "22f3cc3b-7a77-4ef1-9ca8-019030d71dcb",
      "name": "Azure OpenAI Classifier",
      "type": "@n8n/n8n-nodes-langchain.lmChatAzureOpenAi",
      "position": [
        1088,
        528
      ],
      "parameters": {
        "model": "gpt-4o-mini",
        "options": {}
      },
      "credentials": {
        "azureOpenAiApi": {
          "id": "kOa20xaefBLJqbOc",
          "name": "Azure Open AI account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "d193eaac-8bab-41ee-a609-007cf7826593",
      "name": "メモリ",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        1120,
        1232
      ],
      "parameters": {
        "sessionKey": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
        "sessionIdType": "customKey",
        "contextWindowLength": 10
      },
      "typeVersion": 1.3
    },
    {
      "id": "555e606d-ddb7-480a-aea0-5842feccd87c",
      "name": "付箋",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -32,
        -240
      ],
      "parameters": {
        "color": 4,
        "width": 1872,
        "height": 1744,
        "content": "# E-Mail Assistant"
      },
      "typeVersion": 1
    },
    {
      "id": "4e14f478-b3d8-4e6e-b0e2-60b512d6486b",
      "name": "Get E-Mails",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        320,
        1008
      ],
      "parameters": {
        "options": {},
        "filtersUI": {
          "values": [
            {
              "lookupValue": "NOT CHECKED",
              "lookupColumn": "Status"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1RvhFYhtXDfG3KOzwBzJku0Cq_hv8apzLuqyHsF4nKPo/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1RvhFYhtXDfG3KOzwBzJku0Cq_hv8apzLuqyHsF4nKPo",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1RvhFYhtXDfG3KOzwBzJku0Cq_hv8apzLuqyHsF4nKPo/edit?usp=drivesdk",
          "cachedResultName": "mail_data"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "jnXJ1hO67Y1mCTF4",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.6,
      "alwaysOutputData": true
    },
    {
      "id": "da0cf3bb-0fb6-4cd0-abc9-8b9266b1b6a3",
      "name": "If Null",
      "type": "n8n-nodes-base.if",
      "position": [
        768,
        48
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "af1d4d81-8e44-47cc-bcbb-7db869a56bb2",
              "operator": {
                "type": "string",
                "operation": "empty",
                "singleValue": true
              },
              "leftValue": "={{ $json.Sender }}",
              "rightValue": ""
            },
            {
              "id": "7752f49f-4983-4278-95b7-dbe5e61acd6b",
              "operator": {
                "type": "string",
                "operation": "empty",
                "singleValue": true
              },
              "leftValue": "={{ $json.subject }}",
              "rightValue": ""
            },
            {
              "id": "b5323873-bfa8-4456-b418-6181be122834",
              "operator": {
                "type": "string",
                "operation": "empty",
                "singleValue": true
              },
              "leftValue": "={{ $json.date }}",
              "rightValue": ""
            },
            {
              "id": "36f65217-a58f-4b6c-a311-ed38e4d6e2ae",
              "operator": {
                "type": "string",
                "operation": "empty",
                "singleValue": true
              },
              "leftValue": "={{ $json.receiver_mail }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "d3bb6420-f362-4fff-ba5e-5f86d0d8e74d",
      "name": "Nothing",
      "type": "n8n-nodes-base.noOp",
      "position": [
        1088,
        -144
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "3e98774d-ceb0-4497-9fb1-68af6101640f",
      "name": "Update Status",
      "type": "n8n-nodes-base.googleSheetsTool",
      "position": [
        1248,
        1232
      ],
      "parameters": {
        "columns": {
          "value": {
            "Status": "={{ $fromAI('Status', `This is the column to update.`, 'string') }}",
            "row_number": "={{ $fromAI('row_number__using_to_match_', `The row number of the mail description the user has mentioned.`, 'number') }}"
          },
          "schema": [
            {
              "id": "E-Mail Subject",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "E-Mail Subject",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Status",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "type": "number",
              "display": true,
              "removed": false,
              "readOnly": true,
              "required": false,
              "displayName": "row_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "row_number"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1RvhFYhtXDfG3KOzwBzJku0Cq_hv8apzLuqyHsF4nKPo/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1RvhFYhtXDfG3KOzwBzJku0Cq_hv8apzLuqyHsF4nKPo",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1RvhFYhtXDfG3KOzwBzJku0Cq_hv8apzLuqyHsF4nKPo/edit?usp=drivesdk",
          "cachedResultName": "mail_data"
        },
        "descriptionType": "manual",
        "toolDescription": "Update the row values of 'Status' column in Google Sheets."
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "jnXJ1hO67Y1mCTF4",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "dcf43602-2a94-415a-91f7-08cc2b1132b2",
      "name": "Append Mail Details",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1616,
        112
      ],
      "parameters": {
        "columns": {
          "value": {
            "Status": "NOT CHECKED",
            "E-Mail Subject": "={{ $('Mail Information').item.json.subject }}"
          },
          "schema": [
            {
              "id": "E-Mail Subject",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "E-Mail Subject",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Status",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {
          "useAppend": true
        },
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1RvhFYhtXDfG3KOzwBzJku0Cq_hv8apzLuqyHsF4nKPo/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1RvhFYhtXDfG3KOzwBzJku0Cq_hv8apzLuqyHsF4nKPo",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1RvhFYhtXDfG3KOzwBzJku0Cq_hv8apzLuqyHsF4nKPo/edit?usp=drivesdk",
          "cachedResultName": "mail_data"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "jnXJ1hO67Y1mCTF4",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "3511ffd9-a9c7-404e-80d1-df54893900d7",
      "name": "Append User ID",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        320,
        816
      ],
      "parameters": {
        "columns": {
          "value": {
            "telegram_id": "={{ $json.message.chat.id }}"
          },
          "schema": [
            {
              "id": "telegram_id",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "telegram_id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "telegram_id"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1yCsrHFmkn7WRONBWztzi5ZpVE8_sl3hsfsF-DlpnOwc/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1yCsrHFmkn7WRONBWztzi5ZpVE8_sl3hsfsF-DlpnOwc",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1yCsrHFmkn7WRONBWztzi5ZpVE8_sl3hsfsF-DlpnOwc/edit?usp=drivesdk",
          "cachedResultName": "user_ids_mail_assistant"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "jnXJ1hO67Y1mCTF4",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "a9dfe499-8378-4665-a509-8a196e694a49",
      "name": "Get User ID",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        320,
        48
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1yCsrHFmkn7WRONBWztzi5ZpVE8_sl3hsfsF-DlpnOwc/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1yCsrHFmkn7WRONBWztzi5ZpVE8_sl3hsfsF-DlpnOwc",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1yCsrHFmkn7WRONBWztzi5ZpVE8_sl3hsfsF-DlpnOwc/edit?usp=drivesdk",
          "cachedResultName": "user_ids_mail_assistant"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "jnXJ1hO67Y1mCTF4",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "0fdcee2c-e100-4043-8df2-1fae46183b0d",
      "name": "付箋1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -608,
        -240
      ],
      "parameters": {
        "width": 560,
        "height": 864,
        "content": "# Setting Up The Workflow\n\n## Credentials:\n\n- IMAP Email Trigger: Set up a new credential by adding an app key that you must generate in your Gmail account. Refer to documentation for step-by-step guide. \n\nhttps://docs.n8n.io/integrations/builtin/credentials/imap/gmail/#enable-2-step-verification\n\n- Google Sheets: Working with Google API can be messy but there is a step-by-step guide for how to enable API's and use them. This guide is not specifically for Google Sheets since you can enable all API's from the same page. Shortly;\n   - Login in your Google Cloud,\n   - Create project,\n   - Enable the necessary API's,\n   - Configure OAuth page,\n   - Create credentials.\n\nhttps://docs.n8n.io/integrations/builtin/credentials/google/oauth-single-service/?utm_source=n8n_app&utm_medium=credential_settings&utm_campaign=create_new_credentials_modal\n\n- AI Model: I use Microsoft Azure OpenAI Chat Models since I'm more familiar with Microsoft. You can use OpenRouter, OpenAI, Google Gemini or any other model that you have already integrated.\n\n- Telegram: You need to create a Telegram Bot of your own to use this workflow. You may already be familiar with the process but it's basically just a simple chat with @botfather in Telegram. After BotFather generates an access token you set up a new telegram credential and add your token; it's the only thing you need to set up a Telegram connection. However here is the documentation for a clean guide:\n\nhttps://docs.n8n.io/integrations/builtin/credentials/telegram/?utm_source=n8n_app&utm_medium=credential_settings&utm_campaign=create_new_credentials_modal\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "e9d49ec5-961d-473c-82dc-3f16a2f4d7ee",
      "name": "付箋2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -608,
        640
      ],
      "parameters": {
        "width": 560,
        "height": 864,
        "content": "# What You Have To Know\n\n## About the workflow:\n\n - This is a working example of a personal E-mail assistant that informs you about every new E-mail you receive. I have mentioned how to integrate Gmail with this workflow but it's possible to integrate other work mail addresses too.\n\n## Categories\n\n- The node text classifier has five different categories. Every mail you receive falls under one category:\n   - Security: Basically alerts you about the safety of your accounts. Password changes, Login from new locations etc.\n   - Personal: Any mail that seems to be personal. Although I don't think your crush is going to open up in an e-mail, I still added this category.\n   - Updates: This category is important too. Any updates from work, communities, reddit or any kind of reply falls under this category. In short, it keeps you tuned on topics you follow.\n   - Advertisement: Any bloodsucking, life draining mails fall under this category. The workflow doesn't inform you about it but you can change what happens afterwards.\n   - Unimportant: This is 'Other' category. Usually I don't need it. I made it so the AI doesn't get stuck if a mail doesn't fall under any of the categories above.\n   - You can change descriptions, add or edit categories to match your daily received mails.\n\n## Important:\n- Make sure the names of sheets match the ones in the workflow so you don't have to deal with errors.\n- Since this is a personal workflow, you can either add the Telegram Chat ID manually or just message the bot. When you message the bot, your chat_id will be stored in a sheet that will be used in the first part of the workflow.\n- Again, this is a simple workflow. Basically I just gave you the logic. You can make it better, I believe in you."
      },
      "typeVersion": 1
    },
    {
      "id": "87820e2c-71fa-4670-82ea-56aed400500e",
      "name": "付箋3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1856,
        -240
      ],
      "parameters": {
        "width": 544,
        "height": 1744,
        "content": "# How It Works\n\n## Part One\n\n- This part is triggered when an E-Mail is received. Any kind of E-Mail to be specific.\n\n- 'Get User ID' node takes the ID that had been stored in the sheet and passes it through to be used in the next node 'Information'. For this node to work, you can either add your Telegram Chat ID manually or trigger the next part by messaging the bot.\n\n- 'Information' node extracts the important details of the E-Mail you receive like subject, sender etc. And passes them to the classifier.\n\n- 'If Null' node has a single purpose, and it's to make sure all details are present.\n\n- The classifier will read the details and categorize the E-Mail under one category, which has it's own flow. If it's personal, security related or an update it will send you a message on telegram to notify you then the details will be added to a sheet that can be used by the Agent in part two. It will also mark them as NOT CHECKED automatically. You can change that by telling the bot so. If it's an advertisement or unimportant the workflow doesn't do anything.\n\n## Part Two\n\n- This part is triggered when the bot receives a message on Telegram from you.\n\n- After the message is received the workflow does two things;\n   - It extracts your chat ID and appends it to a google sheet that will be used in part one. This is why I suggested you to trigger part two first.\n   - It triggers the 'Get E-Mails' node which will get the E-Mails that are marked as NOT CHECKED. This will allow you to ask the agent about the E-Mails that you didn't have time to check.\n\n- Aggregator combines all rows into a single item. Which is easier to address and necessary for the AI Agent node.\n\n- 'Set Rows as Data' takes that array and turns it into readable data for the AI. Usually arrays return [object Object] instead of their content, this prevents it.\n\n- The AI Agent node has a short system message. I didn't make it long because it's personal. If you wish to make this workflow an app you have to make the system prompt bulletproof. This agent has access to 'Update Status' tool which changes the status of an E-Mail when you ask the agent to mark it as CHECKED.\n\n- I used a simple memory because I want to limit the token usage. You can change this node to make it larger if you wish to.\n\n- 'Reply To User' node simply sends the output of the AI to you allowing you chat with the bot.\n\n- You can also change the Telegram Trigger settings and restrict it to your chat ID. This prevents others from using your bot."
      },
      "typeVersion": 1
    },
    {
      "id": "37dec678-e11a-4851-ba8c-fd7b3e034030",
      "name": "設定 Rows as Data",
      "type": "n8n-nodes-base.set",
      "position": [
        768,
        1008
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "6de7aa2b-9f2a-4c9a-892a-d1e27e50d992",
              "name": "data",
              "type": "string",
              "value": "={{ $json.combinedRows }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "7f6ed5ab-4a35-4209-a000-b35cdb6e76db",
      "name": "集計",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        544,
        1008
      ],
      "parameters": {
        "options": {},
        "aggregate": "aggregateAllItemData",
        "destinationFieldName": "combinedRows"
      },
      "typeVersion": 1
    },
    {
      "id": "579c5da0-1f18-4973-9252-3100735a3d50",
      "name": "Mail Information",
      "type": "n8n-nodes-base.set",
      "position": [
        544,
        48
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "6e4ca430-c142-485e-853b-6e27e2e104be",
              "name": "Sender",
              "type": "string",
              "value": "={{ $('Email Trigger (IMAP)').item.json.from }}"
            },
            {
              "id": "3fd4022d-a20a-4c29-8b8c-e726a4b81986",
              "name": "subject",
              "type": "string",
              "value": "={{ $('Email Trigger (IMAP)').item.json.subject }}"
            },
            {
              "id": "92ba2410-7ee9-41c6-afb3-fff968d3318a",
              "name": "date",
              "type": "string",
              "value": "={{ $('Email Trigger (IMAP)').item.json.date }}"
            },
            {
              "id": "36b301ff-9bf6-4c4e-b08d-e5eefdfa211c",
              "name": "receiver_mail",
              "type": "string",
              "value": "={{ $('Email Trigger (IMAP)').item.json.to }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "e6d58a29-1bfb-4cba-88ad-31628d15786e",
      "name": "E-Mail テキスト分類器",
      "type": "@n8n/n8n-nodes-langchain.textClassifier",
      "position": [
        992,
        208
      ],
      "parameters": {
        "options": {},
        "inputText": "={{ $json.subject }}\n\n{{ $json.date }}\n{{ $json.Sender }}",
        "categories": {
          "categories": [
            {
              "category": "Security",
              "description": "Everything about security. Password changes, new and different logins, account in danger etc."
            },
            {
              "category": "Personal",
              "description": "E-mails from friends, colleagues, coworkers, family..."
            },
            {
              "category": "Updates",
              "description": "Replies, community updates; updates or confirmations of accounts. Ticket replies, bills, invoices, office mails etc."
            },
            {
              "category": "Advertisement",
              "description": "Anything that seems to advertise a product or a service. "
            },
            {
              "category": "Unimportant",
              "description": "Anything that doesn't fit in ad, security, updates or family categories."
            }
          ]
        }
      },
      "typeVersion": 1.1
    }
  ],
  "pinData": {},
  "connections": {
    "Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "da0cf3bb-0fb6-4cd0-abc9-8b9266b1b6a3": {
      "main": [
        [
          {
            "node": "d3bb6420-f362-4fff-ba5e-5f86d0d8e74d",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "E-Mail Text Classifier",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "934bb1d5-3197-4d35-9748-9f572502a73f",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Aggregate": {
      "main": [
        [
          {
            "node": "Set Rows as Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "4e14f478-b3d8-4e6e-b0e2-60b512d6486b": {
      "main": [
        [
          {
            "node": "Aggregate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "a9dfe499-8378-4665-a509-8a196e694a49": {
      "main": [
        [
          {
            "node": "579c5da0-1f18-4973-9252-3100735a3d50",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "3e98774d-ceb0-4497-9fb1-68af6101640f": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "3511ffd9-a9c7-404e-80d1-df54893900d7": {
      "main": [
        []
      ]
    },
    "579c5da0-1f18-4973-9252-3100735a3d50": {
      "main": [
        [
          {
            "node": "da0cf3bb-0fb6-4cd0-abc9-8b9266b1b6a3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Rows as Data": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "4e14f478-b3d8-4e6e-b0e2-60b512d6486b",
            "type": "main",
            "index": 0
          },
          {
            "node": "3511ffd9-a9c7-404e-80d1-df54893900d7",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Azure OpenAI Agent": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "bb829d76-4f30-410f-9eb4-b0b422a5d086": {
      "main": [
        [
          {
            "node": "dcf43602-2a94-415a-91f7-08cc2b1132b2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "dba90f07-f939-44da-b608-5a10177c8931": {
      "main": [
        []
      ]
    },
    "Email Trigger (IMAP)": {
      "main": [
        [
          {
            "node": "a9dfe499-8378-4665-a509-8a196e694a49",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "3737550a-44c3-4bc4-8ec8-21a305ac0fb7": {
      "main": [
        [
          {
            "node": "dcf43602-2a94-415a-91f7-08cc2b1132b2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "15329491-b4fb-4499-86dc-e1004de6d755": {
      "main": [
        [
          {
            "node": "dcf43602-2a94-415a-91f7-08cc2b1132b2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "E-Mail Text Classifier": {
      "main": [
        [
          {
            "node": "15329491-b4fb-4499-86dc-e1004de6d755",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "3737550a-44c3-4bc4-8ec8-21a305ac0fb7",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "bb829d76-4f30-410f-9eb4-b0b422a5d086",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "815a8df8-e8ee-4887-8830-83027e1d092d",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "dba90f07-f939-44da-b608-5a10177c8931",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "22f3cc3b-7a77-4ef1-9ca8-019030d71dcb": {
      "ai_languageModel": [
        [
          {
            "node": "E-Mail Text Classifier",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    }
  }
}
よくある質問

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

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

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

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

有料ですか?

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

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

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

作成者
外部リンク
n8n.ioで表示

このワークフローを共有

カテゴリー

カテゴリー: 34