Automate Email Categorization & AI Scheduling with n8n

Struggling to manage incoming emails and schedule appointments efficiently? This n8n workflow automates email categorization with AI and offers a smart appointment booking assistant using Google Calendar integration, saving you hours of manual work.
Slack
gmail
@lmChatOpenAi
+15
Workflow Identifier: 1202
NODES in Use: Slack, Sticky Note, Execute JavaScript, @textSplitterRecursiveCharacterTextSplitter, @embeddingsOpenAi, @documentDefaultDataLoader, @lmChatOpenAi, @retrieverVectorStore, HTTP Request, @vectorStorePinecone, @chainRetrievalQa, @lmChatAnthropic, @toolHttpRequest, @agent, @memoryBufferWindow, gmail, @chatTrigger, if
Automate email categorization with n8n and Gmail

Press CTRL+F5 if the workflow didn't load.

Learn how to Build this Workflow with AI:

What this workflow does

This workflow watches new emails in your Gmail inbox and sorts them into categories like “automation” or “music” using AI.

It also sends Slack messages to notify your team about new emails.

You can chat with a chatbot to book meetings using Google Calendar, checking availability before scheduling.

The goal is to save time by automating email sorting and appointment booking without manual work.


Who should use this workflow

Anyone who gets many emails and loses time sorting them or scheduling meetings manually.

It is good for project managers, teams using Gmail, Slack, and Google Calendar, and people wanting easy automated scheduling.


Tools and services used

  • Gmail: To monitor inbox and apply labels to emails.
  • OpenAI GPT-4: To read emails and decide their category.
  • Slack: To send messages when new emails are sorted.
  • Google Calendar API: To check free times and book meetings.
  • n8n platform: To run and connect all the nodes for automation.
  • Pinecone vector store: To store information for chatbot answers.
  • LangChain nodes: For AI chat, classification, and memory.

Inputs, process, and outputs

Inputs

Processing steps

  • Use Gmail trigger to detect new emails
  • Send email text to AI text classifier to decide category
  • Apply correct Gmail label for “automation” or “music” categories
  • Send Slack message with email details
  • Accept chat input via chat trigger to start appointment booking
  • Use question-answer chain with Pinecone embeddings for chatbot answers
  • Download and split PDF documents to create embeddings to support chatbot
  • Use Google Calendar to check availability and book 30-minute meetings
  • Store chat conversation context to remember past messages

Outputs

  • Emails automatically labeled in Gmail
  • Slack notifications post for new emails by category
  • Chatbot messages that guide users to book appointments
  • Calendar events created if meeting slots are found free

Beginner step-by-step: How to use this workflow in n8n

Step 1: Import the workflow

  1. Download the workflow file using the Download button on this page.
  2. In the n8n editor, select “Import from File” and choose the downloaded file.

Step 2: Configure credentials and settings

  1. Go through each node and add required API Keys or OAuth details for Gmail, Slack, Google Calendar, and OpenAI.
  2. Edit any IDs, email addresses, Slack channel names, or Gmail label names to match your accounts.
  3. Check text prompts or expressions for correct mapping (for example, {{$json.text}} in text classifier node).

Step 3: Test the workflow

  1. Trigger the workflow by sending a test email to your Gmail inbox to see if labeling and Slack messages happen.
  2. Try the chat interface URL to start a conversation and book an appointment, checking calendar booking works.

Step 4: Activate for production

  1. After testing, activate the workflow in n8n by turning the toggle switch On.
  2. Share the chat webhook URL with your team or users for appointment scheduling.
  3. Monitor executions in the n8n dashboard and fix any errors found.
  4. If you are hosting n8n yourself, consider self-host n8n setup for reliable access.

Common problems and edge cases

  • AI classifier errors: Usually caused by bad text input or OpenAI API key issues. Fix by checking inputs and key limits.
  • Gmail label not applied: Check label IDs and message IDs are correct in Gmail nodes.
  • Slack messages not sent: Verify Slack OAuth access and channel permissions.
  • Appointment booking fails: Often due to wrong date-time formatting or timezone mismatch. Use ISO 8601 with timezone.
  • Chat context lost: Check that memory node connects properly to keep conversation flow.

Ideas for customization

  • Add more email categories to the AI classifier node by editing categories JSON (e.g., “support”, “sales”).
  • Change Slack messages to show more email details or links.
  • Adjust appointment meeting lengths by editing system message and booking parameters.
  • Connect calendars of other team members in Google Calendar nodes.
  • Change conversation memory length to keep more or fewer previous chat entries.

Summary

✓ Automates sorting of Gmail emails by category.

✓ Sends Slack notifications automatically.

✓ Offers chat assistant to book appointments via Google Calendar.

→ Saves time and reduces manual work.

→ Avoids schedule conflicts by checking availability first.

→ Maintains chat context for natural conversations.


{
  "inputText": "{{$json.text}}",
  "categories": [
    { "name": "automation", "description": "Emails about workflows and automation." },
    { "name": "music", "description": "Emails about music events or artists." }
  ]
}

Use this JSON in the Text Classifier node to tell AI how to sort emails.


Automate email categorization with n8n and Gmail

Visit through Desktop to Interact with the Workflow.

Frequently Asked Questions

No, the workflow uses Gmail nodes and labels. Using Outlook would require building a new workflow with Outlook nodes.
Yes, both the Text Classifier and Chat nodes consume OpenAI API credits according to your subscription.
Yes, all data stays within your Google account and uses secure OAuth authentication.
Check that Gmail label IDs and message IDs are correct and properly mapped from the trigger node.

Promoted by BULDRR AI

Related Workflows

Automate Twist Channel Creation and Messaging with n8n

This workflow automates creating and updating a channel in Twist and sending a personalized message to specific users. It eliminates manual setup errors and saves time managing Twist communications.

Automate Ideogram Image Generation with Google Sheets & Gmail

This workflow automates graphic design image generation via Ideogram AI, storing image data in Google Sheets and Google Drive, with email alerts via Gmail. It saves designers hours by automating image creation, remixing, review, and record-keeping.

Automate IT Support with Slack and OpenAI in n8n

Streamline IT support by automating Slack message handling using n8n and OpenAI. This workflow handles Slack DMs, filters bots, queries a Confluence knowledge base, and delivers AI-generated responses, improving support efficiency and response time.

Automate Crypto Analysis with CoinMarketCap & n8n AI Agent

Discover how this unique n8n workflow leverages CoinMarketCap’s multi-agent AI to deliver precise, real-time cryptocurrency insights directly via Telegram. Manage crypto data analysis efficiently with automated multi-source API integration.

Automate Gumroad to Beehiiv Subscriber Sync with n8n

Learn how to automatically add new Gumroad sales customers as Beehiiv newsletter subscribers using n8n automation. This workflow saves time by syncing sales data to Google Sheets CRM and notifying your Telegram channel instantly.

Generate On-Brand Blog Articles Using n8n and OpenAI

This workflow automates the creation of on-brand blog articles by analyzing existing company content using n8n and OpenAI. It extracts article structures and brand voice to produce consistent draft articles, saving significant content creation time.
1:1 Free Strategy Session
Your competitors are already automating. Are you still paying for it manually?

Do you want to adopt AI Automation?

Every hour your team does repetitive work, you're burning real money.
While you wait, faster businesses are cutting costs and moving quicker.
AI and automations aren't the future anymore — they're the present.

Book a live 1-on-1 session where we show you exactly which of your daily tasks can be automated — and what it’s costing you not to.