Quick overview
This workflow polls a Gmail support inbox for unread emails, uses OpenAI to classify messages against an n8n Data Table knowledge base, drafts (and optionally sends) approved replies in Gmail, posts escalations and urgent alerts to Slack, and logs every decision to an n8n Data Table.
How it works
- Polls Gmail every minute for unread messages matching your search query and fetches the full email thread.
- Extracts the customer’s new message text, checks whether anyone else has already replied in the thread, and stays silent while logging if the thread is already owned by a human.
- Flags messages as urgent when configured whole-word keywords appear in the new text, posts an urgent alert to Slack, and logs the event without drafting a reply.
- Logs short “thank you” messages (and other no-reply-needed content) with no Gmail draft and no Slack post.
- Skips OpenAI for empty or one-word emails and escalates them to the team in Slack with the Gmail thread link.
- Loads all entries from the support_kb Data Table and asks OpenAI to classify the email and (when applicable) select a single matching entry id with confidence and “answers fully” status.
- When the match exists, answersFully is true, and confidence meets your threshold, creates a Gmail draft using the stored knowledge base answer (and optionally sends it), otherwise posts the question to Slack for a human and logs the outcome to support_log.
Setup
- Connect Gmail credentials and update the Gmail trigger search query to match your support inbox.
- Create two n8n Data Tables named support_kb (with question, answer, and keywords text columns) and support_log (with timestamp, threadId, decision, classification, question, and note text columns), then populate support_kb with your FAQ entries.
- Add an OpenAI API credential (Chat model) for the classification step.
- Add a Slack credential, invite the Slack app to your target channel, and set the channel name, urgent keywords, confidence threshold, greeting/sign-off, and auto-send toggle in “Your Settings.”
Additional info
Need this fitted to your own tools or process? Tell us the job and we will send a fixed-price quote within one working day. fractionalhq.uk/custom-builds