Extract Email Tasks with Gmail, ChatGPT-4o and Supabase
š© Gmail ā GPT ā Supabase | Task Extractor
This n8n workflow automates the extraction of actionable tasks from unread Gmail messages using OpenAI's GPT API, stores the resulting task metadata in Supabase, and avoids re-processing previously handled emails.
ā What It Does
Triggers on a schedule to check for unread emails in your Gmail inbox. Loops through each email individually using SplitInBatches. Checks Supabase to see if the email has already been processed. If it's a new email: Formats the email content into a structured GPT prompt Calls ChatGPT-4o to extract structured task data Inserts the result into your emails table in Supabase
š§° Prerequisites
Before using this workflow, you must have:
An active n8n Cloud or self-hosted instance A connected Gmail account with OAuth credentials in n8n A Supabase project with an emails table and: ALTER TABLE emails ADD CONSTRAINT unique_email_id UNIQUE (email_id); An OpenAI API key with access to GPT-4o or GPT-3.5-turbo
š Required Credentials
| Name | Type | Description | |-----------------|------------|-----------------------------------| | Gmail OAuth | Gmail | To pull unread messages | | OpenAI API Key | OpenAI | To generate task summaries | | Supabase API | HTTP | For inserting rows via REST API |
š Environment Variables or Replacements
Supabase_TaskManagement_URI ā e.g., https://your-project.supabase.co Supabase_TaskManagement_ANON_KEY ā Your Supabase anon key
These are used in the HTTP request to Supabase.
ā° Scheduling / Trigger
Triggered using a Schedule node Default: every X minutes (adjust to your preference) Uses a Gmail API filter: unread emails with label = INBOX
š§ Intended Use Case
> Designed for productivity-minded professionals who want to extract, summarize, and store actionable tasks from incoming email ā without processing the same email twice or wasting GPT API credits.
This is part of a larger system integrating GPT, calendar scheduling, and optional task platforms (like ClickUp).
š¦ Output (Stored in Supabase)
Each processed email includes: email_id subject sender received_at body (email snippet) gpt_summary (structured task) requires_deep_work (from GPT logic) deleted (initially false)
Related Templates
Task Deadline Reminders with Google Sheets, ChatGPT, and Gmail
Intro This template is for project managers, team leads, or anyone who wants to automatically remind teammates of tasks ...
š¤ Build Resilient AI Workflows with Automatic GPT and Gemini Failover Chain
This workflow contains community nodes that are only compatible with the self-hosted version of n8n. How it works This...
Smart Sales Support Chatbot with GPT-4o and Google Sheets
Who is this tempate for? This workflow powers a simple yet effective customer and sales support chatbot for your webshop...
š Please log in to import templates to n8n and favorite templates
Workflow Visualization
Loading...
Preparing workflow renderer
Comments (0)
Login to post comments