惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

云风的 BLOG
云风的 BLOG
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
博客园 - 叶小钗
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
V
V2EX
酷 壳 – CoolShell
酷 壳 – CoolShell
月光博客
月光博客
人人都是产品经理
人人都是产品经理
宝玉的分享
宝玉的分享
博客园 - 司徒正美
WordPress大学
WordPress大学
Microsoft Azure Blog
Microsoft Azure Blog
罗磊的独立博客
Vercel News
Vercel News
T
The Blog of Author Tim Ferriss
T
Tailwind CSS Blog
A
About on SuperTechFans
Apple Machine Learning Research
Apple Machine Learning Research
L
LangChain Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
V
Visual Studio Blog
S
SegmentFault 最新的问题
Google DeepMind News
Google DeepMind News
博客园 - 聂微东

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
Build an AI customer support bot with n8n — handles ticke...
Alex Kane · 2026-05-22 · via DEV Community

Alex Kane

My inbox had 47 unanswered support tickets on a Monday morning. Most were the same 4 questions: pricing, setup help, refund requests, and "how do I...?" questions.

I built an n8n workflow that handles 80% of them automatically. Here's the full JSON — free.

What it does

  • Webhook receives support ticket (from your contact form or email)
  • GPT-4o-mini classifies the ticket: pricing / technical / billing / general
  • Sends an appropriate auto-reply for each category
  • Escalates complex tickets to Slack for human review
  • Logs everything to Google Sheets for tracking

Setup time: 15-20 minutes | Cost: ~$0.001 per ticket | n8n version: 1.40+


The workflow JSON

{"name":"AI Customer Support Bot","nodes":[{"parameters":{"httpMethod":"POST","path":"support-ticket","responseMode":"responseNode","options":{}},"id":"cs1","name":"Webhook","type":"n8n-nodes-base.webhook","typeVersion":1,"position":[240,300]},{"parameters":{"jsCode":"const body = $input.first().json.body || $input.first().json;\nconst email = body.email || body.from || 'unknown@example.com';\nconst subject = body.subject || body.title || 'Support Request';\nconst message = body.message || body.content || body.text || '';\nreturn [{ json: { email, subject, message, receivedAt: new Date().toISOString() } }];"},"id":"cs2","name":"Parse Ticket","type":"n8n-nodes-base.code","typeVersion":2,"position":[460,300]},{"parameters":{"resource":"chat","operation":"complete","model":"gpt-4o-mini","messages":{"values":[{"role":"system","content":"You are a support ticket classifier. Classify the ticket into exactly one category: PRICING, TECHNICAL, BILLING, or GENERAL. Then write a helpful, friendly auto-reply (2-3 sentences max). Reply in JSON: {\"category\": \"...\", \"reply\": \"...\"}"},{"role":"user","content":"=Subject: {{ $json.subject }}\nMessage: {{ $json.message }}"}]},"options":{"temperature":0.3}},"id":"cs3","name":"AI Classify & Reply","type":"n8n-nodes-base.openAi","typeVersion":1,"position":[680,300]},{"parameters":{"jsCode":"const raw = $input.first().json.message.content;\nlet parsed;\ntry { parsed = JSON.parse(raw); } catch(e) { parsed = { category: 'GENERAL', reply: 'Thanks for reaching out! Our team will get back to you within 24 hours.' }; }\nconst needsHuman = parsed.category === 'BILLING' || parsed.category === 'TECHNICAL';\nreturn [{ json: { ...$input.first().json, category: parsed.category, autoReply: parsed.reply, needsHuman } }];"},"id":"cs4","name":"Parse AI Response","type":"n8n-nodes-base.code","typeVersion":2,"position":[900,300]},{"parameters":{"conditions":{"boolean":[{"value1":"={{ $json.needsHuman }}","value2":true}]}},"id":"cs5","name":"Needs Human?","type":"n8n-nodes-base.if","typeVersion":1,"position":[1120,300]},{"parameters":{"sendTo":"={{ $json.email }}","subject":"Re: {{ $json.subject }}","message":"={{ $json.autoReply }}\n\nBest,\nSupport Team","options":{}},"id":"cs6","name":"Send Auto-Reply","type":"n8n-nodes-base.gmail","typeVersion":2,"position":[1340,420]},{"parameters":{"authentication":"webhook","resource":"chat","operation":"post","channel":"#support-escalations","text":"=🎫 *New {{ $json.category }} ticket needs review*\n*From:* {{ $json.email }}\n*Subject:* {{ $json.subject }}\n*Message:* {{ $json.message }}\n*Auto-reply sent:* {{ $json.autoReply }}","otherOptions":{}},"id":"cs7","name":"Slack Escalation","type":"n8n-nodes-base.slack","typeVersion":1,"position":[1340,180]},{"parameters":{"operation":"append","documentId":{"value":"YOUR_SHEET_ID"},"sheetName":"Tickets","columns":{"mappingMode":"defineBelow","value":{"Date":"={{ $json.receivedAt }}","Email":"={{ $json.email }}","Subject":"={{ $json.subject }}","Category":"={{ $json.category }}","AutoReply":"={{ $json.autoReply }}","EscalatedToHuman":"={{ $json.needsHuman }}"}},"options":{}},"id":"cs8","name":"Log to Sheets","type":"n8n-nodes-base.googleSheets","typeVersion":4,"position":[1560,300]}],"connections":{"Webhook":{"main":[[{"node":"Parse Ticket","type":"main","index":0}]]},"Parse Ticket":{"main":[[{"node":"AI Classify & Reply","type":"main","index":0}]]},"AI Classify & Reply":{"main":[[{"node":"Parse AI Response","type":"main","index":0}]]},"Parse AI Response":{"main":[[{"node":"Needs Human?","type":"main","index":0}]]},"Needs Human?":{"main":[[{"node":"Slack Escalation","type":"main","index":0}],[{"node":"Send Auto-Reply","type":"main","index":0}]]},"Slack Escalation":{"main":[[{"node":"Log to Sheets","type":"main","index":0}]]},"Send Auto-Reply":{"main":[[{"node":"Log to Sheets","type":"main","index":0}]]}}}

Enter fullscreen mode Exit fullscreen mode

Import: Workflows → New → ⋯ menu → Import from JSON → paste above.


Setup (15 min)

1. Webhook

  • Copy the webhook URL after activating the workflow
  • Point your contact form's POST action to it
  • Or use Zapier/Make to forward emails to the webhook

2. OpenAI credentials

  • Add your OpenAI API key in n8n credentials
  • GPT-4o-mini costs ~$0.15/1M input tokens — extremely cheap for support

3. Gmail

  • Connect your Gmail account for the auto-reply node
  • Change Send Auto-Reply sender name/signature to match your brand

4. Slack

  • Add a Slack webhook URL for the escalation channel
  • Or swap this node for an email node if you don't use Slack

5. Google Sheets

  • Create a sheet with columns: Date, Email, Subject, Category, AutoReply, EscalatedToHuman
  • Replace YOUR_SHEET_ID with your sheet's ID (from the URL)

How the AI classification works

The system prompt forces GPT-4o-mini to return structured JSON with a category and a reply. The Parse AI Response code node handles malformed output gracefully — if parsing fails, it defaults to GENERAL category with a generic reply.

Categories and their handling:

  • PRICING → Auto-reply with your pricing info → no escalation
  • GENERAL → Auto-reply with helpful generic response → no escalation
  • TECHNICAL → Auto-reply + escalate to Slack (needs human follow-up)
  • BILLING → Auto-reply + escalate to Slack (always needs human review)

Tips

1. Customize the system prompt
The real power is in the prompt. Add your actual pricing, your product name, your refund policy. The more context you give GPT, the better the auto-replies.

2. Add a confidence score
Ask the AI to also return "confidence": 0.0-1.0. Only send auto-replies when confidence > 0.8, escalate the rest.

3. Track auto-reply rate
After 1 week, check your Sheets log. What % of tickets got a good auto-reply vs escalation? Tune the system prompt based on what's failing.

4. Add a delay before sending
Add a Wait node (2-5 min delay) before the auto-reply. Instant replies feel robotic; a short delay feels more human.

5. Handle attachments
The webhook node can receive file uploads. Add a check in Parse Ticket for attachments and route those directly to escalation.


What this replaces

Before: checking email every hour, copy-pasting the same replies, drowning in tickets.

After: webhook fires, AI replies in 30 seconds, you only see the edge cases that need you.

I built this as one of 15 n8n automation templates I use for client projects. If you want the full version with setup guide, Slack alert templates, and error handling — they're all at https://stripeai.gumroad.com.

The JSON above is the complete working core. Happy to answer questions in the comments.