🛃 Gestor de bandeja de entrada

Avanzado

Este es unTicket Management, AI RAGflujo de automatización del dominio deautomatización que contiene 41 nodos.Utiliza principalmente nodos como If, Gmail, Switch, Telegram, GmailTool. Sistema automatizado de gestión de correos usando GPT-5, agentes de IA múltiples y base de datos Pinecone

Requisitos previos
  • Cuenta de Google y credenciales de API de Gmail
  • Bot Token de Telegram
  • Clave de API de OpenAI
  • Clave de API de Pinecone
Vista previa del flujo de trabajo
Visualización de las conexiones entre nodos, con soporte para zoom y panorámica
Exportar flujo de trabajo
Copie la siguiente configuración JSON en n8n para importar y usar este flujo de trabajo
{
  "id": "fBNlWkUYOtZBLaCW",
  "meta": {
    "instanceId": "78a1670eff69dde15237f8eb0f091c143c10cc5aee229aa0485d9ac17fc48ce6",
    "templateCredsSetupCompleted": true
  },
  "name": "🛃 Inbox Manager",
  "tags": [],
  "nodes": [
    {
      "id": "6f7313b8-998e-4d95-acbf-d6bc15c7d732",
      "name": "Disparador de Gmail",
      "type": "n8n-nodes-base.gmailTrigger",
      "position": [
        -512,
        -16
      ],
      "parameters": {
        "simple": false,
        "filters": {},
        "options": {},
        "pollTimes": {
          "item": [
            {}
          ]
        }
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "3ayhzuWezVASgiY3",
          "name": "Gmail account"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "81fe47ea-54df-4f75-8af8-cbe5fc97b9e3",
      "name": "Sin operación, do nothing",
      "type": "n8n-nodes-base.noOp",
      "position": [
        208,
        1616
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "758cc80b-aa48-43d0-b2ff-e681ddd48c49",
      "name": "Incrustaciones OpenAI",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "position": [
        432,
        -544
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "bNSgNFwMYVwTQBvV",
          "name": "n8n free OpenAI API credits"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "f50f02b8-022b-4021-9f01-9e7a11ef15de",
      "name": "Reply Correo electrónico",
      "type": "n8n-nodes-base.gmail",
      "position": [
        736,
        -896
      ],
      "webhookId": "6b6b3dd8-f052-4f44-b2f3-8c98312d6f89",
      "parameters": {
        "message": "={{ $json.output }}",
        "options": {
          "appendAttribution": false
        },
        "emailType": "text",
        "messageId": "={{ $('Gmail Trigger').item.json.id }}",
        "operation": "reply"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "3ayhzuWezVASgiY3",
          "name": "Gmail account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "8a9e3306-aa3f-4acc-86cd-e9e891e94d8c",
      "name": "Customer Support Agente",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        368,
        -896
      ],
      "parameters": {
        "text": "={{ $json.text }}",
        "options": {
          "systemMessage": "=# Overview\nYou are a customer support agent. Your role is to respond to incoming emails with relevant information using the Database of FAQs and Policies tool. \n\n## Instructions\n- Use a friendly and engaging tone.\n- Sign off as \"Customer Support Team\"\n\n## Output\n- Output only the body content of the email"
        },
        "promptType": "define"
      },
      "typeVersion": 2.2
    },
    {
      "id": "8d388b51-fc82-4ebd-8dd1-3fe18519d106",
      "name": "Finance Agente",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        336,
        -80
      ],
      "parameters": {
        "text": "=Here's a new email that came in: {{ $('Gmail Trigger').item.json.id }}\n\nSubject : {{ $('Gmail Trigger').item.json.headers.subject }}\nFrom : {{ $('Gmail Trigger').item.json.headers.from }}\nEmail body : {{ $('Gmail Trigger').item.json.text }}\n",
        "options": {
          "systemMessage": "=# Overview\nYou are a finance agent. Your role is to review incoming emails related to vendor payments or customer receipts and provide user with a summary of key details clearly and concisely. \n\n## Instructions\n- Label the email as Finance\n- Based on the input, classify if email is payment or receipts-related and reply according to the output\n- Vendor payment emails are those where sender is from any of the vendors talking about payments that I need to make\n- Receipts are those where sender is from customers who have paid for my services\n\n"
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "244affcf-3bda-4fc7-8e3c-2dcda53bc3cc",
      "name": "Leads Agente",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        448,
        592
      ],
      "parameters": {
        "text": "=Subject : {{ $json.headers.subject }}\nFrom : {{ $json.headers.from }}\nEmail : {{ $json.text }}",
        "options": {
          "systemMessage": "=# Overview\nYou are a sales leads agent. Your role is to review incoming emails from prospects that are sales-related and could be leads with inquiries requesting to book a discovery call or have questions about the services provided. \n\n## Instructions\n- Label the email as sales opportunities\n- If the email is about inquiries about the services, look to the database knowledge to find out an answer, draft an email reply, then notify me via telegram\n- If unsure what to reply, escalate it so I receive a notification via telegram text.\n\n\n"
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "625a8b76-8523-4ddf-a3e6-bc503034e20c",
      "name": "Nota adhesiva",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        192,
        -1056
      ],
      "parameters": {
        "width": 1184,
        "height": 672,
        "content": "## Customer Support\n- Any queries related to questions on FAQ by customers or policies, warranty etc, will be routed here.\n- Setup pinecone vector database with documents that contain your FAQs and policies \n- The agent will reply the customer based on knowledge in the Pinecone database. \n- Once replied, the email thread will be labelled as \"Customer Support\"."
      },
      "typeVersion": 1
    },
    {
      "id": "2e49380c-20bf-4909-9507-37e1b653e05c",
      "name": "Internal Agente",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        480,
        1264
      ],
      "parameters": {
        "text": "=Subject : {{ $json.headers.subject }}\nFrom : {{ $json.headers.from }}\nEmail : {{ $json.text }}",
        "options": {
          "systemMessage": "# Overview\nYou are an executive assistant that handles income emails from internal team members\n\n## Instructions\n- For emails that come from internal team, label them as Internal\n- Send a summary of the email and from who to user"
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "6c233cf9-212b-4e9e-bf88-fd8a38752f68",
      "name": "Label as Customer Support",
      "type": "n8n-nodes-base.gmail",
      "position": [
        960,
        -896
      ],
      "webhookId": "aadb0038-d592-444b-a1d5-11100339b27c",
      "parameters": {
        "labelIds": [
          "Label_4183721284522273805"
        ],
        "messageId": "={{ $('Gmail Trigger').item.json.id }}",
        "operation": "addLabels"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "3ayhzuWezVASgiY3",
          "name": "Gmail account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "cf82a1a4-b002-4235-82af-63f18942bd5b",
      "name": "Label as Finance",
      "type": "n8n-nodes-base.gmailTool",
      "position": [
        416,
        96
      ],
      "webhookId": "524d3a64-ad94-49a9-8930-71ac5fb464c8",
      "parameters": {
        "labelIds": [
          "Label_1601308720640490413"
        ],
        "messageId": "={{ $('Gmail Trigger').item.json.id }}",
        "operation": "addLabels"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "3ayhzuWezVASgiY3",
          "name": "Gmail account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "02babaee-e872-45c8-b4e4-aab19c062b0d",
      "name": "Label as Sales Opportunities",
      "type": "n8n-nodes-base.gmailTool",
      "position": [
        416,
        816
      ],
      "webhookId": "a01fb0ae-7d1d-4113-9edd-2ada8f69e4e9",
      "parameters": {
        "labelIds": [
          "Label_3532739869741947436"
        ],
        "messageId": "={{ $('Gmail Trigger').item.json.id }}",
        "operation": "addLabels"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "3ayhzuWezVASgiY3",
          "name": "Gmail account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "9dc5dbaa-9b5e-449f-8c3b-5f8c645ac779",
      "name": "Nota adhesiva1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        192,
        -368
      ],
      "parameters": {
        "color": 5,
        "width": 1184,
        "height": 656,
        "content": "## Finance Agent\n- Handles any email query finance-related. \n- The agent first labels the email as \"Finance\"\n- It then reviews the email to see if it is related to payments or invoices\n- The structured output parser specifies the agent's output : agent's classification of whether email is a customer receipt or vendor invoice\n- For emails relating to vendor payments to be made, an email will be sent to the payments team to make the payment. \n- At the same time, user will be notified amount to be paid via telegram. **Note to input your personal chat ID in the telegram node\n- For emails relating to customer receipts, email will be sent to the receivables team to expect this amount from the customer.\n- User will also be notified of the amount to be paid via telegram.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "9d203fa1-a54c-42ef-9886-4163a3123314",
      "name": "Nota adhesiva2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        192,
        304
      ],
      "parameters": {
        "color": 4,
        "width": 1184,
        "height": 800,
        "content": "## Sales/Leads Agent \n- Identifies any emails about sales opportunities. \n- The agent first labels the email as \"sales opportunities\"\n- Setup a pinecone vector database that contains data related to the business eg. packages, scope of service, price range etc\n- The agent will use this knowledge database to generate a response to the query\n- The structured output parser specifies the output: drafted email, short explanation for the generated response, and whether this needs to be escalated to user.\n- If agent can draft an email based on knowledge database, it would draft with gmail and user will be notified via telegram. Else, it would send a telegram message to the user that it doesn't have the knowledge to reply the email. **Note to input your personal chat ID in the telegram node\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "024318eb-5e25-494b-a3c6-72256ca7382e",
      "name": "Nota adhesiva3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        192,
        1120
      ],
      "parameters": {
        "color": 6,
        "width": 1184,
        "height": 448,
        "content": "## Internal Agent \n- Any emails by team members will be routed here.\n- The agent will label it as \"internal\" and send a telegram message summarising its contents. **Note to input your personal ChatID in the telegram node\n"
      },
      "typeVersion": 1
    },
    {
      "id": "0dfb0bbd-ab6c-4db6-97d2-e45983e996f2",
      "name": "Incrustaciones OpenAI1",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "position": [
        608,
        944
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "bNSgNFwMYVwTQBvV",
          "name": "n8n free OpenAI API credits"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "2f643199-bc20-4e8a-8a83-c8a4697f4514",
      "name": "Database of FAQs and Policies",
      "type": "@n8n/n8n-nodes-langchain.vectorStorePinecone",
      "position": [
        448,
        -688
      ],
      "parameters": {
        "mode": "retrieve-as-tool",
        "options": {
          "pineconeNamespace": "FAQ"
        },
        "pineconeIndex": {
          "__rl": true,
          "mode": "list",
          "value": "chatbot",
          "cachedResultName": "chatbot"
        },
        "toolDescription": "Call this tool to access Policy and FAQ information"
      },
      "credentials": {
        "pineconeApi": {
          "id": "bqH6qbFYtDUXMpn3",
          "name": "PineconeApi v2"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "ab484b41-257e-4fb5-aaf9-ab5c52e8f9d3",
      "name": "Needs Review?",
      "type": "n8n-nodes-base.if",
      "position": [
        848,
        592
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "dc85cfc2-9c10-490b-beb7-aa7db8f7bf9f",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{ $json.output.escalate }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "c858664a-5f23-49a3-9f5a-3248d11caf6f",
      "name": "GPT 4o mini",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        304,
        -688
      ],
      "parameters": {
        "model": "openai/gpt-4o-mini",
        "options": {}
      },
      "credentials": {
        "openRouterApi": {
          "id": "8YhGo1rl7F0epmIo",
          "name": "OpenRouter account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "21182b0b-a8c3-4e2c-b55a-0a0fa640497c",
      "name": "GPT 4o mini1",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        256,
        96
      ],
      "parameters": {
        "model": "openai/gpt-4o-mini",
        "options": {}
      },
      "credentials": {
        "openRouterApi": {
          "id": "8YhGo1rl7F0epmIo",
          "name": "OpenRouter account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "aed022a4-79e1-4233-96bb-464ccb6b103a",
      "name": "GPT 4o mini2",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        256,
        816
      ],
      "parameters": {
        "model": "openai/gpt-4o-mini",
        "options": {}
      },
      "credentials": {
        "openRouterApi": {
          "id": "8YhGo1rl7F0epmIo",
          "name": "OpenRouter account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "209217da-45df-4170-8876-bb2b39de9428",
      "name": "GPT 4o mini3",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        400,
        1424
      ],
      "parameters": {
        "model": "openai/gpt-4o-mini",
        "options": {}
      },
      "credentials": {
        "openRouterApi": {
          "id": "8YhGo1rl7F0epmIo",
          "name": "OpenRouter account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "80791e3c-3b1c-498d-a89c-074aa1b226b8",
      "name": "Inbox Router",
      "type": "@n8n/n8n-nodes-langchain.textClassifier",
      "position": [
        -240,
        -64
      ],
      "parameters": {
        "options": {},
        "inputText": "=From: {{ $json.headers.from }}\nSubject: {{ $json.headers.subject }}\nEmail body: {{ $json.text }}",
        "categories": {
          "categories": [
            {
              "category": "Customer Support",
              "description": "An email that is related to helping out a customer. They may be asking questions about our service requests, feedback, policies or questions about our product or services, support tickets, inquiries. Keywords: request, inquiry, support, question, follow-up, feedback."
            },
            {
              "category": "Finance",
              "description": "An email related to finances and accounting. These include invoices, billing statements, payment reminders, or expense reports. Keywords: invoice, payment, billing, receipt, financial, expense, account."
            },
            {
              "category": "Others",
              "description": "Any other emails that do not fall in any other category"
            },
            {
              "category": "Sales Opportunities",
              "description": "Emails related to sales which include service inquiries, pricing requests, referrals, new inquiries, booking calls, interested leads."
            },
            {
              "category": "Internal",
              "description": "Emails from the parent domain (xxx.com) from employees."
            }
          ]
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "8913afc7-bd15-45f7-8d99-90c896220032",
      "name": "Route by Correo electrónico Type",
      "type": "n8n-nodes-base.switch",
      "position": [
        656,
        -80
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "Customer Receipts",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "f1922a62-8706-4edc-b1d7-6ce7d49f01ea",
                    "operator": {
                      "type": "boolean",
                      "operation": "true",
                      "singleValue": true
                    },
                    "leftValue": "={{ $json.output.emailType }}",
                    "rightValue": ""
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Vendor Invoice",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "474a86d4-7267-4c53-9153-54697e48a36b",
                    "operator": {
                      "type": "boolean",
                      "operation": "false",
                      "singleValue": true
                    },
                    "leftValue": "={{ $json.output.emailType }}",
                    "rightValue": ""
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.2
    },
    {
      "id": "9bd4da70-dcc0-411b-94ad-d9b8e3776403",
      "name": "OutputFormat",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        560,
        96
      ],
      "parameters": {
        "schemaType": "manual",
        "inputSchema": "{\n\t\"type\": \"object\",\n\t\"properties\": {\n\t\t\"emailType\": {\n\t\t\t\"type\": \"boolean\",\n            \"description\": \"True if email is customer receipts and False if vendor invoice\"\n\t\t},\n      \"emailBody\": {\n        \"type\": \"string\",\n        \"description\": \"Summary of the email content\"\n      },\n    \"Amount\":{\n      \"type\": \"number\",\n      \"description\": \"Amount stated in the email to be paid or have received\"\n\t},\n      \"From\": {\n        \"type\": \"string\",\n        \"description\":\"who the email is from\"\n      },\n        \"DueDate\": {\n        \"type\": \"string\",\n        \"description\":\"invoice payment due date\"\n      }\n  }\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "fb30770c-95fe-41d6-a4a4-78435f208df9",
      "name": "Notify Amount Received",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1120,
        -96
      ],
      "webhookId": "3d493d94-8cbf-4def-9f42-088891197598",
      "parameters": {
        "text": "=📥 Income-ing! ${{ $json.output.Amount }} from {{ $json.output.From.split('<')[0].trim() }}",
        "chatId": "=",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "GroO0akGb3u44nyE",
          "name": "Telegram: PA"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "db1f46b9-b2bc-4584-b08e-a15420128415",
      "name": "Notify Amount to Pay",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1120,
        80
      ],
      "webhookId": "2ceb728e-e912-4a9d-899b-8f1927947e3b",
      "parameters": {
        "text": "=💲Pay ${{ $json.output.Amount }} to {{ $json.output.From.split('<')[0].trim() }}",
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "id": "GroO0akGb3u44nyE",
          "name": "Telegram: PA"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "0fa94dfb-182d-4f29-bbd8-8e2d6f39948a",
      "name": "Correo electrónico Draft",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1024,
        784
      ],
      "webhookId": "f77c4bdb-4e13-4c85-8b89-36db26e5f5f4",
      "parameters": {
        "message": "={{ $json.output.emailBody }}",
        "options": {},
        "subject": "=Re: {{ $('Gmail Trigger').item.json.subject }}",
        "resource": "draft",
        "emailType": "html"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "3ayhzuWezVASgiY3",
          "name": "Gmail account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "6cf3269e-0d32-498a-b96b-47f1252ec252",
      "name": "Label as Internal",
      "type": "n8n-nodes-base.gmailTool",
      "position": [
        560,
        1424
      ],
      "webhookId": "fd1cb537-e3fa-4bd4-86e8-89ab5f0ed376",
      "parameters": {
        "labelIds": [
          "Label_2401692396070026182"
        ],
        "messageId": "={{ $('Gmail Trigger').item.json.id }}",
        "operation": "addLabels"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "3ayhzuWezVASgiY3",
          "name": "Gmail account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "43d657f4-4164-47c7-8d9b-59ee5fe889ca",
      "name": "Send a message to user to review drafted reply",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1184,
        784
      ],
      "webhookId": "76ed07a0-9dd0-4a62-a97a-98c14a3d837a",
      "parameters": {
        "text": "=📥 New lead: {{ $('Gmail Trigger').item.json.from.value[0].name }}\nI searched the knowledge database and drafted a reply for you. Please check your email!\n\nFacts used:\n{{ $json.output.knowledgeDatabase }}\nRationale in email reply:\n{{ $json.output.reason }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "GroO0akGb3u44nyE",
          "name": "Telegram: PA"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "0b3dbc39-ecb6-4a4c-8ddd-40c0c27ecab5",
      "name": "Send a message to user to review the email directly",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1184,
        576
      ],
      "webhookId": "556fe74b-7219-4c7c-ac4a-abeb7093f25e",
      "parameters": {
        "text": "=📥 New lead: {{ $('Gmail Trigger').item.json.from.value[0].name }}\nI searched the knowledge database but I wasn't sure how to respond. Please see your email!",
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "id": "GroO0akGb3u44nyE",
          "name": "Telegram: PA"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "7b87e106-0a4c-49bd-a8f9-9d0cc9567e28",
      "name": "Output Format",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        848,
        816
      ],
      "parameters": {
        "schemaType": "manual",
        "inputSchema": "{\n  \"type\": \"object\",\n  \"properties\": {\n    \"emailBody\": {\n      \"type\": \"string\",\n      \"description\": \"The HTML-formatted body content of the email reply to be sent to the prospect. Use <p>, <br>, and <a> tags for formatting. If escalate is true, this is not required.\"\n    },\n    \"reason\": {\n      \"type\": \"string\",\n      \"description\": \"Short explanation for why this email response was generated. For example, what the user asked for, what info was found, and why this response was appropriate.\"\n    },\n    \"escalate\": {\n      \"type\": \"boolean\",\n      \"description\": \"True if unsure or can't confidently answer the question using available knowledge. False if confident in response and can proceed without human help.\"\n    },\n    \"knowledgeDatabase\": {\n      \"type\": \"string\",\n      \"description\": \"A summary of the facts retrieved from the Knowledge Database that were used to answer the email.\"\n    }\n  }\n}\n"
      },
      "typeVersion": 1.3
    },
    {
      "id": "c75d94e7-c9aa-42c8-92fc-0d15296d621d",
      "name": "Output Format1",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        720,
        1424
      ],
      "parameters": {
        "jsonSchemaExample": "{\n\t\"type\": \"object\",\n\t\"properties\": {\n      \"emailBody\": {\n        \"type\": \"string\",\n        \"description\": \"Summary of the email content\"\n      },\n      \"From\": {\n        \"type\": \"string\",\n        \"description\":\"who the email is from\"\n      }\n  }\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "09789837-6aa1-4043-87f0-1207e3a01bea",
      "name": "Send a summary of email and from who",
      "type": "n8n-nodes-base.telegram",
      "position": [
        896,
        1264
      ],
      "webhookId": "edf1ba52-759c-4f5b-9193-ed93cb3bb798",
      "parameters": {
        "text": "={{ $json.output.From }} sent you an email about {{ $json.output.emailBody }} ",
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "id": "GroO0akGb3u44nyE",
          "name": "Telegram: PA"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "d43d4957-6117-4516-b6eb-3ac6a57dd5a5",
      "name": "Send a message to Payments Team",
      "type": "n8n-nodes-base.gmail",
      "position": [
        912,
        80
      ],
      "webhookId": "307f6a19-1c45-4153-a7ee-5399ed96bd87",
      "parameters": {
        "sendTo": "payment@payments.com",
        "message": "=Invoice received from {{ $json.output.From }}. |Make payment by {{ $json.output.DueDate }}",
        "options": {},
        "subject": "=Make Payment to {{ $json.output.From }} by {{ $json.output.DueDate }}",
        "emailType": "text"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "3ayhzuWezVASgiY3",
          "name": "Gmail account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "01ffc8d4-ddaa-464c-ba20-0ec626dcf85c",
      "name": "Send a message to Receivables Team",
      "type": "n8n-nodes-base.gmail",
      "position": [
        912,
        -96
      ],
      "webhookId": "0b7881c6-b244-4b42-a651-1017df6fbcc5",
      "parameters": {
        "sendTo": "receipt@receivables.com",
        "message": "=Note receipt {{ $json.output.Amount }} from {{ $json.output.From }} ",
        "options": {},
        "subject": "=Received {{ $json.output.Amount }} from {{ $json.output.From }} ",
        "emailType": "text"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "3ayhzuWezVASgiY3",
          "name": "Gmail account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "0779c8e1-600e-46d5-9b13-c35c55221f8a",
      "name": "Database of Business Services",
      "type": "@n8n/n8n-nodes-langchain.vectorStorePinecone",
      "position": [
        560,
        816
      ],
      "parameters": {
        "mode": "retrieve-as-tool",
        "options": {},
        "pineconeIndex": {
          "__rl": true,
          "mode": "list",
          "value": "chatbot",
          "cachedResultName": "chatbot"
        },
        "toolDescription": "Knowledge of the business and services it provides"
      },
      "credentials": {
        "pineconeApi": {
          "id": "bqH6qbFYtDUXMpn3",
          "name": "PineconeApi v2"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "89ea2355-ee63-479a-a419-0a3d48d8217f",
      "name": "Nota adhesiva4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -576,
        -368
      ],
      "parameters": {
        "color": 3,
        "width": 272,
        "height": 704,
        "content": "## Trigger\nWorkflow is triggered when an email comes in\n\n## Setup\n- Connect to your Gmail account using Gmail API"
      },
      "typeVersion": 1
    },
    {
      "id": "c7f19fbe-bc82-49bf-a27d-910b342bd37a",
      "name": "Nota adhesiva5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -272,
        -368
      ],
      "parameters": {
        "color": 3,
        "width": 320,
        "height": 704,
        "content": "## Inbox Router\nBased on incoming email's \"subject\", \"from\", and \"content\", GPT will route the email to the respective designated categories.\n\n## Setup\n- Select email \"body\", \"subject\" and \"from\" for GPT to classify with\n- List down the categories you need and add a description for GPT to learn how to classify."
      },
      "typeVersion": 1
    },
    {
      "id": "e75aab89-507b-4272-b5f8-11caa17ae9be",
      "name": "GPT 5 mini",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        -208,
        208
      ],
      "parameters": {
        "model": "openai/gpt-5-mini",
        "options": {}
      },
      "credentials": {
        "openRouterApi": {
          "id": "8YhGo1rl7F0epmIo",
          "name": "OpenRouter account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "43ad74d1-c0d1-4324-8749-a68ced79faf6",
      "name": "Nota adhesiva6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -528,
        -1136
      ],
      "parameters": {
        "width": 640,
        "height": 688,
        "content": "## Categorise and route emails with GPT 5\nThis workflow demonstrates how to use AI text classifier to classify incoming emails, and uses a multi-agent architecture to respond for each email category respectively.\n\n## Use cases\nBusiness owners with a lot of incoming emails, or anyone who has huge influx of emails \n\n## How it Works\nAny incoming emails will be read by the text classifier powered by GPT 5, and routed according to the defined categories. See details of how it works in the respective categories.\n\n## How to set up\n- Set up Telegram bot via Botfather. See setup instructions [here](https://core.telegram.org/bots/tutorial) \n- Setup OpenAI API for transcription services (Credits required) [here](https://openai.com/index/openai-api/)\n- Set up Openrouter account. See details [here](https://openrouter.ai/docs/api-reference/authentication)\n- Set up Pinecone database. See details [here](https://docs.pinecone.io/guides/get-started/quickstart)\n\n## Customization Options\nOther than Gmail, it is possible to connect to Outlook as well. Other than Pinecone vector database, there are other vector database that should serve the same purpose  eg. supabase, qdrant, weviate\n\n## Requirements\n- Gmail account\n- Telegram bot\n- Pinecone account\n- Open router account\n"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "84f34fe3-9a89-434b-be4c-e9b70eb9f5dc",
  "connections": {
    "e75aab89-507b-4272-b5f8-11caa17ae9be": {
      "ai_languageModel": [
        [
          {
            "node": "80791e3c-3b1c-498d-a89c-074aa1b226b8",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Email Draft": {
      "main": [
        [
          {
            "node": "43d657f4-4164-47c7-8d9b-59ee5fe889ca",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "c858664a-5f23-49a3-9f5a-3248d11caf6f": {
      "ai_languageModel": [
        [
          {
            "node": "Customer Support Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Leads Agent": {
      "main": [
        [
          {
            "node": "ab484b41-257e-4fb5-aaf9-ab5c52e8f9d3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Reply Email": {
      "main": [
        [
          {
            "node": "6c233cf9-212b-4e9e-bf88-fd8a38752f68",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "21182b0b-a8c3-4e2c-b55a-0a0fa640497c": {
      "ai_languageModel": [
        [
          {
            "node": "Finance Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "aed022a4-79e1-4233-96bb-464ccb6b103a": {
      "ai_languageModel": [
        [
          {
            "node": "Leads Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "209217da-45df-4170-8876-bb2b39de9428": {
      "ai_languageModel": [
        [
          {
            "node": "Internal Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "80791e3c-3b1c-498d-a89c-074aa1b226b8": {
      "main": [
        [
          {
            "node": "Customer Support Agent",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Finance Agent",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "No Operation, do nothing",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Leads Agent",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Internal Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "9bd4da70-dcc0-411b-94ad-d9b8e3776403": {
      "ai_outputParser": [
        [
          {
            "node": "Finance Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Finance Agent": {
      "main": [
        [
          {
            "node": "Route by Email Type",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gmail Trigger": {
      "main": [
        [
          {
            "node": "80791e3c-3b1c-498d-a89c-074aa1b226b8",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ab484b41-257e-4fb5-aaf9-ab5c52e8f9d3": {
      "main": [
        [
          {
            "node": "0b3dbc39-ecb6-4a4c-8ddd-40c0c27ecab5",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Email Draft",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "7b87e106-0a4c-49bd-a8f9-9d0cc9567e28": {
      "ai_outputParser": [
        [
          {
            "node": "Leads Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Internal Agent": {
      "main": [
        [
          {
            "node": "09789837-6aa1-4043-87f0-1207e3a01bea",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "c75d94e7-c9aa-42c8-92fc-0d15296d621d": {
      "ai_outputParser": [
        [
          {
            "node": "Internal Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "cf82a1a4-b002-4235-82af-63f18942bd5b": {
      "ai_tool": [
        [
          {
            "node": "Finance Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings OpenAI": {
      "ai_embedding": [
        [
          {
            "node": "2f643199-bc20-4e8a-8a83-c8a4697f4514",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "6cf3269e-0d32-498a-b96b-47f1252ec252": {
      "ai_tool": [
        [
          {
            "node": "Internal Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings OpenAI1": {
      "ai_embedding": [
        [
          {
            "node": "0779c8e1-600e-46d5-9b13-c35c55221f8a",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Route by Email Type": {
      "main": [
        [
          {
            "node": "01ffc8d4-ddaa-464c-ba20-0ec626dcf85c",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "d43d4957-6117-4516-b6eb-3ac6a57dd5a5",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Customer Support Agent": {
      "main": [
        [
          {
            "node": "Reply Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "02babaee-e872-45c8-b4e4-aab19c062b0d": {
      "ai_tool": [
        [
          {
            "node": "Leads Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "0779c8e1-600e-46d5-9b13-c35c55221f8a": {
      "ai_tool": [
        [
          {
            "node": "Leads Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "2f643199-bc20-4e8a-8a83-c8a4697f4514": {
      "ai_tool": [
        [
          {
            "node": "Customer Support Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "d43d4957-6117-4516-b6eb-3ac6a57dd5a5": {
      "main": [
        [
          {
            "node": "db1f46b9-b2bc-4584-b08e-a15420128415",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "01ffc8d4-ddaa-464c-ba20-0ec626dcf85c": {
      "main": [
        [
          {
            "node": "fb30770c-95fe-41d6-a4a4-78435f208df9",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Preguntas frecuentes

¿Cómo usar este flujo de trabajo?

Copie el código de configuración JSON de arriba, cree un nuevo flujo de trabajo en su instancia de n8n y seleccione "Importar desde JSON", pegue la configuración y luego modifique la configuración de credenciales según sea necesario.

¿En qué escenarios es adecuado este flujo de trabajo?

Avanzado - Gestión de tickets, RAG de IA

¿Es de pago?

Este flujo de trabajo es completamente gratuito, puede importarlo y usarlo directamente. Sin embargo, tenga en cuenta que los servicios de terceros utilizados en el flujo de trabajo (como la API de OpenAI) pueden requerir un pago por su cuenta.

Información del flujo de trabajo
Nivel de dificultad
Avanzado
Número de nodos41
Categoría2
Tipos de nodos14
Descripción de la dificultad

Adecuado para usuarios avanzados, flujos de trabajo complejos con 16+ nodos

Autor
Zawanah

Zawanah

@zawanah

Analytics and AI Engineer | Building automation for efficiency

Enlaces externos
Ver en n8n.io

Compartir este flujo de trabajo

Categorías

Categorías: 34