n8nflow.net logo

Generate Empathetic Customer Replies with Claude AI and Auto-Escalation

by Yusukeβ€’Updated: Last update 6 days agoβ€’Source: n8n.io
Loading workflow viewer...

Getting Started

🧠 Overview

Generate empathetic, professional reply drafts for customer or user messages.
The workflow detects sentiment , tone , and risk level , drafts a concise response, sanitizes PII/links/emojis, and auto-escalates risky or low-confidence cases to human review.


βš™οΈ How It Works

  1. Input β€” Manual Test or Webhook Trigger
  2. AI Agent (Empathy) β€” returns { sentiment, tone, reply, confidence, needs_handover }
  3. Post-Process & Sanitize β€” removes URLs/hashtags, masks PII, caps length
  4. Risk & Handover Rules β€” checks confidence threshold, risk words, and negativity
  5. Routing β€” auto-send safe replies or flag to Needs Review

🧩 Setup Instructions (3–5 min)

  • Open Set Config1 and adjust:
    • MAX_LEN (default 600)
    • ADD_FOLLOWUP_QUESTION (true/false)
    • FORMALITY (auto | casual | polite)
    • EMOJI_ALLOWED (true/false), BLOCK_LINKS (true/false)
    • RISK_WORDS (e.g., refund, lawsuit, self-harm)
  • Connect Anthropic credential to Anthropic Chat Model
  • (Optional) Replace Manual Trigger with Webhook Trigger for real-time use

Tip: If you need to show literal angle brackets in messages, use backticks like <example> (no HTML entities needed).


πŸ“š Use Cases

1) SaaS Billing Complaints

  • Input: β€œI was billed after canceling. This is unacceptable.”
  • Output: Calm, apologetic reply with refund steps; escalates if refund is in RISK_WORDS or confidence < 0.45.

2) Product Bug Reports

  • Input: β€œUpload fails on large files since yesterday.”
  • Output: Acknowledges impact, requests logs, offers workaround; routes to auto-send if low risk and high confidence.

3) Delivery/Logistics Delays

  • Input: β€œMy order is late again. Should I file a complaint?”
  • Output: Empathetic apology, ETA guidance, partial credit policy note; escalates if language indicates legal action.

4) Community Moderation / Abuse

  • Input: β€œSupport is uselessβ€”you’re all scammers.”
  • Output: De-escalating, policy-aligned response; auto-flags due to negative sentiment + risk keyword match.

5) Safety / Self-harm Mentions

  • Input: β€œI feel like hurting myself if this isn’t fixed.”
  • Output: Immediate escalation , inserts approved resources; never auto-sends.

🚨 Auto-Escalation Rules (defaults)

  • Negative sentiment
  • Message matches any RISK_WORDS
  • confidence < 0.45
  • Mentions of legal , harassment , or self-harm context

πŸ§ͺ Notes & Best Practices

  • πŸ” No hardcoded API keys β€” use n8n Credentials
  • 🧭 Tune thresholds and RISK_WORDS to your org policy
  • 🧩 Works on self-hosted or cloud n8n
  • βœ… Treat outputs as drafts ; ship after human/policy review

πŸ”— Resources