What this workflow does
This workflow automatically answers email messages from selected senders using Gmail, OpenAI, and Google Sheets.
It reduces time spent writing replies and keeps a clear record of all messages.
Replies include a feedback link so users can rate AI answers.
Feedback updates a Google Sheet to track response quality over time.
This helps support teams reply faster and improve their responses based on real user input.
Who should use this workflow
This workflow suits anyone who gets many emails needing quick personal replies.
It is made for people using Gmail and who want to add AI-generated answers plus track reply quality.
It is helpful for small support teams or startups wanting to save hours on routine email answers.
Tools and services used
- Gmail: To watch incoming messages and send replies.
- OpenAI GPT: To create personalized replies based on email content.
- Google Sheets: To store emails, replies, and user feedback.
- n8n platform: To connect all services and automate the workflow.
These tools need proper API keys and OAuth2 credentials configured in the workflow.
Inputs, Processing Steps, and Outputs
Inputs
- New email messages received in Gmail from specific addresses.
- User feedback clicks sent through a webhook when people rate AI-generated answers.
Processing Steps
- Trigger watches for emails in Gmail.
- Filter by sender address to only handle desired emails.
- Use a Code node to extract the main new reply text, removing quoted messages and signatures for clarity.
- Check the length of extracted text to fit OpenAI token limits.
- Send the clean message text to OpenAI to generate a polite, relevant reply.
- Format the AI reply with an email template including feedback question and links.
- Send the generated reply back as an email via Gmail, maintaining the original thread.
- Create a unique ID per email using the Crypto node to track interactions.
- Prepare and save the original message, AI reply, and empty feedback field into a Google Sheet row.
- Manage Google Sheets setup by creating new sheets or worksheets if missing, storing their IDs internally.
- Capture user feedback via the Webhook node, updating the corresponding Google Sheet row.
- Confirm feedback submission to users with a web response.
Outputs
- Automatic AI-generated email replies to selected users.
- Organized Google Sheet with messages, replies, and feedback status.
- Continuous feedback data for improving future AI responses.
- User confirmation pages after feedback submission.
Beginner step-by-step: How to build this in n8n
Importing the workflow
- Download the workflow file using the Download button on this page.
- Inside the n8n editor, click on “Import from File” and select the downloaded file.
Setting up credentials
- Go to each node that uses APIs: Gmail Trigger, Gmail send node, OpenAI node, and Google Sheets node.
- Add or link your Gmail OAuth2 credentials.
- Add your OpenAI API key in the OpenAI node.
- Connect Google Sheets OAuth2 credentials.
Configuration updates
- Open the Set node named “Configure”.
Update the list of sender emails you want to auto-reply to. - Check or modify the Google Sheets spreadsheet and worksheet IDs if you want to use an existing sheet.
- Adjust token sizes if desired, but the default works for normal email responses.
- Review the email template in the HTML node to ensure the feedback link points to the workflow webhook URL.
Testing and activating
- Send a test email from a configured sender address.
- Watch the workflow run and ensure the reply is sent and saved.
- Click the feedback link to test feedback flow.
- When tests pass, activate the workflow toggle in n8n for production use.
For hosting on your own server, see self-host n8n options.
Customization ideas
- Change recipient emails in the Configure node to add or remove auto-reply targets.
- Modify token length for AI responses to get shorter or longer replies.
- Edit the Google Sheets columns and keys to save extra details like timestamps or sentiment.
- Adjust the feedback question or add more options in the email template HTML.
- Add new triggers or integrate other apps if more interaction points are needed.
Edge cases and failures
Error: “Resource not found” in Google Sheets node usually means the spreadsheet or worksheet was deleted or the ID is wrong.
Fix: Remove deleted sheets from trash or update IDs stored in workflow static data.
Error: OpenAI replies cut off early means token size is too low.
Fix: Raise the replyTokenSize value in the Configure node.
Error: Replies not sending means Gmail credentials or message ID are missing or incorrect.
Fix: Double-check Gmail OAuth2 credentials and ensure messageId is linked from the email trigger.
Summary of results
✓ Faster email replies automatically sent.
✓ Clear records of conversations are kept.
✓ Users give feedback to improve AI answers.
✓ Fewer manual email tasks and better tracking.
✓ Suitable for support teams using Gmail.
