Draft and approve Gmail replies with OpenAI, Cognee, Slack, and Google Sheets
Needs changesNeeds changes. This template uses 1 thing(s) that n8n 3.0 removes: AI Agent v1 (old agent modes). 1 breaking item(s) found. Static check, last run 2026-10-19.
What to replace before upgrading
| Removed in 3.0 | Replace with |
|---|---|
| AI Agent v1 (old agent modes) Draft Reply Agent (v1.9) | Latest AI Agent node (Tools Agent). For SQL Agent, use a Postgres or MySQL tool with a recent AI Agent. |
Worth a look
- Gmail Trigger below v1.4 runs as v1.4 (drafts skipped, max emails per poll) (New Email Received)
Community nodes
These come from third-party npm packages. In n8n 3.0 unverified community packages are off by default (N8N_UNVERIFIED_PACKAGES_ENABLED=false).
n8n-nodes-cognee(Search Company Brain (Cognee))
Nodes used (13)
- Slack
n8n-nodes-base.slack - If
n8n-nodes-base.if - Edit Fields (Set)
n8n-nodes-base.set - Google Sheets
n8n-nodes-base.googleSheets - Gmail Trigger
n8n-nodes-base.gmailTrigger - No Operation, do nothing
n8n-nodes-base.noOp - Basic LLM Chain
@n8n/n8n-nodes-langchain.chainLlm - OpenAI Chat Model
@n8n/n8n-nodes-langchain.lmChatOpenAi - Structured Output Parser
@n8n/n8n-nodes-langchain.outputParserStructured - Cognee Tool
n8n-nodes-cognee.cogneeTool - Gmail
n8n-nodes-base.gmail - AI Agent
@n8n/n8n-nodes-langchain.agent - Error Trigger
n8n-nodes-base.errorTrigger
What it does
Quick overview This workflow monitors a Gmail inbox for new messages, uses OpenAI to decide whether a reply is needed, drafts grounded replies with a Cognee knowledge base, saves them as Gmail drafts, and requests human approval in Slack while logging approvals to Google Sheets. How it works 1. Triggers every minute when a new email arrives in the Gmail INBOX. 2. Filters out automated senders (for example no-reply and mailer-daemon addresses) to skip unnecessary processing. 3. Uses OpenAI (gpt-4o-mini) to classify the email as needing a human reply or not. 4. For emails that need a reply, uses an OpenAI agent (gpt-4o-mini) with Cognee search to retrieve relevant company context and draft a response. 5. Creates a Gmail draft reply in the same thread and posts a preview to Slack for approve/reject decision. 6. Logs the approval status, timestamp, sender, subject, and draft text to Google Sheets. 7. If any step fails, formats the error details and sends an alert to Slack. Setup 1. Connect Gmail OAuth2 credentials and choose the mailbox/label to monitor, then ensure draft creation has access to the same Gmail account. 2. Add an OpenAI API credential for the classifier and drafting agent, and ensure the gpt-4o-mini model is available to your account. 3. Add a Cognee API credential and set the Cognee dataset used for search (for example cognee3rdworkflowdataset). 4. Connect Slack credentials and set the target Slack channel ID for approval requests and the channel for error alerts. 5. Connect Google Sheets OAuth2 credentials, then set the spreadsheet/document ID and sheet name and ensure the sheet has columns for Timestamp, From, Subject, Draft, and Approval Status.