AutomationFlowsAI & RAG › Gmail Task Extractor

Gmail Task Extractor

Gmail Task Extractor. Uses gmailTrigger, gmail, openAi. Event-driven trigger; 5 nodes.

Event trigger★★★★☆ complexityAI-powered5 nodesGmail TriggerGmailOpenAI
AI & RAG Trigger: Event Nodes: 5 Complexity: ★★★★☆ AI nodes: yes Added:

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
{
  "name": "Gmail Task Extractor",
  "nodes": [
    {
      "parameters": {
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute",
              "minute": 5
            }
          ]
        }
      },
      "id": "gmail-trigger",
      "name": "Gmail Trigger",
      "type": "n8n-nodes-base.gmailTrigger",
      "typeVersion": 1,
      "position": [
        250,
        300
      ],
      "credentials": {
        "gmailOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "resource": "message",
        "operation": "get",
        "messageId": "={{$json[\"id\"]}}",
        "options": {
          "format": "full"
        }
      },
      "id": "get-email-details",
      "name": "Get Email Details",
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2,
      "position": [
        450,
        300
      ],
      "credentials": {
        "gmailOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "resource": "chat",
        "operation": "message",
        "modelId": "gpt-4",
        "messages": {
          "values": [
            {
              "role": "system",
              "content": "You are an expert at extracting actionable tasks from emails. Return ONLY a JSON array of tasks."
            },
            {
              "role": "user",
              "content": "Extract tasks from this email:\\n\\nFrom: {{$json[\"payload\"][\"headers\"].find(h => h.name === 'From').value}}\\nSubject: {{$json[\"payload\"][\"headers\"].find(h => h.name === 'Subject').value}}\\nBody: {{$json[\"snippet\"]}}\\n\\nFor each task return:\\n{\\n  \"title\": \"Clear task description\",\\n  \"description\": \"Additional context\",\\n  \"priority\": 1-5,\\n  \"dueDate\": \"YYYY-MM-DD or null\",\\n  \"context\": \"Work/Personal/Family/Learning\"\\n}\\n\\nReturn empty array [] if no tasks found."
            }
          ]
        },
        "options": {
          "temperature": 0.1
        }
      },
      "id": "extract-tasks",
      "name": "Extract Tasks with OpenAI",
      "type": "n8n-nodes-base.openAi",
      "typeVersion": 1,
      "position": [
        650,
        300
      ],
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "functionCode": "const tasksJson = $input.first().json.message.content;\nlet tasks = [];\n\ntry {\n  tasks = JSON.parse(tasksJson);\n} catch (e) {\n  // Try to extract JSON from response\n  const match = tasksJson.match(/\\[.*\\]/s);\n  if (match) {\n    tasks = JSON.parse(match[0]);\n  }\n}\n\n// Add email metadata to each task\nconst emailData = $input.all()[0].json;\nconst emailId = emailData.id;\nconst subject = emailData.payload.headers.find(h => h.name === 'Subject')?.value || '';\n\nreturn tasks.map(task => ({\n  json: {\n    ...task,\n    source: 'email',\n    emailId: emailId,\n    emailSubject: subject,\n    extractedAt: new Date().toISOString()\n  }\n}));"
      },
      "id": "process-tasks",
      "name": "Process Tasks",
      "type": "n8n-nodes-base.code",
      "typeVersion": 1,
      "position": [
        850,
        300
      ]
    },
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "gmail-tasks",
        "responseMode": "onReceived",
        "options": {}
      },
      "id": "webhook",
      "name": "Send to App Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 1,
      "position": [
        1050,
        300
      ]
    }
  ],
  "connections": {
    "Gmail Trigger": {
      "main": [
        [
          {
            "node": "Get Email Details",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Email Details": {
      "main": [
        [
          {
            "node": "Extract Tasks with OpenAI",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Tasks with OpenAI": {
      "main": [
        [
          {
            "node": "Process Tasks",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Process Tasks": {
      "main": [
        [
          {
            "node": "Send to App Webhook",
            "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

Gmail Task Extractor. Uses gmailTrigger, gmail, openAi. Event-driven trigger; 5 nodes.

Source: https://github.com/scottring/life-coach-ai/blob/20a5db23f06176d8762f61a21413a9c3ab22d61e/n8n-workflows/gmail-task-extractor.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

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

Automatically organise your Gmail inbox using AI. This workflow categorises every incoming email and applies Gmail labels, keeping only important emails in your inbox while filing everything else auto

OpenAI, Gmail, Gmail Trigger
AI & RAG

Domain Outbound Machine is an n8n workflow designed to fully automate the domain sales process: lead generation, email extraction, personalized outreach, and automated email sending. It also stores ex

Google Sheets, HTTP Request, Gmail +1
AI & RAG

Monitor YouTube channels, fetch stats, classify videos as viral (≥ 1000 likes) or normal, and auto‑generate LinkedIn/email summaries with GPT‑4. Deliver via Gmail or SMTP. Clear node names, examples,

RSS Feed Read, HTTP Request, OpenAI +1
AI & RAG

This workflow automatically converts incoming Gmail messages into structured support tickets using AI classification. It assigns categories, generates a unique ticket ID, stores data in PostgreSQL, as

Gmail, Text Classifier, Lm Ollama +2