Skip to content
FlowHubFluxonLab
C
AI Automationfree

Draft and approve Gmail replies with OpenAI and CustomJS

by CustomJSadapted from n8n official workflow galleryUpdated Aug 2026
RequiresCCodeGmailGmailOpenAI
Share Post Share
MaWhen clicking 'Execute workflow'When clicking '…PTUpsert Approval PageUpsert Approval…Get many messagesGet many messag…WeWebhook - Receive ApprovalWebhook - Recei…CoExtract Reply DataExtract Reply D…CoFilter No Reply EmailsFilter No Reply…Generate AI Draft ReplyGenerate AI Dra…CoFormat Email DraftsFormat Email Dr…CoBuild Approval PageBuild Approval …Reply to a messageReply to a mess…Mark a message as readMark a message …123456
1/5
FLOWS
STEPS · 6
Run manually by an operator

Quick Overview This workflow pulls unread Gmail messages, generates draft replies with OpenAI, and publishes an approval dashboard via CustomJS. When you approve or edit a draft in the dashboard, it posts back to a webhook that sends the reply in Gmail and marks the original message as read. How it works Runs manually to fetch unread messages from Gmail. Filters out messages from common no-reply senders to avoid automated emails. Uses OpenAI (GPT-5) to generate a draft reply from the email subject, snippet, sender, and recipient. Compiles the original emails and AI drafts into a single HTML approval dashboard and publishes it as a CustomJS page. Receives an approval submission from the dashboard via an n8n webhook containing the edited reply text plus the Gmail message and thread IDs. Replies to the original Gmail message with the approved text and then marks the message as read. Setup Connect Gmail OAuth2 credentials for the Gmail nodes that read messages, reply, and mark messages as read. Add an OpenAI API credential and select the model you want to use for draft generation. Add your CustomJS credentials and confirm the target page name used to publish the dashboard.

Tags

n8nreference-onlygmailopen-ai
Connects
CCodegmailGmailOpenAI
CategoryAI Automation
Triggermanual
Complexitycomplex
Nodes11
AddedMay 30, 2026

Related workflows

See all AI Automation
CgmailsheetsW
free

Send Calendly meeting prep briefs with Gmail, Notion, OpenAI and Sheets

Quick Overview This workflow monitors Gmail for Calendly “New Event” emails, extracts meeting details with OpenAI, enriches the invitee with Notion CRM data, Google Sheets STR records, and SerpApi building research, then generates and schedules a meeting-prep brief email to send 30 minutes before the meeting. How it works Triggers every minute when a new Gmail message arrives and continues only if it is a Calendly notification for a new event. Uses OpenAI to extract the invitee email and meeting date/time from the email and calculates a send time 30 minutes before the meeting. Looks up the lead in a Notion database by invitee email and pulls building research via SerpApi, then uses OpenAI to extract building details from the AI Overview results. Loads STR registration data from Google Sheets and matches it to the building address to flag whether the property appears in STR records. Searches recent Gmail history in two accounts for messages involving the lead’s email address and checks whether any history exists. If email history exists, uses OpenAI to summarize the relationship and generate a concise meeting brief, then formats it as an HTML email. If no email history exists, uses

by Marc Soummer
ACDgmail
free

AI: Summarize podcast episode and enhance using Wikipedia

The workflow automates the process of creating a summarized and enriched podcast digest, which is then sent via email. Note that to use this template, you need to be on n8n version 1.19.4 or later.

by n8n Team
ACgmailsheets
free

Analyze YouTube comments with OpenAI, Google Sheets, and Gmail

Quick overview This workflow monitors a Google Sheets list of YouTube video IDs, fetches video details and top comments from the YouTube Data API, analyzes the comments with OpenAI into structured sentiment and themes, emails an HTML report via Gmail, and writes the results back to Google Sheets. How it works Triggers every minute when a row in Google Sheets is added or updated. Reads the video ID and status from the row and continues only if the status is set to “Pending”. Calls the YouTube Data API to fetch the video’s metadata and the top comment threads for that video. Flattens the comment threads, calculates basic stats (comment count and average likes), and compiles a limited comment text block for analysis. If comments exist, sends the compiled comments and video title to OpenAI to generate a structured analysis (sentiment score, sentiment breakdown, themes, questions, feedback, insights, and summary). Builds an HTML email report from the structured results, sends it to the configured recipient with Gmail, and updates the Google Sheet row with the analysis fields; if no comments exist, marks the row as “No comments”. Setup Create or duplicate a Google Sheet with at least “Vi

by Dr. Firas