Skip to main content

Command Palette

Search for a command to run...

Automate Your Email Workflow with n8n, Gmail, and Airtable

Updated
4 min read
Automate Your Email Workflow with n8n, Gmail, and Airtable
S
I mostly write on cloud, security data and AI.

Managing emails manually can be time-consuming and error-prone, especially when you’re tracking tasks, leads, or support tickets. Fortunately, with n8n, Gmail, and Airtable, you can create a powerful automation workflow to classify, store, and manage emails automatically. In this blog, we’ll walk you through a step-by-step setup.

Why Automate Your Email Workflow?

  • Save time: Automatically process incoming emails without manual copying or sorting.

  • Reduce errors: Avoid missing important emails or misplacing data.

  • Centralized data: Store all email information in Airtable for reporting, analysis, or task tracking.

  • Scalable: Add AI classification, notifications, or other integrations easily in the future.

Tools You’ll Need

  1. n8n – Workflow automation platform

  2. Gmail – Email source

  3. Airtable – Cloud-based database to store email records

Step 1: Prepare Your Airtable Base

  1. Create a new Workspace (optional) in Airtable.

  2. Create a Base called Email Automation.

  3. Create a Table named Email Logs with the following fields:

Field Type
Subject Single line text
Body Long text
Status Single select (e.g., New, Processed)
Date Date

Step 2: Generate Airtable API Token

  1. Go to Airtable tokens

  2. Click Create Token and name it n8n Integration

  3. Enable scopes: data.records:read and data.records:write and schema.bases:read

  4. Give access to the Email Automation base

  5. Copy the token — you’ll use it in n8n.

Step 3: Set Up n8n Workflow

3.1 Create a Workflow

  1. Login to n8n and click New Workflow

  2. Rename it: Email Automation Workflow

3.2 Add Gmail Trigger

  1. Click + and search for Gmail Trigger

  2. Connect your Gmail account with OAuth credentials

  3. Set trigger to Watch Emails (for example, unread emails in Inbox)

3.3 Optional: Add Email Classification (Code Node)

If you want to automatically classify emails:

  1. Add a Code Node after Gmail Trigger

  2. Use JavaScript to process \(json.subject or \)json.snippet

  3. // Loop over input items and classify job application emails
    
    for (const item of $input.all()) {
    
      const subject = (item.json.subject || "").toLowerCase();
      const body = (item.json.snippet || "").toLowerCase();
    
      let status = "unknown";
    
      if (
        subject.includes("thank you for applying") ||
        subject.includes("application received")
      ) {
        status = "applied";
      }
      else if (subject.includes("interview")) {
        status = "interview";
      }
      else if (
        subject.includes("unfortunately") ||
        subject.includes("not selected") ||
        subject.includes("rejected")
      ) {
        status = "rejected";
      }
      else if (subject.includes("offer")) {
        status = "offer";
      }
    
      item.json.status = status;
    
    }
    
    return $input.all();
    

3.4 Add Airtable Node

  1. Add Airtable Node and connect it to the Code Node (or Gmail Trigger if no classification)

  2. Set Resource: Record

  3. Set Operation: Create

  4. Add credentials (use API token created earlier)

  5. Enter Base ID and Table Name (Email Logs)

3.5 Map Fields to Airtable

Airtable Field Value
Subject {{$json.subject}}
Body {{$json.snippet}}
Status {{$json.status}}
Date {{ new Date(parseInt($json.internalDate, 10)).toISOString() }}

The internalDate field from Gmail is in milliseconds, so we convert it to ISO format using JavaScript.

Step 4: Test the Workflow

  1. Click Execute Workflow in n8n

  2. Send a test email to your Gmail account

  3. Check Airtable — a new record should appear automatically


Step 5: Activate Workflow

  1. Once tested, switch workflow from Inactive → Active

  2. From now on, emails arriving in Gmail will be automatically logged in Airtable


Bonus: Advanced Automation Ideas

  • AI Classification: Integrate OpenAI or GPT nodes to auto-categorize emails

  • Slack Notifications: Notify your team when a new email is added

  • Follow-Up Automation: Trigger reminders based on email status

Benefits of This Workflow

  • No manual data entry

  • Automatic logging and classification

  • Centralized view of all incoming emails

  • Easily extensible for complex automations

Conclusion

By combining n8n, Gmail, and Airtable, you can turn your inbox into a smart, automated email tracking system. Whether for support tickets, client emails, or internal requests, this workflow saves time, reduces errors, and keeps your data organized.

💡 Tip: Keep updating the workflow and fields in Airtable as your needs evolve. You can also extend it with AI, notifications, and other integrations to build a fully automated communication hub.