Gmail AI Auto-Responder: Draft Replies for Incoming Emails

n8n Email Productivity AI

Contributed by Sabrina Ramonov 🍄. From the community directory at agents.sabrina.dev, republished with permission and full credit.

This workflow automatically generates draft replies in Gmail.

It's designed for anyone who manages a high volume of emails or often faces writer's block when crafting responses.

Since it doesn't send the generated message directly, you're still in charge of editing and approving emails before they go out.

How It Works:

- Email Trigger: activates when new emails reach the Gmail inbox

- Assessment: uses OpenAI GPT-4 and a JSON parser to determine if a response is necessary

- Reply Generation: crafts a reply with OpenAI GPT-4 Turbo

- Draft Integration: after converting the text to HTML, it places the draft into the Gmail thread as a reply to the first message

Set Up Overview (~10 minutes):

1. OAuth Configuration:

- Setup Google OAuth in Google Cloud console.

- Make sure to add Gmail API with the modify scope.

- Add Google OAuth credentials in n8n.

- Make sure to add the n8n redirect URI to the Google Cloud Console consent screen settings.

2. OpenAI Configuration:

- Add OpenAI API Key in the credentials.

3. Tweaking the prompt:

- Edit the system prompt in the "Generate email reply" node to suit your needs.

Reach out to me here if you need help building automations for your business.

Tools used: OpenAI ChatGPT, Gmail

Download the workflow template (JSON)

Original tutorial

Want this running in your business? KOBA42 builds and operates automations like this one.