AutomationFlowsAI & RAG › Email Triage

Email Triage

Email-Triage. Uses lmChatOpenAi, outputParserStructured, agent, toolWorkflow. Event-driven trigger; 27 nodes.

Event trigger★★★★☆ complexityAI-powered27 nodesOpenAI ChatOutput Parser StructuredAgentTool WorkflowSlackGmailPostgresGmail Trigger
AI & RAG Trigger: Event Nodes: 27 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow follows the Agent → Gmail recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "nodes": [
    {
      "parameters": {
        "options": {}
      },
      "id": "f3113080-20d1-4867-8c97-f97ccbc69823",
      "name": "OpenAI Chat Model1",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1,
      "position": [
        -1424,
        656
      ],
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "schemaType": "manual",
        "inputSchema": "{\n  \"type\": \"object\",\n  \"properties\": {\n    \"summary\": { \"type\": \"string\" },\n    \"language\": { \"type\": \"string\" },\n    \"confidence\": { \"type\": \"number\" }\n  },\n  \"required\": [\"summary\", \"language\", \"confidence\"]\n}\n"
      },
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "typeVersion": 1.2,
      "position": [
        -1216,
        640
      ],
      "id": "80940c03-0c49-4ae2-a3e8-279061ae1d16",
      "name": "Structured Output Parser1"
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "={{ $('Edit Fields').item.json.message }}\n",
        "hasOutputParser": true,
        "options": {
          "systemMessage": "=You are a concise helpdesk summarizer.\nReturn a one-sentence summary (max 25 words), detect language (BCP-47 code), and give confidence 0\u20131 for how certain the upstream classification is correct.\nWhen in doubt, lower confidence.\n\nRules:\n- Do not add pleasantries.\n- No line breaks in the summary.\n- Confidence is a decimal between 0 and 1.\n\nOutput fields:\n- summary: string\n- language: string (e.g. \"en\", \"ar\", \"de\")\n- confidence: number (0\u20131)\n"
        }
      },
      "id": "2739a1e9-6e6f-4ad1-b1ab-e620d15986d7",
      "name": "AI Agent1",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 1.7,
      "position": [
        -1408,
        448
      ]
    },
    {
      "parameters": {
        "content": "## AI-Agent Confident answer or needs Human Approval?\n**Determining Confidence score**",
        "height": 503.2762836185823,
        "width": 408.45965770171165,
        "color": 3
      },
      "id": "50d1027e-e8a0-400b-9c89-d8ea0df10967",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -1520,
        288
      ]
    },
    {
      "parameters": {
        "workflowId": {
          "__rl": true,
          "value": "Zbu4oyjlmolRJXSF",
          "mode": "list",
          "cachedResultUrl": "/workflow/Zbu4oyjlmolRJXSF",
          "cachedResultName": "Customer Demos \u2014 Fragment - Finance Inputs (from Gmail)"
        },
        "workflowInputs": {
          "mappingMode": "defineBelow",
          "value": {},
          "matchingColumns": [],
          "schema": [
            {
              "id": "id",
              "displayName": "id",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string",
              "removed": false
            },
            {
              "id": "email",
              "displayName": "email",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string",
              "removed": false
            },
            {
              "id": "message",
              "displayName": "message",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string",
              "removed": false
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": true
        },
        "options": {
          "waitForSubWorkflow": false
        }
      },
      "type": "n8n-nodes-base.executeWorkflow",
      "typeVersion": 1.3,
      "position": [
        976,
        -32
      ],
      "id": "39765482-011b-4e39-8d05-b239411266f1",
      "name": "Notify Finance"
    },
    {
      "parameters": {
        "workflowId": {
          "__rl": true,
          "value": "2o6xIue1CaZeY0kc",
          "mode": "list",
          "cachedResultUrl": "/workflow/2o6xIue1CaZeY0kc",
          "cachedResultName": "Customer Demos \u2014 Notify Marketing"
        },
        "workflowInputs": {
          "mappingMode": "defineBelow",
          "value": {}
        },
        "options": {}
      },
      "type": "n8n-nodes-base.executeWorkflow",
      "typeVersion": 1.3,
      "position": [
        976,
        160
      ],
      "id": "9929792c-36e4-4a62-b128-75b298daf553",
      "name": "Notify Marketing"
    },
    {
      "parameters": {
        "workflowId": {
          "__rl": true,
          "value": "kW1ItqG99Jumf9JV",
          "mode": "list",
          "cachedResultUrl": "/workflow/kW1ItqG99Jumf9JV",
          "cachedResultName": "Customer Demos \u2014 Notify Engineering (Jira + Slack + Pagerduty)"
        },
        "workflowInputs": {
          "mappingMode": "defineBelow",
          "value": {}
        },
        "options": {}
      },
      "type": "n8n-nodes-base.executeWorkflow",
      "typeVersion": 1.3,
      "position": [
        976,
        368
      ],
      "id": "6b6ec476-fcb8-44ca-967e-ccf199ae2e40",
      "name": "Notify Engineering",
      "alwaysOutputData": false
    },
    {
      "parameters": {
        "description": "Call this tool to get the confidence score of the output received from the previous AI agent. This will then determine if a human verification to continue the flow or not is needed. ",
        "workflowId": {
          "__rl": true,
          "value": "J3jpG50V7WdgurD6",
          "mode": "list",
          "cachedResultUrl": "/workflow/J3jpG50V7WdgurD6",
          "cachedResultName": "Customer Demos \u2014 Confidence Modular Subworkflow"
        },
        "workflowInputs": {
          "mappingMode": "defineBelow",
          "value": {
            "output": "={{ $fromAI(\"output\") }}",
            "customer_email": "={{ $('Edit Fields').item.json.customer_email }}",
            "headers_subject": "={{ $('Filter').item.json.headers.subject }}",
            "message": "={{ $('Edit Fields').item.json.message }}"
          },
          "matchingColumns": [],
          "schema": [
            {
              "id": "output",
              "displayName": "output",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "customer_email",
              "displayName": "customer_email",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "headers_subject",
              "displayName": "headers_subject",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "message",
              "displayName": "message",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "removed": false
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        }
      },
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "typeVersion": 2.2,
      "position": [
        -1824,
        656
      ],
      "id": "a4dfa602-04d6-46c7-b2c7-b96ce6de020a",
      "name": "Call 'Confidence Modular Subworkflow'1"
    },
    {
      "parameters": {
        "content": "## Automatically classifies incoming emails into Billing, Marketing, or Engineering ",
        "height": 80,
        "width": 960,
        "color": 5
      },
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2368,
        128
      ],
      "typeVersion": 1,
      "id": "982a711c-a17b-452d-a1da-f054f00a8227",
      "name": "Sticky Note6"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "8d55f9ed-5180-4007-8b1f-2ca3d3c5866f",
              "leftValue": "={{ $json.output.confidence }}",
              "rightValue": 0.7,
              "operator": {
                "type": "number",
                "operation": "lt"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        -1024,
        448
      ],
      "id": "f76f6e70-a598-4943-a656-4043d7ca8487",
      "name": "Low confidence?"
    },
    {
      "parameters": {
        "authentication": "oAuth2",
        "operation": "sendAndWait",
        "user": {
          "__rl": true,
          "value": "U099BUZ4QAH",
          "mode": "list",
          "cachedResultName": "amrita.gupta"
        },
        "message": "=*:warning: Needs human review (low confidence)*\n\n\u2022 *Proposed category:* {{$json.route || 'unclassified'}}\n\u2022 *Confidence:* {{$json.confidence}}\n\u2022 *From:* {{$json.customer_email}}\n\u2022 *Subject:* {{$json.subject}}\n\u2022 *Summary:* {{$json.summary || $truncate($json.message, 140)}}\n",
        "options": {}
      },
      "type": "n8n-nodes-base.slack",
      "typeVersion": 2.3,
      "position": [
        -496,
        176
      ],
      "id": "d5bb0d8f-789e-423e-a0d1-7462e533cd97",
      "name": "Send a message",
      "credentials": {
        "slackOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "content": "## Human In the Loop \nApproval for low confidence",
        "height": 519,
        "width": 408,
        "color": 6
      },
      "id": "62dc0851-f874-4896-a13b-116e4fc5c278",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -656,
        -48
      ]
    },
    {
      "parameters": {
        "content": "## Paid Customers Database Lookup\n\n**Determining if the customer paid for support**",
        "height": 519,
        "width": 408,
        "color": 6
      },
      "id": "b02a73f1-ddc3-41d7-a758-777247026ea5",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -640,
        576
      ]
    },
    {
      "parameters": {
        "resource": "message",
        "subject": "\ud83e\udde1 Welcome from n8n \u2014 pick a support plan + community options",
        "includeHtml": true,
        "htmlMessage": "=<div style=\"font-family: Inter, Segoe UI, Roboto, Arial, sans-serif; color:#111827; line-height:1.6; max-width:640px; margin:0 auto; padding:20px;\">\n  <h2 style=\"margin:0 0 10px; font-size:20px;\">Hi {{ $json.first_name || 'there' }} \ud83d\udc4b</h2>\n  <p style=\"margin:0 0 16px;\">\n    Thanks for reaching out! It looks like your account isn\u2019t on a support plan yet. Here are simple options:\n  </p>\n\n  <div style=\"border:1px solid #e5e7eb; border-radius:10px; padding:14px; margin:10px 0;\">\n    <ul style=\"margin:0; padding-left:18px;\">\n      <li><strong>Essentials</strong> \u2014 Email support, business hours, next-business-day response</li>\n      <li><strong>Pro</strong> \u2014 Email + Slack, priority queue, <strong>4-hour</strong> first response</li>\n      <li><strong>Enterprise</strong> \u2014 <strong>24\u00d77</strong> critical coverage, <strong>1-hour</strong> SLA, named TAM</li>\n    </ul>\n  </div>\n\n  <p style=\"margin:14px 0;\">\n    <a href=\"{{ $json.checkout_url }}\"\n       style=\"background:#2563eb; color:#fff; text-decoration:none; padding:10px 16px; border-radius:8px; font-weight:600; display:inline-block;\">\n      View plans &amp; purchase\n    </a>\n  </p>\n\n  <p style=\"margin:14px 0 6px;\"><strong>Prefer an invoice?</strong> Reply with:</p>\n  <ul style=\"margin:0 0 12px 18px; padding:0;\">\n    <li>Company name + billing email</li>\n    <li>Package (Essentials / Pro / Enterprise)</li>\n    <li>Country + VAT/Tax ID (if any)</li>\n  </ul>\n\n  <div style=\"border:1px dashed #e5e7eb; border-radius:10px; padding:12px; margin:12px 0;\">\n    <p style=\"margin:0 0 6px;\">\n      Have a quick question? Post in our Community forum (monitored by our team &amp; power users):\n      <a href=\"{{ $json.community_url }}\">community.n8n.io</a>\n    </p>\n    <p style=\"margin:0; color:#6b7280; font-size:12px;\">Please don\u2019t include secrets, tokens, or payment details.</p>\n  </div>\n\n  <p style=\"margin:10px 0 0;\">\n    Prefer to talk it through? <a href=\"{{ $json.book_link }}\">Book a 15-min call</a>.\n  </p>\n</div>\n",
        "message": "=",
        "toList": [
          "=amrita.gupta@n8n.io",
          []
        ],
        "additionalFields": {}
      },
      "name": "Non-support customer",
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 1,
      "position": [
        560,
        448
      ],
      "id": "31702f1f-27b4-4b3b-8ef1-719ac0544b03",
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "851686a8-a309-4c68-98da-9c9c40d60dbd",
              "leftValue": "={{ $json.has_support }}",
              "rightValue": "true",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        240,
        432
      ],
      "id": "cd459f11-a6ea-4eee-a753-0b46ce19394b",
      "name": "If"
    },
    {
      "parameters": {
        "operation": "executeQuery",
        "query": "SELECT COALESCE(\n  (SELECT has_support\n   FROM public.support_users\n   WHERE email = '{{$(\"Edit Fields\").item.json.customer_email}}'\n   LIMIT 1),\n  false\n) AS has_support;\n",
        "options": {
          "queryReplacement": "=email = {{$('Edit Fields').item.json.customer_email}}"
        }
      },
      "type": "n8n-nodes-base.postgres",
      "typeVersion": 2.5,
      "position": [
        -496,
        800
      ],
      "id": "37e93092-99d4-4793-894e-9917fd2c7257",
      "name": "Postgres",
      "credentials": {
        "postgres": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "leftValue": "={{ $('AI Agent').item.json.output }}",
                    "rightValue": "Billing",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "id": "a063c91b-c91e-413b-866f-112a47c8a058"
                  }
                ],
                "combinator": "and"
              }
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "id": "40a57df1-b8b3-463b-b873-b266b56aaea2",
                    "leftValue": "={{ $('AI Agent').item.json.output }}",
                    "rightValue": "Marketing",
                    "operator": {
                      "type": "string",
                      "operation": "equals",
                      "name": "filter.operator.equals"
                    }
                  }
                ],
                "combinator": "and"
              }
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "id": "816fc90a-aef7-4887-8bbf-d736889f1daa",
                    "leftValue": "={{ $('AI Agent').item.json.output }}",
                    "rightValue": "Engineering",
                    "operator": {
                      "type": "string",
                      "operation": "equals",
                      "name": "filter.operator.equals"
                    }
                  }
                ],
                "combinator": "and"
              }
            }
          ]
        },
        "options": {}
      },
      "id": "5af06f31-94f6-4180-8371-32ce5abb3c18",
      "name": "Switch",
      "type": "n8n-nodes-base.switch",
      "typeVersion": 3.2,
      "position": [
        688,
        144
      ]
    },
    {
      "parameters": {
        "content": "## Operational Routing\n**Directing Emails to Relevant Teams**",
        "height": 928,
        "width": 1210,
        "color": 4
      },
      "id": "a6720a48-c6ed-4363-a6bc-9f3336cf00cc",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        96,
        -128
      ]
    },
    {
      "parameters": {
        "options": {}
      },
      "id": "4202bab2-4992-40a7-aed7-87731181ea16",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1,
      "position": [
        -1968,
        656
      ],
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "jsonSchemaExample": "{\n\t\"output\": \"string\"\n}"
      },
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "typeVersion": 1.2,
      "position": [
        -1680,
        656
      ],
      "id": "aa8433b2-cb5e-4fbe-822a-36b67dae8303",
      "name": "Structured Output Parser"
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "={{ $json.message }}",
        "hasOutputParser": true,
        "options": {
          "systemMessage": "=Specify if that text is related to billing or technical, and as an output write only one word, it has to be either \"Billing\", \"Marketing\", \"Engineering\", do not invent labels and fallback into \"Marketing\" if cannot be determined. "
        }
      },
      "id": "918523da-347b-451b-b9b3-cf70d58c8294",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 1.7,
      "position": [
        -1888,
        448
      ]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "b651c8e3-4540-4a9e-9af4-d370b73d7fb2",
              "name": "message",
              "value": "={{ $json.text }}",
              "type": "string"
            },
            {
              "id": "9cd1bca6-dff4-47f2-9b6a-31907dbce8d1",
              "name": "customer_email",
              "value": "={{ $json.from.value[0].address }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        -2224,
        448
      ],
      "id": "22854370-a1b3-48dc-90bf-c3593fd1807e",
      "name": "Edit Fields"
    },
    {
      "parameters": {
        "content": "## AI-Driven Classification\n**Classifiying Email Context**",
        "height": 503.2762836185823,
        "width": 408.45965770171165,
        "color": 3
      },
      "id": "5bdc67f8-4c77-403f-a1ab-1cd2f17a868d",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -2000,
        288
      ]
    },
    {
      "parameters": {
        "content": "## Email Segmentation\n**Filtering and Categorizing Requests**",
        "height": 504.8655256723715,
        "width": 408.45965770171165,
        "color": 2
      },
      "id": "e55b1ac7-720f-440f-b779-4c5e7cd4f0d5",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -2464,
        288
      ]
    },
    {
      "parameters": {
        "content": "## Inbound Communication\n**Capturing Incoming Customer Interactions**",
        "height": 503.27628361858206,
        "width": 216.16136919315392
      },
      "id": "a0d99262-b856-4ef0-9692-c8ecc5e9e4d3",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -2736,
        288
      ]
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "8caffca9-9efd-43ee-ab52-035aca2be473",
              "leftValue": "=Support Case Open",
              "rightValue": "Support Case Open",
              "operator": {
                "type": "string",
                "operation": "equals",
                "name": "filter.operator.equals"
              }
            }
          ],
          "combinator": "or"
        },
        "options": {}
      },
      "id": "de761f06-8079-4bd7-8173-076b6797c420",
      "name": "Filter",
      "type": "n8n-nodes-base.filter",
      "typeVersion": 2.2,
      "position": [
        -2368,
        448
      ],
      "retryOnFail": true
    },
    {
      "parameters": {
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "simple": false,
        "filters": {},
        "options": {
          "downloadAttachments": true
        }
      },
      "id": "50b54003-4632-4d77-b5a9-c3fa5852a788",
      "name": "Gmail Trigger",
      "type": "n8n-nodes-base.gmailTrigger",
      "typeVersion": 1.1,
      "position": [
        -2688,
        448
      ],
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      }
    }
  ],
  "connections": {
    "OpenAI Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser1": {
      "ai_outputParser": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent1": {
      "main": [
        [
          {
            "node": "Low confidence?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Call 'Confidence Modular Subworkflow'1": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Low confidence?": {
      "main": [
        [
          {
            "node": "Send a message",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Postgres",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send a message": {
      "main": [
        [
          {
            "node": "Postgres",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Non-support customer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Postgres": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch": {
      "main": [
        [
          {
            "node": "Notify Finance",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Notify Marketing",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Notify Engineering",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "AI Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "AI Agent1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gmail Trigger": {
      "main": [
        [
          {
            "node": "Filter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "meta": {
    "templateCredsSetupCompleted": true
  }
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

Email-Triage. Uses lmChatOpenAi, outputParserStructured, agent, toolWorkflow. Event-driven trigger; 27 nodes.

Source: https://gist.github.com/idirouhab/bb40263af83a4940467703eada3267f2 — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

Streamline customer support with a real-time, AI-powered answer engine that detects incoming support emails, classifies intent, identifies the customer’s GEO region, and generates a tailored reply rea

Slack, Gmail Trigger, OpenAI Chat +5
AI & RAG

Monitors your AP inbox for incoming invoices, extracts structured data with AI, runs duplicate and vendor history checks against Supabase, then scores each invoice for fraud risk — routing suspicious

Gmail Trigger, Agent, OpenAI Chat +4
AI & RAG

Gmail users report spending significant time manually sorting email, so this tool helps alleviate that burden. Gmail Trigger monitors unread emails every 2 minutes Once an email arrives, the content i

OpenAI Chat, Output Parser Structured, Agent +4
AI & RAG

[](https://youtu.be/nC2mSry3xFo)

Gmail Trigger, OpenAI Chat, Output Parser Structured +6
AI & RAG

Streamline your HR recruitment process with this intelligent automation that reads candidate emails and resumes, analyzes them using GPT-4, and automatically shortlists or rejects applicants based on

Gmail, Gmail Trigger, HTTP Request +7