n8n

How to Automate Gmail Reply Drafts for Inbox Triage?

Email piles up fast. This setup watches your Gmail and prepares draft replies for messages that actually need a response. It helps busy pros and teams cut down on inbox time while keeping control over what gets sent.

Here is how it works. Gmail is checked every minute and ignores emails you sent yourself using a simple filter. An AI judge reads the subject and HTML body and returns a JSON flag called needsReply, while skipping marketing emails. If the flag is true, a second AI writes a clear reply using the original subject and body as context. The reply is saved as a draft in the same thread with a Re subject and HTML formatting for line breaks.

You only need a Gmail account and an OpenAI API key to run it in n8n Cloud. Expect to cut manual drafting time and answer more messages with less effort. It fits personal inbox management, client follow ups, partner messages, and vendor coordination, where a safe draft is better than auto send.

What are the key features?

  • Gmail polling every minute with a filter that ignores emails sent by you
  • AI decision step that returns a simple needsReply true or false flag
  • Strict JSON parsing to validate the AI output before routing
  • If condition routes only messages that need attention
  • Dedicated AI writer crafts a reply using the subject and HTML body
  • Creates a Gmail draft reply in the same thread with a Re subject
  • Formats line breaks as HTML for clean and readable emails

What are the benefits?

  • Reduce manual email drafting time by up to 70 percent
  • Cut response delays from hours to minutes with ready to send drafts
  • Skip marketing emails automatically to focus on real conversations
  • Keep replies in the same thread for clean context and history
  • Handle 3x more inbound messages without extra staff

How do you set it up?

  1. Import the template into n8n: Create a new workflow in n8n > Click the three dots menu > Select 'Import from File' > Choose the downloaded JSON file.
  2. You'll need accounts with Gmail and OpenAI. See the Tools Required section above for links to create accounts with these services.
  3. Open the Gmail Trigger node and connect your Gmail account. In the credential dropdown, click Create new credential and follow the on screen steps to grant access.
  4. Confirm the Gmail Trigger query is set to -from:me and that the poll interval is every minute. Save the node.
  5. Open the Assess if message needs a reply node and ensure the instruction mentions that marketing emails do not require a response. Leave the subject and message variables as provided.
  6. Open the OpenAI Chat node used by the assessor. In the credential dropdown, click Create new credential, paste your OpenAI API key from your OpenAI account API page, and save.
  7. Open the JSON Parser node and confirm the schema includes a boolean field named needsReply and that it is required.
  8. Open the If Needs Reply node and verify it checks the parsed needsReply field for true.
  9. Open the OpenAI Chat Model node for drafting replies. Create or select your OpenAI credential and keep the default model. Adjust temperature only if you want more creative replies.
  10. Open the Generate email reply node and keep the prompt and variables for subject and message. This ensures the draft uses the original email context.
  11. Open the Gmail Create Draft node, select your Gmail credential, and confirm the subject is Re: {{ original subject }}, sendTo uses the sender from the trigger, and threadId matches the original thread.
  12. Run a test by sending an email to the connected Gmail from another address. Wait for up to one minute, then check Gmail Drafts for a reply in the same thread.
  13. Send a marketing newsletter to the inbox and confirm no draft is created. If drafts fail, check OpenAI usage limits and Gmail credential status. If JSON parsing errors appear, review the assessor prompt and schema.

Tools Required

$24 / mo or $20 / mo billed annually to use n8n in the cloud. However, the local or self-hosted n8n Community Edition is free.

Gmail

Sign up

No cost: Personal Gmail (Gmail API has no usage-based pricing; quotas apply)

OpenAI

Sign up

Pay-as-you-go: GPT-5 at $1.25 per 1M input tokens and $10 per 1M output tokens

Similar Templates

Join Futurise to access 1,200+ automation templates

Get instant access to ready-made automation workflows for n8n, Make.com, AI agents, and more. Download, customise, and deploy in minutes.