AutomationFlowsAI & RAG › AI-Powered Gmail Processing with OpenAI

AI-Powered Gmail Processing with OpenAI

Original n8n title: Workflow 3899

Workflow 3899. Uses lmChatOpenAi, outputParserStructured, chainLlm, gmail. Scheduled trigger; 13 nodes.

Cron / scheduled trigger★★★★☆ complexityAI-powered13 nodesOpenAI ChatOutput Parser StructuredChain LlmGmailLinear
AI & RAG Trigger: Cron / scheduled Nodes: 13 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow follows the Chainllm → 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
{
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "1c583599-826d-4a02-bfd9-f22f020f4af7",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -640,
        -140
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "hours"
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "aaddc5fd-4b05-4ee2-9f71-222b14fb05d6",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        280,
        40
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "cd2a47fb-3e04-464d-bcac-00e84952d72c",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        480,
        40
      ],
      "parameters": {
        "schemaType": "manual",
        "inputSchema": "{\n  \"type\": \"object\",\n  \"properties\": {\n    \"labels\": {\n      \"type\": \"array\",\n      \"items\": { \"type\": \"string\" }\n    },\n    \"priority\": { \"type\": \"number\" },\n    \"summary\": { \"type\": \"string\" },\n    \"description\": { \"type\": \"string\" }\n  }\n}"
      },
      "typeVersion": 1.2
    },
    {
      "id": "48234689-66fd-4a5e-b940-5e6e07a95ad9",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        -340
      ],
      "parameters": {
        "color": 7,
        "width": 700,
        "height": 540,
        "content": "## 2. \ud2f0\ucf13 \uc0dd\uc131 \ubc0f \ubd84\ub958 \uc790\ub3d9\ud654\n\n[Basic LLM \ub178\ub4dc\uc5d0 \ub300\ud574 \uc790\uc138\ud788 \uc54c\uc544\ubcf4\uae30](https://docs.n8n.io/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.chainllm)\n\n\uc0c8\ub85c\uc6b4 \ud2f0\ucf13\uc740 \ud56d\uc0c1 \uc801\uc808\ud558\uac8c \ub808\uc774\ube14\ub9c1\ub418\uace0 \uc6b0\uc120\uc21c\uc704\uac00 \uc9c0\uc815\ub418\uc5b4\uc57c \ud558\uc9c0\ub9cc, \uc778\ub825\uc774 \ubd80\uc871\ud558\uba74 \ubaa8\ub4e0 \ub4e4\uc5b4\uc624\ub294 \ud2f0\ucf13\uc744 \uc5c5\ub370\uc774\ud2b8\ud558\ub294 \uac83\uc774 \ud56d\uc0c1 \uac00\ub2a5\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. AI\ub97c \uc0ac\uc6a9\ud558\ub294 \uac83\uc740 \ud2f0\ucf13\uc758 \ubd84\ub958\uc5d0 \ub300\ud55c \ud6cc\ub96d\ud55c \uc6a9\ub840\uc774\uba70, \uadf8 \ub9e5\ub77d\uc801 \uc774\ud574\uac00 \uc774 \ub2e8\uacc4\ub97c \uc790\ub3d9\ud654\ud558\ub294 \ub370 \ub3c4\uc6c0\uc774 \ub429\ub2c8\ub2e4."
      },
      "typeVersion": 1
    },
    {
      "id": "c25fd99f-4898-479f-bf63-a79c3ca084fc",
      "name": "Markdown",
      "type": "n8n-nodes-base.markdown",
      "position": [
        100,
        -140
      ],
      "parameters": {
        "html": "={{ $json.html }}",
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "b27f5e33-d149-4395-84b2-e1e1070c8a0b",
      "name": "Mark as Seen",
      "type": "n8n-nodes-base.removeDuplicates",
      "position": [
        -220,
        -140
      ],
      "parameters": {
        "options": {},
        "operation": "removeItemsSeenInPreviousExecutions",
        "dedupeValue": "={{ $json.id }}"
      },
      "typeVersion": 2
    },
    {
      "id": "e282e452-0dbb-4d00-b319-13840264feda",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -740,
        -340
      ],
      "parameters": {
        "color": 7,
        "width": 720,
        "height": 540,
        "content": "## 1. Gmail \uc778\ubc15\uc2a4 \uc9c0\uc6d0 \uc774\uba54\uc77c \uac10\uc2dc\n\n[Gmail \ub178\ub4dc\uc5d0 \ub300\ud574 \ub354 \uc54c\uc544\ubcf4\uae30](https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.gmail/)\n\n**\uc774 \ud15c\ud50c\ub9bf\uc740 \uc9c0\uc6d0 \ud2f0\ucf13 \uc804\uc6a9 \uadf8\ub8f9 \uc774\uba54\uc77c\uc744 \uac00\uc815\ud569\ub2c8\ub2e4!** \uc77c\ubc18 \uc778\ubc15\uc2a4\ub97c \uac00\uc9c0\uace0 \uc788\ub2e4\uba74, \uac01 \uba54\uc2dc\uc9c0\ub97c \ubd84\ub958\ud558\uace0 \ud544\ud130\ub9c1\ud574\uc57c \ud560 \uc218 \uc788\uc73c\uba70, \uc774\ub294 \ube44\uc6a9\uc774 \ub4e4 \uc218 \uc788\uc2b5\ub2c8\ub2e4. \"remove duplicates\" \ub178\ub4dc (\uc989, \"Mark as seen\")\ub294 \uac01 \uc774\uba54\uc77c\uc744 \uc815\ud655\ud788 \ud55c \ubc88\ub9cc \ucc98\ub9ac\ud558\ub3c4\ub85d \ud569\ub2c8\ub2e4."
      },
      "typeVersion": 1
    },
    {
      "id": "d43db00e-bfd4-4b18-ad33-4bccb3373d09",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        720,
        -340
      ],
      "parameters": {
        "color": 7,
        "width": 460,
        "height": 440,
        "content": "## 3. Linear.App\uc5d0\uc11c \uc774\uc288 \uc0dd\uc131\n\n[Linear.App \ub178\ub4dc\uc5d0 \ub300\ud574 \ub354 \uc54c\uc544\ubcf4\uae30](https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.linear)\n\n\uc774\uac83\uc740 Linear.App\uc5d0\uc11c \uc774\uc288\ub97c \uc0dd\uc131\ud558\ub294 \uac04\ub2e8\ud55c \uc608\uc81c\uc77c \ubfd0\uc774\uc9c0\ub9cc, \ud6e8\uc52c \ub354 \ub9ce\uc740 \uac83\uc744 \ucd94\uac00\ud558\uae30 \uc27d\uac8c \ud655\uc7a5\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4!"
      },
      "typeVersion": 1
    },
    {
      "id": "13f657aa-5af1-4af4-af04-f81a13d2ce29",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1160,
        -720
      ],
      "parameters": {
        "width": 380,
        "height": 940,
        "content": "## \uc2dc\ub3c4\ud574 \ubcf4\uc138\uc694!\n### \uc774 n8n \ud15c\ud50c\ub9bf\uc740 Gmail \uc778\ubc15\uc2a4\uc5d0\uc11c \uc9c0\uc6d0 \uba54\uc2dc\uc9c0\ub97c \uac10\uc2dc\ud558\uace0 Linear\uc5d0\uc11c \uc774\uc5d0 \uc0c1\uc751\ud558\ub294 \uc774\uc288 \ud56d\ubaa9\uc744 \uc0dd\uc131\ud569\ub2c8\ub2e4.\n\n### \uc791\ub3d9 \uc6d0\ub9ac\n* \uc608\uc57d\ub41c \ud2b8\ub9ac\uac70\uac00 \uc9c0\uc6d0 \uc694\uccad\uc744 \uc218\uc9d1\ud558\ub294 \uc778\ubc15\uc2a4\uc5d0\uc11c \ucd5c\uadfc Gmail \uba54\uc2dc\uc9c0\ub97c \uac00\uc838\uc635\ub2c8\ub2e4.\n* \uc774\ub7ec\ud55c \uc9c0\uc6d0 \uc694\uccad\uc740 \ud55c \ubc88\ub9cc \ucc98\ub9ac\ub418\ub3c4\ub85d \ud544\ud130\ub9c1\ub418\uba70, HTML \ubcf8\ubb38\uc744 \ub354 \uc27d\uac8c \uad6c\ubb38 \ubd84\uc11d\ud560 \uc218 \uc788\ub3c4\ub85d \ub9c8\ud06c\ub2e4\uc6b4\uc73c\ub85c \ubcc0\ud658\ub429\ub2c8\ub2e4.\n* \uac01 \uc9c0\uc6d0 \uc694\uccad\uc740 AI \uc5d0\uc774\uc804\ud2b8\ub97c \ud1b5\ud574 \ubd84\ub958\ub418\uba70, \uc801\uc808\ud55c \ub808\uc774\ube14\uc744 \ucd94\uac00\ud558\uace0, \uc6b0\uc120\uc21c\uc704\ub97c \ud3c9\uac00\ud558\uba70, \uc6d0\ub798 \uc694\uccad\uc758 \uc81c\ubaa9\uacfc \uc124\uba85\uc744 \uc694\uc57d\ud569\ub2c8\ub2e4.\n* \ub9c8\uc9c0\ub9c9\uc73c\ub85c, AI\uac00 \uc0dd\uc131\ud55c \uac12\uc744 \uc0ac\uc6a9\ud558\uc5ec Linear\uc5d0\uc11c \uc774\uc288\ub97c \uc0dd\uc131\ud558\uc5ec \ucc98\ub9ac\ud560 \uc218 \uc788\ub3c4\ub85d \ud569\ub2c8\ub2e4.\n\n### \uc0ac\uc6a9 \ubc29\ubc95\n* \uac00\uc838\uc628 \uba54\uc2dc\uc9c0\uac00 \uc624\ub85c\uc9c0 \uc9c0\uc6d0 \uc694\uccad\ub9cc\uc774\uc5b4\uc57c \ud569\ub2c8\ub2e4. \uadf8\ub807\uc9c0 \uc54a\uc73c\uba74 \ucc98\ub9ac \uc804\uc5d0 \uba54\uc2dc\uc9c0\ub97c \ubd84\ub958\ud574\uc57c \ud569\ub2c8\ub2e4.\n* AI \uc5d0\uc774\uc804\ud2b8\uc758 \uc2dc\uc2a4\ud15c \ud504\ub86c\ud504\ud2b8\uc5d0\uc11c \uc0ac\uc6a9\ud560 \ub808\uc774\ube14\uacfc \uc6b0\uc120\uc21c\uc704\ub97c \uc9c0\uc815\ud558\uc138\uc694.\n\n### \uc694\uad6c \uc0ac\ud56d\n* Gmail: \ub4e4\uc5b4\uc624\ub294 \uc9c0\uc6d0 \uba54\uc2dc\uc9c0\uc6a9\n* OpenAI: LLM\uc6a9\n* Linear: \uc774\uc288 \uad00\ub9ac\uc6a9\n\n### \uc774 \uc6cc\ud06c\ud50c\ub85c \ucee4\uc2a4\ud130\ub9c8\uc774\uc9d5\n* \uc774\uc288 \uc0dd\uc131 \ud6c4 \ubb38\uc81c \ud574\uacb0 \uc2dc\ub3c4\ub098 \uc6a9\ub7c9 \uacc4\ud68d\uacfc \uac19\uc740 \ucd94\uac00 \ub2e8\uacc4\ub97c \uc790\ub3d9\ud654\ud558\ub294 \uac83\uc744 \uace0\ub824\ud558\uc138\uc694.\n\n### \ub3c4\uc6c0\uc774 \ud544\uc694\ud558\uc138\uc694?\n[Discord](https://discord.com/invite/XPKeKXeB7d) \ucee4\ubba4\ub2c8\ud2f0\uc5d0 \ucc38\uc5ec\ud558\uac70\ub098 [\ud3ec\ub7fc](https://community.n8n.io/)\uc5d0\uc11c \ubb38\uc758\ud558\uc138\uc694!\n\n\uc990\uac70\uc6b4 \ud574\ud0b9!"
      },
      "typeVersion": 1
    },
    {
      "id": "684a5300-41c9-4ec4-8780-d1797e4dcfa2",
      "name": "Generate Issue From Support Request",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        300,
        -140
      ],
      "parameters": {
        "text": "=Reported by {{ $json.from.value[0].name }} <{{ $json.from.value[0].address }}>\nReported at: {{ $now.toISO() }}\nSummary: {{ $json.subject }}\nDescription:\n{{ $json.data.replaceAll('\\n', ' ') }}",
        "messages": {
          "messageValues": [
            {
              "message": "=Your are Issues triage assistant who's task is to\n1) classify and label the given issue.\n2) Prioritise the given issue.\n3) Rewrite the issue summary and description.\n\n## Labels\nUse one or more labels.\n* Technical\n* Account\n* Access\n* Billing\n* Product\n* Training\n* Feedback\n* Complaints\n* Security\n* Privacy\n\n## Priority\n* 1 - highest\n* 2 - high\n* 3 - medium\n* 4 - low\n* 5 - lowest\n\n## Write Summary and Description\n* Remove emotional and anedotal phrases or information\n* Keep to the facts of the matter\n* Highlight what was attempted and is/was failing"
            }
          ]
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 1.6
    },
    {
      "id": "50aa5f53-680a-4518-a3a5-b97c3bd82af3",
      "name": "Get Recent Messages",
      "type": "n8n-nodes-base.gmail",
      "position": [
        -440,
        -140
      ],
      "parameters": {
        "limit": 1,
        "simple": false,
        "filters": {
          "q": "to:support@example.com"
        },
        "options": {},
        "operation": "getAll"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "a7a41e51-3852-43f3-98b9-d67bab4f8e41",
      "name": "Create Issue in Linear.App",
      "type": "n8n-nodes-base.linear",
      "position": [
        900,
        -140
      ],
      "parameters": {
        "title": "={{ $json.output.summary }}",
        "teamId": "1c721608-321d-4132-ac32-6e92d04bb487",
        "additionalFields": {
          "stateId": "92962324-3d1f-4cf8-993b-0c982cc95245",
          "priorityId": "={{ $json.output.priority ?? 3 }}",
          "description": "={{ $json.output.description }}\n\n{{ $json.output.labels.map(label => `#${label}`).join(' ') }}"
        }
      },
      "credentials": {
        "linearApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "4593cd01-8fa3-4828-ba77-21082a2f31fb",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -500,
        40
      ],
      "parameters": {
        "color": 5,
        "height": 120,
        "content": "### \uc9c0\uba54\uc77c \ud544\ud130\n\uc5ec\uae30\uc5d0\uc11c `to:support@example.com` \ud544\ud130\ub97c \uc0ac\uc6a9\ud558\uc5ec \uc9c0\uc6d0 \uc694\uccad\uc744 \ucea1\ucc98\ud558\uace0 \uc788\uc2b5\ub2c8\ub2e4."
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "Markdown": {
      "main": [
        [
          {
            "node": "Generate Issue From Support Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Mark as Seen": {
      "main": [
        [
          {
            "node": "Markdown",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Get Recent Messages",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Generate Issue From Support Request",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Get Recent Messages": {
      "main": [
        [
          {
            "node": "Mark as Seen",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Generate Issue From Support Request",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Generate Issue From Support Request": {
      "main": [
        [
          {
            "node": "Create Issue in Linear.App",
            "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

Workflow 3899. Uses lmChatOpenAi, outputParserStructured, chainLlm, gmail. Scheduled trigger; 13 nodes.

Source: https://github.com/n8nKOR/n8n-shared-workflow/blob/62a671327e906c22a40d290b339ff6d2373f8d75/workflows/n8n-workflows-by-Zie619/ai/3899_workflow_3899.json — 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

A scheduled trigger fetches recent Gmail messages from the inbox which collects support requests. These support requests are filtered to ensure they are only processed once and their HTML body is conv

OpenAI Chat, Output Parser Structured, Chain Llm +2
AI & RAG

This n8n-powered workflow automates the entire lifecycle of real estate lead intake, qualification, routing, assignment, and reporting across multiple channels. It brings WhatsApp inquiries and websit

Gmail, Typeform Trigger, WhatsApp Trigger +8
AI & RAG

kisisel asistan. Uses toolWorkflow, toolHttpRequest, toolCalculator, toolThink. Scheduled trigger; 43 nodes.

Tool Workflow, Tool Http Request, Tool Calculator +15
AI & RAG

My workflow 14. Uses rssFeedRead, chainLlm, lmChatOpenAi, openWeatherMap. Scheduled trigger; 40 nodes.

RSS Feed Read, Chain Llm, OpenAI Chat +6
AI & RAG

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

Chain Llm, Agent, Execute Workflow Trigger +6