π§ 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
- Input β Manual Test or Webhook Trigger
- AI Agent (Empathy) β returns
{ sentiment, tone, reply, confidence, needs_handover }
- Post-Process & Sanitize β removes URLs/hashtags, masks PII, caps length
- Risk & Handover Rules β checks confidence threshold, risk words, and negativity
- 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