Auto Email Responder Bot Google Apps Script: Your Free, Effortless Customer Service Assistant
📌 TYPE: Free Tool / Script
💰 COST: 100% FREE
⏱️ SETUP TIME: Under 5 minutes
INTRO (≈100 words)
You keep juggling client queries, project updates, and time‑sensitive tasks. Every new email feels like a missed deadline because you’ve got to reply personally. A ready‑made Auto Email Responder Bot in Google Apps Script lets you send instant, personalized replies without lifting a finger. Whether you’re a solo freelancer handling a flood of support emails, a small online store juggling inquiries, or a developer building a service niche, this bot will free up hours of inbox time. Soon you’ll see less inbox clutter, happier contacts, and space to focus on growth.
WHY YOU NEED THIS (≈100 words)
In the real world, emails linger longer than answers for most small businesses. The cost of hot‑mailing stuck emails is lost opportunity—missed leads, delayed projects, and frustrated clients. The bot handles the boilerplate conversations: welcome messages, order confirmations, FAQ answers, and any “thank you” note. You’ll cut repeat response time from minutes to seconds. The automation also records timestamps in a sheet, giving you a simple audit trail of when you engaged each lead or client. Think of it as a 24/7 receptionist, all for free and under your control.
STEP BY STEP GUIDE (≈300 words)
1. Create the Google Sheet
Open a new sheet. In row 1, add the headers: `Subject`, `Body`, `Timestamp`. These will be used by the script to lookup responsive templates and log activity.
2. Open Apps Script
From the sheet, click *Extensions → Apps Script*. A new tab appears with an untitled project. Rename it “Email Responder Bot”.
3. Set up Properties
Go to *Project Settings → Script Properties*. Add two keys: `FEEDBACK_LABEL` (e.g., `Feedback`) and `RESPONDED_LABEL` (e.g., `Responded`). These labels will filter which emails need a reply.
4. Write the trigger
Back in the code editor, add a `time-driven` trigger: configure it to run every 5 minutes. The trigger calls `processInbox`.
5. Build the lookup
Inside `processInbox`, fetch unread threads that carry the `FEEDBACK_LABEL`. For each thread, pull the email's subject. Search the Sheet for a matching subject. If found, get the corresponding body and send a reply.
6. Log and label
After replying, open the sheet’s next empty row, write the subject, body, and current timestamp. Then apply the `RESPONDED_LABEL` to the thread, preventing duplicate answers.
7. Test
Send yourself a test email tagged with `Feedback`. Check the script, refresh the sheet, and confirm the bot responded. Adjust template specifics as needed.
The flow is linear: label → fetch → lookup → reply → log → label. The logic sits entirely in Apps Script, so you never manage a server or third‑party service.
THE CODE (≈200 words)
// Constants
const FEEDBACK_LABEL = 'Feedback';
const RESPONDED_LABEL = 'Responded';
const SHEET_ID = SpreadsheetApp.getActiveSpreadsheet().getId();
const LOG_SHEET_NAME = 'Log';
// Main entry
function processInbox() {
const inbox = GmailApp.getUserLabelByName(FEEDBACK_LABEL);
const threads = inbox.getThreads();
const sheet = SpreadsheetApp.openById(SHEET_ID).getSheetByName(LOG_SHEET_NAME);
const lastRow = sheet.getLastRow() + 1;
threads.forEach(thread => {
if (thread.getLabelIds().includes(GmailApp.getUserLabelByName(RESPONDED_LABEL).getId())) return;
const msg = thread.getMessages()[0];
const subject = msg.getSubject();
const body = getTemplate(subject);
if (body) {
msg.reply(body);
sheet.appendRow([subject, body, new Date()]);
thread.addLabel(GmailApp.getUserLabelByName(RESPONDED_LABEL));
}
});
}
function getTemplate(subject) {
const sheet = SpreadsheetApp.openById(SHEET_ID).getSheetByName(LOG_SHEET_NAME);
const data = sheet.getDataRange().getValues();
for (let i = 1; i < data.length; i++) {
if (data[i][0] === subject) return data[i][1];
}
return null;
}
const FEEDBACK_LABEL = 'Feedback';
const RESPONDED_LABEL = 'Responded';
const SHEET_ID = SpreadsheetApp.getActiveSpreadsheet().getId();
const LOG_SHEET_NAME = 'Log';
// Main entry
function processInbox() {
const inbox = GmailApp.getUserLabelByName(FEEDBACK_LABEL);
const threads = inbox.getThreads();
const sheet = SpreadsheetApp.openById(SHEET_ID).getSheetByName(LOG_SHEET_NAME);
const lastRow = sheet.getLastRow() + 1;
threads.forEach(thread => {
if (thread.getLabelIds().includes(GmailApp.getUserLabelByName(RESPONDED_LABEL).getId())) return;
const msg = thread.getMessages()[0];
const subject = msg.getSubject();
const body = getTemplate(subject);
if (body) {
msg.reply(body);
sheet.appendRow([subject, body, new Date()]);
thread.addLabel(GmailApp.getUserLabelByName(RESPONDED_LABEL));
}
});
}
function getTemplate(subject) {
const sheet = SpreadsheetApp.openById(SHEET_ID).getSheetByName(LOG_SHEET_NAME);
const data = sheet.getDataRange().getValues();
for (let i = 1; i < data.length; i++) {
if (data[i][0] === subject) return data[i][1];
}
return null;
}
Deploy the script, authorize permissions, and add a `time-driven` trigger that runs `processInbox` every 5 minutes. Your bot is now live.
HOW TO CUSTOMIZE (≈100 words)
Update the `FEEDBACK_LABEL` and `RESPONDED_LABEL` to match your workflow. In the Sheet, you can add more columns like `Category` or `Priority`; just modify `getTemplate` to table‑lookup extra data. If you want richer templates with placeholders, replace the static body strings with a simple `{{name}}` syntax and add code to replace them with the sender’s Gmail name before replying. For mass‑mail adaptation, insert `GmailApp.sendEmail(dest, subject, body)` instead of reply. Each extension keeps the core logic unchanged, so you can tweak you’re bot without touching the heart of the script.
COMMON ISSUES (≈50 words)
If replies don’t fire, check that your trigger has proper authorization and that the
💎 Want more? I have a Custom Bot Build with 50+ ready-to-use scripts starting at $197+.
But this free one above? It's genuinely complete on its own. No catch.
Comments
Post a Comment