AutomationFlowsAI & RAG › Classify Gmail Intents with Google Gemini, Slack and Google Sheets

Classify Gmail Intents with Google Gemini, Slack and Google Sheets

ByWeblineIndia @weblineindia on n8n.io

This workflow monitors Gmail for new unread emails, uses Google Gemini to classify each email’s intent, then creates Gmail draft replies and Slack alerts for questions/requests, escalates complaints with Slack and Google Tasks, and logs FYI and spam activity to Google Sheets.…

Event trigger★★★★☆ complexityAI-powered19 nodesGmail TriggerGoogle GeminiGoogle SheetsGmailSlackGoogle Tasks
AI & RAG Trigger: Event Nodes: 19 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow corresponds to n8n.io template #16304 — we link there as the canonical source.

This workflow follows the Gmail → Gmail Trigger 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
{
  "id": "oOve27VluzPnZRrI",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "email-intent",
  "tags": [],
  "nodes": [
    {
      "id": "bf7129c2-7533-46ca-869b-6207986a1b43",
      "name": "Watch New Unread Emails",
      "type": "n8n-nodes-base.gmailTrigger",
      "position": [
        -2064,
        1248
      ],
      "parameters": {
        "filters": {},
        "pollTimes": {
          "item": [
            {}
          ]
        }
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "6c6e5f27-ed4b-48d3-83cb-4530d32adf21",
      "name": "Extract Sender Subject Body",
      "type": "n8n-nodes-base.set",
      "position": [
        -1872,
        1248
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "b553f3d2-2b4d-499b-a1b2-a1e60a8c2356",
              "name": "Sender",
              "type": "string",
              "value": "={{ $json.From }}"
            },
            {
              "id": "0a7b7262-803c-4774-be8f-36b9e03d7e6e",
              "name": "Subject",
              "type": "string",
              "value": "={{ $json.Subject }}"
            },
            {
              "id": "bf4d6e39-bf95-441b-866d-a8d04b6a3dcb",
              "name": "Body",
              "type": "string",
              "value": "={{ $json.textPlain || $json.bodyPlain || $json.body || $json.snippet || '' }}"
            },
            {
              "id": "ec600cb2-1d51-499d-83e4-69adc9c865ee",
              "name": "Intent",
              "type": "string",
              "value": "={{ null }}"
            },
            {
              "id": "69e596e9-02fb-409a-a2c1-ba806e97a747",
              "name": "id",
              "type": "string",
              "value": "={{ $json.id }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "7b53f34b-33a1-417e-bef7-f0846c503e42",
      "name": "Classify Intent and Generate Actions",
      "type": "@n8n/n8n-nodes-langchain.googleGemini",
      "position": [
        -1424,
        1248
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "models/gemini-3.1-flash-lite-preview",
          "cachedResultName": "models/gemini-3.1-flash-lite-preview"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "content": "=You are an email automation assistant.\n\nYou will receive MULTIPLE emails in JSON format.\nEach email MUST be processed independently.\n\nINPUT:\n{{ JSON.stringify($json[\"emails\"]) }}\n\nTASK:\nFor EACH email:\n1. Classify intent into exactly one of:\n- Question\n- Request\n- Complaint\n- FYI\n- Spam\n\n2. Based on intent:\n- Question or Request:\n  - Generate a professional Gmail draft reply\n  - Generate a Slack alert message for the team\n- Complaint:\n  - Generate an urgent Slack alert message\n  - Generate a Google Task with title, notes, and priority = \"high\"\n- FYI:\n  - No action other than logging\n- Spam:\n  - No action other than logging as skipped\n\nOUTPUT FORMAT:\n{\n  \"results\": [\n    {\n      \"id\": \"<email_id>\",\n      \"intent\": \"<Question|Request|Complaint|FYI|Spam>\",\n      \"gmail_draft\": {\n        \"subject\": \"<string or null>\",\n        \"body\": \"<string or null>\"\n      },\n      \"slack_message\": \"<string or null>\",\n      \"google_task\": {\n        \"title\": \"<string or null>\",\n        \"notes\": \"<string or null>\",\n        \"priority\": \"<high or null>\"\n      },\n      \"log\": {\n        \"sender\": \"<sender>\",\n        \"subject\": \"<subject>\",\n        \"intent\": \"<intent>\",\n        \"action\": \"<short action summary>\"\n      }\n    }\n  ]\n}\n\nIMPORTANT RULES:\n- Handle each email separately\n- NEVER mix content between emails\n- Return ONLY valid JSON\n- No markdown\n- No explanations\n- Ensure every output id matches the input email id exactly"
            }
          ]
        },
        "builtInTools": {}
      },
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "cd7e143a-3bee-4690-a9b8-0ee6af038bbf",
      "name": "Bundle Emails for AI",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        -1584,
        1248
      ],
      "parameters": {
        "options": {},
        "aggregate": "aggregateAllItemData",
        "destinationFieldName": "emails"
      },
      "typeVersion": 1
    },
    {
      "id": "0546137f-1ac3-48c7-8675-dc5182723ddf",
      "name": "Parse AI JSON Response",
      "type": "n8n-nodes-base.code",
      "position": [
        -1136,
        1248
      ],
      "parameters": {
        "mode": "runOnceForEachItem",
        "jsCode": "const raw = $json.content?.parts?.[0]?.text || '{}';\n\ntry {\n  return {\n    json: JSON.parse(raw)\n  };\n} catch (error) {\n  return {\n    json: {\n      results: [],\n      parse_error: true,\n      raw_output: raw,\n      error: error.message\n    }\n  };\n}"
      },
      "typeVersion": 2
    },
    {
      "id": "88cc0721-eead-48e4-bafd-6d6df88c7ba2",
      "name": "Route by Email Intent",
      "type": "n8n-nodes-base.switch",
      "position": [
        -768,
        1200
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "Question",
              "conditions": {
                "options": {
                  "version": 3,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "2d747cbc-359d-45dd-820f-e677e26d9ed9",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "Question",
                    "rightValue": "={{ $json.intent }}"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Request",
              "conditions": {
                "options": {
                  "version": 3,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "83b7227e-1cb6-42d4-b3dd-4bd02845e7f4",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "Request",
                    "rightValue": "={{ $json.intent }}"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Complaint",
              "conditions": {
                "options": {
                  "version": 3,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "4ef860c3-5e23-4088-a0c5-73bb2d6a2ebd",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "Complaint",
                    "rightValue": "={{ $json.intent }}"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "FYI",
              "conditions": {
                "options": {
                  "version": 3,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "022fda95-ca8b-4010-8ba1-acbe3f43e0f2",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "FYI",
                    "rightValue": "={{ $json.intent }}"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Spam",
              "conditions": {
                "options": {
                  "version": 3,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "f97264e8-e4fc-419a-9692-f77b9e88b9da",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "Spam",
                    "rightValue": "={{ $json.intent }}"
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.4
    },
    {
      "id": "ce723423-1ec1-4b6a-8c77-be6d05d39a25",
      "name": "Split AI Results Per Email",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        -928,
        1248
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "results"
      },
      "typeVersion": 1
    },
    {
      "id": "3e2650bf-0e5c-458b-8279-1820db43112e",
      "name": "Log FYI to Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -416,
        1344
      ],
      "parameters": {
        "columns": {
          "value": {
            "Action": "={{ $json.log.action }}",
            "Intent": "={{ $json.log.intent }}",
            "Sender": "={{ $json.log.sender }}",
            "Subject": "={{ $json.log.subject }}",
            "Email ID": "={{ $json.id }}",
            "Timestamp": "={{$now}}"
          },
          "schema": [
            {
              "id": "Timestamp",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Timestamp",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Email ID",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Email ID",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Sender",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Sender",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Subject",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Subject",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Intent",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Intent",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Action",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Action",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1M7N9HtJx8HX7UNY80SxPPyfQzf6qB4CmaG0jIsE5Ugg/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1M7N9HtJx8HX7UNY80SxPPyfQzf6qB4CmaG0jIsE5Ugg",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1M7N9HtJx8HX7UNY80SxPPyfQzf6qB4CmaG0jIsE5Ugg/edit?usp=drivesdk",
          "cachedResultName": "Email-Intent"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "8fe296e9-639d-44d4-8b4a-f64725a935d0",
      "name": "Create Gmail Draft Reply",
      "type": "n8n-nodes-base.gmail",
      "position": [
        -416,
        960
      ],
      "parameters": {
        "message": "={{ $json.gmail_draft?.body || 'Hello,\\n\\nThank you for your email.\\n\\nBest regards' }}",
        "options": {
          "sendTo": "={{ (() => { const sender = $json.log?.sender || ''; const match = sender.match(/<([^>]+)>/); return match ? match[1].trim() : sender.trim(); })() }}"
        },
        "subject": "={{ $json.gmail_draft?.subject || ('Re: ' + ($json.log?.subject || '')) }}",
        "resource": "draft"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "baa03a81-cebf-437a-a21a-061074ca9d0f",
      "name": "Log Question or Request to Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        32,
        960
      ],
      "parameters": {
        "columns": {
          "value": {
            "Action": "={{ $('Route by Email Intent').item.json.log.action }}",
            "Intent": "={{ $('Route by Email Intent').item.json.log.intent }}",
            "Sender": "={{ $('Route by Email Intent').item.json.log.sender }}",
            "Subject": "={{ $('Route by Email Intent').item.json.log.subject }}",
            "Email ID": "={{ $json.id }}",
            "Timestamp": "={{$now}}"
          },
          "schema": [
            {
              "id": "Timestamp",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Timestamp",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Email ID",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Email ID",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Sender",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Sender",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Subject",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Subject",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Intent",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Intent",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Action",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Action",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1M7N9HtJx8HX7UNY80SxPPyfQzf6qB4CmaG0jIsE5Ugg/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1M7N9HtJx8HX7UNY80SxPPyfQzf6qB4CmaG0jIsE5Ugg",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1M7N9HtJx8HX7UNY80SxPPyfQzf6qB4CmaG0jIsE5Ugg/edit?usp=drivesdk",
          "cachedResultName": "Email-Intent"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "3ec26243-10df-48bd-b297-7894e290b308",
      "name": "Send Urgent Slack Complaint Alert",
      "type": "n8n-nodes-base.slack",
      "position": [
        -416,
        1152
      ],
      "parameters": {
        "text": "=Complaint Alert\\nFrom: {{$json.log.sender}}\\nSubject: {{$json.log.subject}}\\n{{$json.slack_message || $json.google_task.notes || 'Customer complaint received. Immediate action required.'}}",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": "C0APWQ2379Q",
          "cachedResultName": "urgent-alerts"
        },
        "otherOptions": {},
        "authentication": "oAuth2"
      },
      "credentials": {
        "slackOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.4
    },
    {
      "id": "e6d43f8d-0517-448d-b6cb-53c05600fb49",
      "name": "Log Complaint to Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        32,
        1152
      ],
      "parameters": {
        "columns": {
          "value": {
            "Action": "={{ $('Route by Email Intent').item.json.log.action }}",
            "Intent": "={{ $('Route by Email Intent').item.json.log.intent }}",
            "Sender": "={{ $('Route by Email Intent').item.json.log.sender }}",
            "Subject": "={{ $('Route by Email Intent').item.json.log.subject }}",
            "Email ID": "={{ $('Route by Email Intent').item.json.id }}",
            "Timestamp": "={{$now}}"
          },
          "schema": [
            {
              "id": "Timestamp",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Timestamp",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Email ID",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Email ID",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Sender",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Sender",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Subject",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Subject",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Intent",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Intent",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Action",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Action",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1M7N9HtJx8HX7UNY80SxPPyfQzf6qB4CmaG0jIsE5Ugg/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1M7N9HtJx8HX7UNY80SxPPyfQzf6qB4CmaG0jIsE5Ugg",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1M7N9HtJx8HX7UNY80SxPPyfQzf6qB4CmaG0jIsE5Ugg/edit?usp=drivesdk",
          "cachedResultName": "Email-Intent"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "8a4e46f3-f08f-4fd5-a352-3ca7423ee2a9",
      "name": "Create Google Task for Complaint",
      "type": "n8n-nodes-base.googleTasks",
      "position": [
        -192,
        1152
      ],
      "parameters": {
        "task": "MTA5Njg2NTM3NjcxNTI3MDY0NzQ6MDow",
        "title": "={{ $json.google_task?.title || ('Follow up complaint: ' + ($json.log?.subject || '')) }}",
        "additionalFields": {
          "notes": "={{ $json.google_task?.notes || $json.slack_message || 'Review and resolve the complaint email.' }}"
        }
      },
      "credentials": {
        "googleTasksOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "bc2ca131-80c9-4047-956d-3d78ca66916a",
      "name": "Send Slack Alert for Drafted Email",
      "type": "n8n-nodes-base.slack",
      "position": [
        -192,
        960
      ],
      "parameters": {
        "text": "= New {{$json.intent}} email\\nFrom: {{$json.log.sender}}\\nSubject: {{$json.log.subject}}\\nDraft created: \\nPreview: {{$json.gmail_draft.body}}",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": "C0APT9336Q5",
          "cachedResultName": "all-email-intent"
        },
        "otherOptions": {},
        "authentication": "oAuth2"
      },
      "credentials": {
        "slackOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.4
    },
    {
      "id": "c67bb986-f05b-4755-8d29-7277a2378dbc",
      "name": "Log Spam to Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -416,
        1536
      ],
      "parameters": {
        "columns": {
          "value": {
            "Action": "={{ $json.log.action }}",
            "Intent": "={{ $json.log.intent }}",
            "Sender": "={{ $json.log.sender }}",
            "Subject": "={{ $json.log.subject }}",
            "Email ID": "={{ $json.id }}",
            "Timestamp": "={{$now}}"
          },
          "schema": [
            {
              "id": "Timestamp",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Timestamp",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Email ID",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Email ID",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Sender",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Sender",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Subject",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Subject",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Intent",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Intent",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Action",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Action",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1M7N9HtJx8HX7UNY80SxPPyfQzf6qB4CmaG0jIsE5Ugg/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1M7N9HtJx8HX7UNY80SxPPyfQzf6qB4CmaG0jIsE5Ugg",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1M7N9HtJx8HX7UNY80SxPPyfQzf6qB4CmaG0jIsE5Ugg/edit?usp=drivesdk",
          "cachedResultName": "Email-Intent"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "e6df6bfb-ea09-4ef7-a41f-3311496e7293",
      "name": "Workflow Overview",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2112,
        720
      ],
      "parameters": {
        "width": 1508,
        "height": 348,
        "content": "## Email Intent Automation Overview\n\n**How it works**\nThis workflow watches Gmail for new emails, normalizes the sender, subject, and body in one reusable Set/Edit node, then batches emails for Gemini to classify them as Question, Request, Complaint, FYI, or Spam. After the AI response is parsed, the workflow routes each email to the right action: create a Gmail draft and send a Slack alert for Questions/Requests, send an urgent Slack alert and create a Google Task for Complaints, log FYI emails, and log Spam as skipped.\n\n**Setup steps**\n1. Connect Gmail, Google Sheets, Slack, Google Tasks, and Gemini credentials.\n2. Verify the Gmail trigger is set for new unread emails.\n3. Confirm the sheet columns match the logging nodes.\n4. Update the Slack channels and Google Task list.\n5. Test with one email from each intent before activating the workflow."
      },
      "typeVersion": 1
    },
    {
      "id": "e0f0ec1f-a982-4617-af86-f490ae01fdc9",
      "name": "Intake Sticky",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2112,
        1120
      ],
      "parameters": {
        "color": 7,
        "width": 440,
        "height": 312,
        "content": "## Intake & Normalization\nTrigger Gmail, then prepare reusable fields like sender email, sender name, subject, body source, timestamps, and default routing values in one place."
      },
      "typeVersion": 1
    },
    {
      "id": "522115e4-43fa-4a12-bca0-314fe0e6d9b9",
      "name": "AI Sticky",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1632,
        1104
      ],
      "parameters": {
        "color": 7,
        "width": 1016,
        "height": 360,
        "content": "## AI Classification\nBundle incoming emails, classify intent in Gemini, parse the JSON safely, and split the result so each email can be routed on its own path."
      },
      "typeVersion": 1
    },
    {
      "id": "94fb3e30-cf07-4a43-91cc-c18b2ca5fcd1",
      "name": "Routing Sticky",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -480,
        800
      ],
      "parameters": {
        "color": 7,
        "width": 696,
        "height": 888,
        "content": "## Routing & Logging\nEach intent follows its action path: draft reply, Slack alert, Google Task, or sheet logging. Every handled email is logged for traceability."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "binaryMode": "separate",
    "executionOrder": "v1"
  },
  "versionId": "92b38338-04af-4aa0-9dac-b00d6d2f453f",
  "connections": {
    "Bundle Emails for AI": {
      "main": [
        [
          {
            "node": "Classify Intent and Generate Actions",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Route by Email Intent": {
      "main": [
        [
          {
            "node": "Create Gmail Draft Reply",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Create Gmail Draft Reply",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send Urgent Slack Complaint Alert",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Log FYI to Sheet",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Log Spam to Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse AI JSON Response": {
      "main": [
        [
          {
            "node": "Split AI Results Per Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Watch New Unread Emails": {
      "main": [
        [
          {
            "node": "Extract Sender Subject Body",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Gmail Draft Reply": {
      "main": [
        [
          {
            "node": "Send Slack Alert for Drafted Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split AI Results Per Email": {
      "main": [
        [
          {
            "node": "Route by Email Intent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Sender Subject Body": {
      "main": [
        [
          {
            "node": "Bundle Emails for AI",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Google Task for Complaint": {
      "main": [
        [
          {
            "node": "Log Complaint to Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Urgent Slack Complaint Alert": {
      "main": [
        [
          {
            "node": "Create Google Task for Complaint",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Slack Alert for Drafted Email": {
      "main": [
        [
          {
            "node": "Log Question or Request to Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Classify Intent and Generate Actions": {
      "main": [
        [
          {
            "node": "Parse AI JSON Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

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

This workflow monitors Gmail for new unread emails, uses Google Gemini to classify each email’s intent, then creates Gmail draft replies and Slack alerts for questions/requests, escalates complaints with Slack and Google Tasks, and logs FYI and spam activity to Google Sheets.…

Source: https://n8n.io/workflows/16304/ — 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

Customer Feedback Loop Analyzer. Uses formTrigger, lmChatGoogleGemini, gmail, slack. Event-driven trigger; 11 nodes.

Form Trigger, Google Gemini Chat, Gmail +4
AI & RAG

This workflow delivers a complete, enterprise-grade Gmail automation system designed for high-volume teams. It classifies incoming emails, applies labels, generates AI-powered responses, and routes me

Gmail, OpenAI, Telegram +3
AI & RAG

Analyze Amazon product reviews with Gemini and save to Google Sheets

Slack, Google Sheets, Google Gemini +1
AI & RAG

Automatically analyze email attachments with AI and forward invoices/receipts to freee's File Box. Polls Gmail for new emails with attachments every minute Extracts text from PDF attachments and sends

Gmail Trigger, Gmail, Google Gemini
AI & RAG

Newsletter PDF Extractor & Curator. Uses gmailTrigger, n8n-nodes-pdfvector, googleSheets, slack. Event-driven trigger; 9 nodes.

Gmail Trigger, N8N Nodes Pdfvector, Google Sheets +1