{
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "62007cb4-412a-4cea-8a10-fcc58f813e2f",
      "name": "Email Trigger (IMAP)",
      "type": "n8n-nodes-base.emailReadImap",
      "position": [
        96,
        48
      ],
      "parameters": {
        "options": {
          "customEmailConfig": "[\"UNSEEN\"]"
        }
      },
      "credentials": {
        "imap": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "8688b135-1382-4c4d-926a-a0ab7da0ebd1",
      "name": "Telegram Trigger",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        96,
        912
      ],
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "15329491-b4fb-4499-86dc-e1004de6d755",
      "name": "Send Security Message",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1392,
        -176
      ],
      "parameters": {
        "text": "=Security Alert!\n\n{{ $('Mail Information').item.json.subject }}",
        "chatId": "={{ $('Get User ID').item.json.telegram_id }}",
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "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
      ],
      "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": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "3737550a-44c3-4bc4-8ec8-21a305ac0fb7",
      "name": "Send Personal Message",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1392,
        16
      ],
      "parameters": {
        "text": "=Personal Message!\n\n{{ $('Mail Information').item.json.subject }}",
        "chatId": "={{ $('Get User ID').item.json.telegram_id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "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 Agent",
      "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
      ],
      "parameters": {
        "text": "={{ $json.output }}",
        "chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "executeOnce": true,
      "typeVersion": 1.2
    },
    {
      "id": "b363b0cd-093b-457d-b50a-9af72015d833",
      "name": "Azure OpenAI Agent",
      "type": "@n8n/n8n-nodes-langchain.lmChatAzureOpenAi",
      "position": [
        992,
        1232
      ],
      "parameters": {
        "model": "gpt-4o-mini",
        "options": {}
      },
      "credentials": {
        "azureOpenAiApi": {
          "name": "<your credential>"
        }
      },
      "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": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "d193eaac-8bab-41ee-a609-007cf7826593",
      "name": "Memory",
      "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": "Sticky Note",
      "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/YOUR_AWS_SECRET_KEY_HERE_hv8apzLuqyHsF4nKPo/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1RvhFYhtXDfG3KOzwBzJku0Cq_hv8apzLuqyHsF4nKPo",
          "cachedResultUrl": "https://docs.google.com/YOUR_AWS_SECRET_KEY_HERE_hv8apzLuqyHsF4nKPo/edit?usp=drivesdk",
          "cachedResultName": "mail_data"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "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/YOUR_AWS_SECRET_KEY_HERE_hv8apzLuqyHsF4nKPo/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1RvhFYhtXDfG3KOzwBzJku0Cq_hv8apzLuqyHsF4nKPo",
          "cachedResultUrl": "https://docs.google.com/YOUR_AWS_SECRET_KEY_HERE_hv8apzLuqyHsF4nKPo/edit?usp=drivesdk",
          "cachedResultName": "mail_data"
        },
        "descriptionType": "manual",
        "toolDescription": "Update the row values of 'Status' column in Google Sheets."
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "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/YOUR_AWS_SECRET_KEY_HERE_hv8apzLuqyHsF4nKPo/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1RvhFYhtXDfG3KOzwBzJku0Cq_hv8apzLuqyHsF4nKPo",
          "cachedResultUrl": "https://docs.google.com/YOUR_AWS_SECRET_KEY_HERE_hv8apzLuqyHsF4nKPo/edit?usp=drivesdk",
          "cachedResultName": "mail_data"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "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": {
          "name": "<your credential>"
        }
      },
      "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": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "0fdcee2c-e100-4043-8df2-1fae46183b0d",
      "name": "Sticky Note1",
      "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": "Sticky Note2",
      "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": "Sticky Note3",
      "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": "Set 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": "Aggregate",
      "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 Text Classifier",
      "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
    }
  ],
  "connections": {
    "Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "If Null": {
      "main": [
        [
          {
            "node": "Nothing",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "E-Mail Text Classifier",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Reply To User",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Aggregate": {
      "main": [
        [
          {
            "node": "Set Rows as Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get E-Mails": {
      "main": [
        [
          {
            "node": "Aggregate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get User ID": {
      "main": [
        [
          {
            "node": "Mail Information",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update Status": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Append User ID": {
      "main": [
        []
      ]
    },
    "Mail Information": {
      "main": [
        [
          {
            "node": "If Null",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Rows as Data": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "Get E-Mails",
            "type": "main",
            "index": 0
          },
          {
            "node": "Append User ID",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Azure OpenAI Agent": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Send Reply Message": {
      "main": [
        [
          {
            "node": "Append Mail Details",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Nothing will change": {
      "main": [
        []
      ]
    },
    "Email Trigger (IMAP)": {
      "main": [
        [
          {
            "node": "Get User ID",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Personal Message": {
      "main": [
        [
          {
            "node": "Append Mail Details",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Security Message": {
      "main": [
        [
          {
            "node": "Append Mail Details",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "E-Mail Text Classifier": {
      "main": [
        [
          {
            "node": "Send Security Message",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send Personal Message",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send Reply Message",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Like im young again",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Nothing will change",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Azure OpenAI Classifier": {
      "ai_languageModel": [
        [
          {
            "node": "E-Mail Text Classifier",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    }
  }
}