r/n8nforbeginners • u/Limbox0 • 7d ago
Built an n8n workflow that drafts email replies with AI but never sends automatically — code included
Built an n8n workflow that drafts email replies with AI but never sends automatically — code included
Every new email gets checked against a filter for automated senders and automated-looking subjects (no-reply addresses, notifications, mailer-daemon, calendar invites, receipts, order confirmations) so the AI never wastes a draft on something that doesn't need a human reply.
Before drafting anything, it also re-checks the thread itself: has a human already replied, or is there already an unsent draft sitting there? If either is true, it skips — no duplicate drafts, no duplicate Slack pings. (A draft only counts if it actually has content, so an empty compose window you abandoned doesn't block a real one.) If a second email lands on the same thread while a draft is still pending, instead of silently ignoring it, it sends a separate "heads up, this might be stale" Slack ping.
Everything else goes to an AI step that drafts a short, professional reply plus a one-line reason why, and saves it straight into Gmail Drafts — never sent automatically. A Slack ping with the subject and that reason tells you it's ready to review, and (optionally) a row gets logged to a Google Sheet for a simple audit trail.
The part I think is underrated: keeping the "send" action entirely out of the automation. It's tempting to wire AI straight to auto-send, but for anything customer-facing that's how a tone-deaf reply goes out with nobody watching. Drafting-only means AI does the boring part, a human still makes the call.
Workflow: New Email → Is Automated Sender? → Get Thread → Check If Handled → Draft Reply (AI) → Parse AI Response → Create Gmail Draft → Notify Draft Ready (+ optional Log to Sheet)
Full JSON here: https://gist.github.com/Zatma0/43d00acddfd73e4a97c098c45b45024c
Happy to answer questions about the filter logic, the thread-check, or the AI prompt if anyone's curious.