๐ง Draft Gmail replies to stock and visit inquiries with Claude Haiku
โก 4 views ยท ๐ง Miscellaneous
Description
Quick Overview
This workflow checks a Gmail inbox every 5 minutes for new inquiry emails, uses Anthropic Claude to classify them as stock or store-visit requests, looks up matching data in n8n Data Tables, and saves a suggested reply as a Gmail draft while labeling each message for follow-up.
How it works
- Runs every 5 minutes on a schedule trigger.
- Fetches up to 10 recent Gmail inbox messages sent to the configured inquiry address that are not already labeled as drafted or needing human review.
- Processes emails one by one and uses Anthropic Claude to classify each message as a Stock inquiry, Store visit, or Other.
- For stock inquiries, Claude extracts the product category from the email, the workflow looks up matching items in an n8n Data Table, and Claude drafts a reply using only the returned stock and pricing details.
- For store-visit requests, Claude extracts the desired date/time from the email, the workflow looks up that dayโs slots in an n8n Data Table, and Claude drafts a reply listing available times (or indicating fully booked/unavailable).
- Creates a Gmail draft reply in the original thread and adds an ai-drafted label to the email, while non-matching inquiries are labeled needs-human for manual handling.
Setup
- Connect Gmail credentials with access to the inbox that receives inquiries.
- Add an Anthropic API credential for Claude.
- Create and populate two n8n Data Tables (one for products/stock and one for visit slots) and select their table IDs in the two lookup steps.
- Create the Gmail labels ai-drafted and needs-human and select them in the two Gmail labeling steps.
- Update the Config values for inbox address, timezone, currency, and the signature appended to drafted replies.
๐ Nodes Used
Gmail, Schedule Trigger, Basic LLM Chain, Anthropic Chat Model, Text Classifier, Information Extractor
๐ฅ Import
Download workflow.json and import into n8n:
Workflow menu โ Import from File