Stepthrough Start free

n8n AI Email Responder: Draft Gmail Replies Automatically

Practice it step by step

Start the free practice

Take the free module: why it matters, practice and a quick check →

You do every step yourself in a practice copy of n8n. It checks your work as you go, and “Do it for me” finishes any step you get stuck on. Free, about 12 minutes, and nothing touches your real accounts. Open full screen

Free · Live nowBusiness Automationsn8nGmailOpenAI~12 min68 stepsIntermediate

Updated . Built against the tool’s current screens and checked step by step. How we check this lesson

Answering the same customer questions all day eats your time. In this free AI email responder tutorial you build an n8n agent that checks Gmail every minute, reads each new email and writes a reply as a draft in the same thread. It never sends anything, so you stay in control.

At a glance

QuestionAnswer
What you buildBuild an n8n agent that watches your Gmail, reads each new customer email, and writes a reply as a draft in the same thread, ready for you to check and send.
Toolsn8n
TimeAbout 12 minutes, 68 steps in 11 parts
LevelIntermediate
CostFree
Ways to learn itPractice it step by step

The 11 parts, in short

  1. The email: Look at the inbox, Open the email, Back to n8n.
  2. Gmail trigger: Create a workflow, Add the trigger, Search for Gmail, Gmail, and 1 more step.
  3. Connect Gmail: Credential, New credential, Sign in with Google, Pick the inbox, and 2 more steps.
  4. Gmail trigger: Close the node.
  5. AI Agent: Add the next step, Search for the agent, AI Agent, Change the prompt source, and 4 more steps.
  6. Chat model: Add the model, Search for OpenAI, OpenAI Chat Model, Credential, and 2 more steps.
  7. Draft tool: Add a tool, Search for Gmail, Gmail Tool, Credential, and 15 more steps.
  8. Memory: Add memory, Simple Memory, Close the node.
  9. Instructions: Open the agent, Add an option, System Message, Give it the facts, and 1 more step.
  10. Test and fix: Test it, Open the memory, Find the problem, Define below, and 4 more steps.
  11. Check the draft: Check Gmail, Read the draft, then go back, Turn it on, Publish it.

Start here first: AI Receipt Extractor: Receipts to Google Sheets with n8n (module 1 of Business Automations)

In the course: Part 9 · n8n Automation Toolkit (Module 76 of the full course)

Part of: Email on Autopilot (step 9 of 17). Next up: n8n: Weekly Client Status Emails from a Google Sheet, Written by AI

Part of: Business Automations with n8n (step 4 of 22). Next up: n8n: Turn Meeting Notes into Action Items in a Google Sheet

Part of: n8n Intermediate: Real Business Workflows (step 11 of 17). Next up: n8n: Weekly Client Status Emails from a Google Sheet, Written by AI

Watch the 30-second version

3 short videos from this lesson. Watch, then do it yourself in the free practice copy.

The error everyone gets (video)0:18

The error everyone gets

Short with Robert · 0:18

You built your first AI agent, you click run, and it's red: "No session ID found." Don't panic, everybody gets this one. The memory wants a chat ID and an email doesn't have one, so give it the email's thread ID.

Myth: AI emails customers on its own (video)0:19

Myth: AI emails customers on its own

Short with Robert · 0:19

Myth: an AI agent will email your customers without asking you. Fact: only if you set it up that way. In our lesson the Gmail tool says Send, and we change it to Draft. Now the worst it can do is write a draft you…

Transcript

Myth: an AI agent will email your customers without asking you. Fact: only if you set it up that way. In our lesson the Gmail tool says Send, and we change it to Draft. Now the worst it can do is write a draft you never send.

Same email, 20 times a day? (video)0:14

Same email, 20 times a day?

Short with Robert · 0:14

Answering the same email 20 times a day? An AI reads the email and drafts the reply from your info. You read the draft and hit send. You're still in charge, not the AI.

Customer email to Greenline Pest Control asking if they cover Maple Grove for ants in the kitchen
Customer email to Greenline Pest Control asking if they cover Maple Grove for ants in the kitchen

What you will build

You play the office at Greenline Pest Control, a family-run company. A customer, Dana, writes in: ants in the kitchen, does Greenline cover Maple Grove, and roughly what does a treatment cost? You build a workflow that answers emails like hers automatically.

A Gmail Trigger watches the inbox. An AI Agent reads the sender, subject and message. It knows Greenline's real service areas (Maple Grove, Cedar Falls and Brookside), prices ($149 for a first general pest visit, $89 for a follow-up) and booking hours, and it uses a Gmail tool to save a reply as a draft right under the customer's email. At the end, Dana's draft says yes to Maple Grove, gives the right price and asks for her address and two times that work.

Who this is for

This module is for service businesses that get the same questions every day: pest control, cleaning, landscaping, home repair, salons and more. If your inbox is full of "do you cover my area?" and "how much does it cost?", this is built for you. To run the model you need either n8n's free credits or an OpenAI key; the n8n AI agent lesson shows how to make a key.

It is also a good fit if you are nervous about letting AI talk to customers. Nothing leaves your inbox without you. The agent does the first draft, and you keep the final say on every reply.

What you need before you build it for real

Four things, all free to start. 1) An n8n account: n8n Cloud has a free trial, so sign up at n8n.io. 2) The Gmail inbox customers write to, because n8n asks you to sign in with Google and allow access. 3) A model to power the agent. New n8n accounts come with free credits: in the OpenAI Chat Model node, open the Credential list and pick Gateway credits. If you would rather use your own OpenAI key, the free n8n AI agent lesson walks through making one, step by step. 4) A test email. Send yourself a message from a different address, such as a second Gmail, so the Gmail Trigger has something to fetch.

The practice copy here needs none of this. Do it here first, then repeat the same clicks in your own n8n.

The error you fix, and why it matters

The first test fails on purpose. Simple Memory expects a chat session ID, and an email is not a chat, so there is nothing to tell conversations apart. Many people fix this by deleting the memory node. The lesson shows a better fix: define the session key yourself using the thread ID. Every email conversation has its own thread, so memory now keeps one conversation per customer. Seeing a real error and reading what it means is one of the most useful skills in n8n.

Why drafts, not sent emails

Setting the Gmail tool to Draft means the worst the agent can do is write something you never send. That makes it safe to switch on for a real business on day one. The system message adds a second guard: if the agent does not know something, it says someone from the team will follow up, instead of guessing a price or date. Plain text is used on purpose too, because it reads more like a person than a formatted template.

How to use this in your business

Swap Greenline's facts for yours: your towns, your prices, your hours and how customers book. Keep the rules section as it is. Each morning you open Gmail and find replies already written under each new question. Read, tweak if needed, and send. Most replies take seconds instead of minutes, and customers hear back faster.

Keep the "What you know" list honest and current. When a price changes or you add a town, update the system message and every future draft follows. If you notice the agent handing off the same question again and again, that is a sign to add the answer to its facts.

How the practice works

Each step is shown on the left under Watch, then you do it on the right under Your turn, in practice copies of n8n and Gmail. Every click is checked, and Do it for me finishes a step if you get stuck. No Gmail account is connected and no email is read or sent.

Try it yourself, free

Reading the steps is a start. Doing them is how it sticks. The interactive module walks you through every click in a practice copy of n8n, checks each step, and never touches your real accounts.

Start “n8n AI Email Responder: Draft Gmail Replies Automatically”

Step by step: n8n AI Email Responder: Draft Gmail Replies Automatically

All 68 steps of the interactive module, in order. In the module you watch each one, then do it yourself in a practice copy that checks your work.

1. The email

  1. Look at the inbox. You're the office at Greenline Pest Control. Switch to the Gmail tab.

    In this module you're the office at Greenline Pest Control, and customers email the same questions all day. Do you cover my area? What does it cost? Let's build an agent that writes those replies for you. First, look at the inbox. Switch to the Gmail tab.

  2. Open the email. Open Dana's email.

    There's a new one from Dana.

  3. Back to n8n. Ants, an area and a price question. Switch back to n8n.

    Ants in the kitchen, is Maple Grove covered, and roughly what does it cost. A person could answer that in two minutes. The agent will do it in seconds. Back to the n8n tab.

2. Gmail trigger

  1. Create a workflow. Click Create workflow.
  2. Add the trigger. Click Add first step.

    Every workflow starts with a trigger, the event that kicks everything off. Here, that's a new email arriving.

  3. Search for Gmail. Type gmail.
  4. Gmail. Click Gmail.
  5. On message received. Under Triggers, click On message received.

    Under triggers, click on message received. That adds the Gmail trigger.

3. Connect Gmail

  1. Credential. Open the Credential dropdown.

    n8n needs permission to read the inbox.

  2. New credential. Click Create new credential.

    Create new credential.

  3. Sign in with Google. Click Sign in with Google.

    Leave it on managed OAuth and click sign in with Google.

  4. Pick the inbox. Pick the business inbox, office@greenlinepest.com.

    Pick the inbox customers write to. For Greenline, that is the office account.

  5. Allow access. Click Continue.

    Google spells out what n8n can do with your mail. That list sounds big. What actually happens is decided by the nodes you add, and ours will only read and write drafts.

  6. Fetch a test email. Leave Every Minute and Message Received as they are. Click Fetch Test Event. In your own Gmail, first send yourself a test email from a different address.

    Look at the settings. It checks every minute, and it fires on message received. Both are what we want. n8n grabs the newest email so we can see what it looks like. In your own Gmail, send yourself a test email from a different address first, so there is something to fetch.

4. Gmail trigger

  1. Close the node. There's Dana's email as data: From, Subject, snippet and a threadId. Close the node.

    There's Dana's email, broken into fields. From, subject, a snippet of the message, and a thread I D. Think of it as one row in a spreadsheet. We'll use these fields next. Close it.

5. AI Agent

  1. Add the next step. Click the + after the Gmail Trigger.

    Now, what should happen with that email.

  2. Search for the agent. Type agent.
  3. AI Agent. Click AI Agent.

    AI Agent.

  4. Change the prompt source. Open Source for Prompt.

    This is the part people miss. By default the agent expects a chat message, but our input is an email.

  5. Define below. Choose Define below.

    Define below. Now we write the prompt ourselves.

  6. Switch to Expression. Above the Prompt (User Message) box, click Expression. Pasted {{ }} only works in Expression mode.

    One small switch first. Above the prompt box it says fixed and expression. If you skip this, n8n treats the curly brackets as plain text and the agent never sees the email.

  7. Write the prompt. Click in the box and paste the prompt. The parts in {{ }} pull in fields from the email.

    It tells the agent to write a reply and save it as a draft in the same thread. The bits in double curly brackets are expressions. Each one pulls in a field from the email. Who it's from, the subject, and the message. On the left you can see those same fields from the test email.

    Write a reply to this email, then save it as a draft in the same thread.
    <email>
    From: {{ $json.From }}
    Subject: {{ $json.Subject }}
    Message: {{ $json.snippet }}
    </email>
  8. Close the node. We'll add the business details later. Close the agent.

    The agent knows what to do with each email. It doesn't know anything about the business yet. We'll come back for that. Close it.

6. Chat model

  1. Add the model. Click the + under Chat Model.

    Give it a brain.

  2. Search for OpenAI. Type openai.
  3. OpenAI Chat Model. Click OpenAI Chat Model.

    OpenAI chat model.

  4. Credential. Open the Credential dropdown.
  5. Reuse your OpenAI key. Choose OpenAI account, your OpenAI key. No key yet? Pick Gateway credits instead. n8n gives every new account free credits, and that is plenty for this.

    Pick OpenAI account, the key you made for n8n. If you have no key yet, pick gateway credits instead. n8n gives every new account free credits, and a few test emails cost almost nothing. The default model is fine. Writing a short email is an easy job.

  6. Close the node. Close the model.

    Close it.

7. Draft tool

  1. Add a tool. Click the + under Tool.

    Now the tool that lets the agent act on its answer.

  2. Search for Gmail. Type gmail.
  3. Gmail Tool. Click Gmail Tool.

    Gmail tool.

  4. Credential. Open the Credential dropdown.
  5. Same Gmail account. Choose Gmail account, the one you just connected.

    Pick Gmail account. It's the one you just connected for the trigger. No need to sign in again.

  6. Resource. Open the Resource dropdown. It says Message.

    Careful here. It's set to message, and the operation is send. We do not want an agent sending emails on its own.

  7. Draft. Choose Draft. Operation switches to Create.

    Draft. The operation switches to create. So the worst this agent can do is write a draft you never send.

  8. Subject: Expression. Point at Subject and click Expression above the box.

    Next, the subject. It will use a field from the email, so point at subject and click expression first.

  9. Keep the subject. Click in Subject and paste Re: {{ $json.Subject }}.

    Subject. A reply keeps the original subject with R E in front, or Gmail may not keep it in the same conversation. It's R E, then the subject from the email.

  10. Let the model write the message. Next to Message, click the ✦ button.

    The message is the part we can't know ahead of time. The agent writes it. Email type stays on text, because plain text reads more like a person than fancy formatting.

  11. Add an option. Click Add option.

    One more thing, and it's important. Without it, the draft lands as a brand new email instead of a reply.

  12. Thread ID. Choose Thread ID.

    Thread I D.

  13. Thread ID: Expression. Point at Thread ID and click Expression.

    Same trick. Point at thread I D and click expression.

  14. Point it at the thread. Click in Thread ID and paste {{ $json.threadId }}.

    It's the thread I D from the Gmail trigger, so the draft sits right under Dana's email, as a reply.

  15. One more option. Click Add option again.

    One more. The thread I D puts the draft in the right conversation, but it doesn't fill in who it goes to. Without a recipient, you couldn't just hit send.

  16. To Email. Choose To Email.

    To email.

  17. To Email: Expression. Point at To Email and click Expression.
  18. Reply to the sender. Click in To Email and paste {{ $json.From }}.

    It's the from field of the email, so the reply goes back to whoever wrote in.

  19. Close the node. Close the tool.

    Tool's done. Close it.

8. Memory

  1. Add memory. Click the + under Memory.

    Last part: memory. If Dana writes back, the agent should remember what it already told her.

  2. Simple Memory. Click Simple Memory.

    Simple memory.

  3. Close the node. Leave the defaults for now. Close it.

    Leave the defaults for now and close it. Keep an eye on this one.

9. Instructions

  1. Open the agent. Double-click AI Agent.

    Now the business details. Without them the agent will guess prices, and that's how you end up promising something you don't do. Double click the AI agent.

  2. Add an option. Click Add Option.

    Add option.

  3. System Message. Choose System Message.

    System message.

  4. Give it the facts. It starts with You are a helpful assistant. Click in the box, select all of it, and paste the system message over it: role, what it knows, rules, and style.

    It already says, you are a helpful assistant. It has four parts. The role. What it knows, meaning the service areas, prices and hours. The rules: it can only make drafts, and if it doesn't know something it says someone will follow up, never makes it up. And the style: friendly, short, plain text. Swap in your own details and this works for any business.

    Who you are:
    You write email replies for Greenline Pest Control, a family-run pest control company.
    
    What you know:
    - We service Maple Grove, Cedar Falls and Brookside.
    - General pest treatment (ants, spiders, roaches): $149 for the first visit, $89 for a follow-up.
    - We book Monday to Saturday, 8am to 5pm.
    - To book, the customer replies with their address and two times that work.
    
    Rules:
    You cannot send email. You can only create drafts.
    If you don't know something, say someone from the team will follow up. Never make up prices, dates or services.
    
    How to write:
    Friendly, plain and short. Plain text, not HTML. Sign off as "The Greenline team".
  5. Close the node. Close the agent.

    That's everything. Close it.

10. Test and fix

  1. Test it. Click the orange Execute button at the bottom of the canvas.

    Time to test. It runs on Dana's email.

  2. Open the memory. It failed: No session ID found in Simple Memory. Double-click the red Simple Memory node.

    Red. Error in sub-node simple memory, no session I D found. Don't worry, this happens to everyone the first time. Double click the red memory node and let's see why.

  3. Find the problem. It's looking for a chat session ID, and emails don't have one. Open Session ID.

    Here's the problem. Memory is looking for a chat session I D, and it comes back undefined, because an email is not a chat. It needs something else to tell conversations apart.

  4. Define below. Choose Define below.

    Define below.

  5. Key: Expression. A new Key box appears. Point at it and click Expression.

    A key box appears. Point at it and click expression.

  6. Use the thread. Click in Key and paste {{ $json.threadId }}.

    Every email conversation has its own thread, so now memory keeps one conversation per customer. That's actually better than just deleting the memory, which is the quick fix you'll see a lot of people use.

  7. Close the node. Close it.
  8. Test again. Click Execute again.

11. Check the draft

  1. Check Gmail. Everything is green. Switch to the Gmail tab.

    All green. Switch to Gmail and see what it wrote.

  2. Read the draft, then go back. The draft sits under Dana's email. Right area, right prices, not sent. Switch back to n8n.

    There it is, a draft, right under Dana's email. Yes to Maple Grove, a hundred forty nine for the first visit, and it asks for her address and two times, exactly like we told it. And it has not been sent. You read it, then you hit send. Now go back to n8n.

  3. Turn it on. Click Publish.

    Last step. Right now it only runs when you press execute.

  4. Publish it. Leave the version name as it is. Click Publish.

    n8n asks for a version name. The default is fine. Every new email gets a draft waiting for you.

More videos from this lesson

AI Email Responder with n8n: the 1-minute version (video)1:06

AI Email Responder with n8n: the 1-minute version

Highlight · 1:06 · with captions

Build an n8n agent that watches your Gmail, reads each new customer email, and writes a reply as a draft in the same thread, ready for you to check and send. Try it free, one click at a time: https://learn.ynteractive.com/modules/email-responder More free AI automation walkthroughs: https://learn.ynteractive.com

AI Email Responder in n8n, step by step (video)0:42

AI Email Responder in n8n, step by step

Short · 0:42 · with captions

Build an n8n agent that watches Gmail, reads each new customer email, and writes a reply as a draft in the same thread, ready for you to check and send. Build it yourself, free, one click at a time: learn.ynteractive.com

Make AI drafts land in the right thread (video)0:39

Make AI drafts land in the right thread

Short · 0:39 · with captions

Build an n8n agent that watches Gmail, reads each new customer email, and writes a reply as a draft in the same thread, ready for you to check and send. Build it yourself, free, one click at a time: learn.ynteractive.com

n8n AI Agent: Stop your AI from guessing prices (video)0:35

n8n AI Agent: Stop your AI from guessing prices

Short · 0:35 · with captions

n8n AI Agent tip: Stop your AI from guessing prices Build an n8n agent that watches Gmail, reads each new customer email, and writes a reply as a draft in the same thread, ready for you to check and send. Build it yourself, free, one click at a time: learn.ynteractive.com

All free Stepthrough videos

Screenshots

Frequently asked questions

Will the AI send emails without my approval?
No. The Gmail tool is set to create drafts only, and the system message says it cannot send email. You read each draft and send it yourself.
Is this course really free?
Yes. Stepthrough is completely free, and the practice copy needs no accounts. To build it for real you need your own n8n, OpenAI and Google accounts, and some of those cost money once you use them for real work.
How do I fix "No session ID found" in n8n Simple Memory?
Open the Simple Memory node, set Session ID to Define below, and use an expression that is unique per conversation. For email, the lesson uses the Gmail thread ID.
How does the draft end up in the same email thread?
The Gmail tool's Thread ID option is set to the threadId from the Gmail Trigger, so the draft is saved as a reply in that conversation.
Do I need an OpenAI account for this?
Not necessarily. New n8n accounts include free model credits: in the OpenAI Chat Model node choose Gateway credits in the Credential list. You can also create your own OpenAI key, which the n8n AI agent lesson shows step by step.
How often does it check for new email?
The Gmail Trigger in the lesson polls every minute once the workflow is published.
Can it draft replies to unanswered email threads already in my inbox?
The lesson's workflow drafts a reply to each new email as it arrives, in the same thread. To catch threads that are already waiting, a variation not covered in the lesson: swap the Gmail Trigger for a Schedule Trigger and a Gmail step that gets many messages with a search such as in:inbox is:unread, then send each one to the same agent. Gmail has no search for "unanswered", so check the list before you rely on it.

Start this module free

More in Business Automations

All 34 modules in Business Automations

More n8n tutorials

n8n AI Agent Tutorial: Save Social Media Ideas to Google Sheets: a step from the interactive modulen8n AI Agent Tutorial: Save Social Media Ideas to Google Sheets

Build an AI agent for BrightPath Marketing that generates social media post ideas and saves them to Google Sheets — chat trigger, AI Agent, system prompt, model…

Free · Live ~12 min Intermediate

Lovable + n8n: Build a Web App with an AI Backend: a step from the interactive moduleLovable + n8n: Build a Web App with an AI Backend

Build a contact form in Lovable and connect it to an n8n workflow — webhook trigger, AI Agent, Google Sheets, Gmail, and a Respond node that ties it all together.

Free · Live ~15 min Advanced

Build an AI Follow-Up Agent for HVAC Service Calls: a step from the interactive moduleBuild an AI Follow-Up Agent for HVAC Service Calls

Build an AI agent for Cedar Ridge Heating & Air that writes follow-up messages for completed service calls and saves them to Google Sheets — chat trigger, AI Agent…

Free · Live ~12 min Intermediate

Build an AI Service Request Form for Your HVAC Company: a step from the interactive moduleBuild an AI Service Request Form for Your HVAC Company

Build a service request form in Lovable for Cedar Ridge Heating & Air and connect it to n8n — the AI agent sorts each job into repair, maintenance, install or…

Free · Live ~15 min Advanced

Build an AI Job Follow-Up Agent for Electricians: a step from the interactive moduleBuild an AI Job Follow-Up Agent for Electricians

Build an AI agent for Oak & Wire Electric that writes follow-up messages after completed jobs and tracks them in Google Sheets — chat trigger, AI Agent, system prompt…

Free · Live ~12 min Intermediate

Build an AI Quote Request Form for Electrical Contractors: a step from the interactive moduleBuild an AI Quote Request Form for Electrical Contractors

Build a quote request form in Lovable and connect it to an n8n workflow — webhook trigger, an AI Agent that drafts an initial estimate note, Google Sheets, Gmail, and a…

Free · Live ~15 min Advanced

From the blog

All blog posts

Visual guides

This lesson’s key ideas as quick visual guides: swipe through the slides, or read the same guide as text.

All visual guides

Free cheat sheets

Print it or save the PDF: the key steps and checks from this lesson on one page, free.

All free printable cheat sheets

Plain-English definitions, each with an example from a free lesson.

The full AI glossary

  • AI agent system message prompt: An AI agent prompt template for the n8n System Message: who the agent is, what it knows, its rules and how it writes, plus a…
  • Daily priorities plan prompt: Paste your to-do list and fixed times and get a realistic plan for today: top three, time blocks, a buffer, and what to move to…
  • "Do you service my area?" reply prompt: Answer "do you cover my town?" from your real service area list: a clear yes with how to book, a kind no, or a request for the…
  • FAQ from customer emails prompt: Turn a batch of customer emails into an FAQ: the questions people really ask, in their words, answered only from your facts…

All free prompt templates

More terms on this topic

AI email assistantCron expressionHTTP status codeJailbreakModel routerNatural language processing (NLP)Rate limitService area

More prompts on this topic

  • Declined card notice prompt: Tell a customer their card was declined without embarrassing them: what failed, the amount, a safe way to update it and what…
  • FAQ-based customer reply prompt: A copy-ready prompt that answers a customer question using only your FAQ text, so ChatGPT cannot invent policies. Includes a…
  • "How much does it cost?" reply prompt: Answer a price question using only your published prices: what the first visit costs, what it includes, what changes the price…
  • Job post prompt: A four-part ChatGPT prompt for a job ad people want to read: real pay and schedule, must-haves kept apart from nice-to-haves…
  • Technician on the way text prompt: Write the "your tech is on the way" text: who's coming, the arrival estimate dispatch gave you, what to have ready, and how to…
  • Upsell offer email prompt: Offer an existing customer one related service that fits what they bought or told you, with your real price, the reason it fits…

Browse related tutorials