DEV Community

Clamper ai
Clamper ai

Posted on • Originally published at clamper.tech

Building a Customer Support Bot with OpenClaw

Your support inbox has 47 unread tickets. Half are password resets. A quarter are order status questions. The rest are actual problems that need a human. Let's fix that.

In this guide, we'll build a fully functional customer support bot using OpenClaw that handles the repetitive stuff, knows when to escalate, and gets smarter over time.

Why Most Support Bots Are Terrible

The typical chatbot works like a decision tree. It asks you to pick from a menu. You pick wrong. It loops you back. You type "TALK TO A HUMAN" and it responds with "I'm sorry, I didn't understand that."

The problem isn't automated support. The problem is that most bots can't actually do anything. They can't look up your order. They can't check your account. They can't process a refund. They're a fancy FAQ page pretending to be a conversation.

An OpenClaw agent is different because it has skills — real tools that let it take real actions. It can query your database, send emails, create tickets, process payments, and update records.

Architecture Overview

Our support bot has four layers:

  • Layer 1 — Instant answers: FAQ-style questions from a knowledge base. No API calls. Under 2 seconds.
  • Layer 2 — Account lookups: Order status, account details, subscription info. Database queries, no writes.
  • Layer 3 — Actions: Password resets, refunds, subscription changes. Write operations with confirmation.
  • Layer 4 — Human escalation: Complex issues, angry customers, edge cases. Detailed ticket + graceful handoff.

Most support volume (60-70%) resolves at Layers 1 and 2.

Setting Up the Project

npm install -g openclaw
mkdir support-bot && cd support-bot
openclaw init

# Workspace structure:
# support-bot/
# ├── AGENTS.md         # Bot personality and rules
# ├── SOUL.md           # Tone and behavior
# ├── TOOLS.md          # API keys and connections
# ├── skills/           # Custom skills
# │   ├── ticket-system/
# │   ├── order-lookup/
# │   ├── refund-processor/
# │   └── knowledge-base/
# └── memory/           # Conversation history
Enter fullscreen mode Exit fullscreen mode

Skill 1: Knowledge Base

The knowledge base skill answers common questions without hitting any external APIs:

# skills/knowledge-base/SKILL.md
---
name: knowledge-base
description: "Answer common customer questions from the FAQ database."
---

# Knowledge Base

## Instructions
Search the FAQ entries below for the most relevant answer.

## FAQ Entries

### Shipping
- Standard shipping: 5-7 business days
- Express shipping: 2-3 business days
- Free shipping on orders over $50

### Returns
- 30-day return window from delivery date
- Items must be unused and in original packaging
- Refunds processed within 5-7 business days
Enter fullscreen mode Exit fullscreen mode

Deliberately simple. For most businesses with 50-100 common questions, a well-organized markdown file handles it fine.

Skill 2: Order Lookup

This connects to your database and retrieves real order data:

# skills/order-lookup/SKILL.md
---
name: order-lookup
description: Look up order status, tracking info, and delivery estimates.
---

# Order Lookup

## Scripts

### lookup.sh
Enter fullscreen mode Exit fullscreen mode


bash

!/bin/bash

QUERY=$1
SUPABASE_URL="https://your-project.supabase.co"

Try order ID first, then email

RESULT=$(curl -s "$SUPABASE_URL/rest/v1/orders?id=eq.$QUERY" \
-H "apikey: $SUPABASE_KEY")

if [ "$RESULT" = "[]" ]; then
RESULT=$(curl -s "$SUPABASE_URL/rest/v1/orders?customer_email=eq.$QUERY&order=created_at.desc&limit=5" \
-H "apikey: $SUPABASE_KEY")
fi
echo "$RESULT"


The agent reads the skill, understands when to use it, and executes the lookup when needed. No rigid dialog flows.

## Skill 3: Refund Processor

Refunds are write operations — you need guardrails:

Enter fullscreen mode Exit fullscreen mode


markdown

skills/refund-processor/SKILL.md


name: refund-processor

description: Process customer refund requests when eligible.

Refund Processor

Rules (STRICT)

  1. Order must be within 30-day return window
  2. ALWAYS confirm with customer before processing
  3. Maximum auto-refund: $100. Above that, escalate.
  4. Log every refund action

Confirmation Flow

"I can process a refund of $[amount] for order #[id].
Should I go ahead?"

Only proceed after explicit "yes."


The $100 cap means the bot handles most refunds instantly while protecting against edge cases.

## Skill 4: Ticket Escalation

Good escalation includes context — the human agent should never have to ask the customer to repeat themselves:

Enter fullscreen mode Exit fullscreen mode


markdown

skills/ticket-system/SKILL.md

When to Escalate

  • Customer explicitly asks for a human
  • Billing disputes over $100
  • Technical problems requiring investigation
  • Customer is clearly frustrated
  • Two failed resolution attempts

Ticket Creation — Include ALL:

  1. Customer name and email
  2. Full conversation summary
  3. What was already attempted
  4. Customer's desired outcome
  5. Priority level



## Memory: Getting Smarter Over Time

OpenClaw's memory architecture enables:

- **Customer history:** "This customer had a shipping issue last month too."
- **Solution patterns:** "The last three customers with error X502 were fixed by clearing cache."
- **Escalation patterns:** "Enterprise pricing questions always need a human."
- **Product issues:** "Five customers reported this same bug today. Flag it."

This is what separates an OpenClaw support bot from a static chatbot. It learns patterns, remembers context, and adapts.

## Handling Edge Cases

- **Multi-issue messages:** "My order is late AND the last item was wrong." Handle both issues sequentially.
- **Vague requests:** Ask one clarifying question, not three.
- **Repeated contacts:** Third contact about same issue? Escalate immediately.
- **Off-topic:** Polite redirect back to support scope.

## Cost Analysis

At 100 support tickets per day with 65% bot resolution:

- Bot handles 65 tickets × $0.007 average = **$0.46/day**
- Monthly bot cost: ~$14 in API costs
- Monthly savings: ~3.5 hours/day of human time freed up

Compare that to $3,000-5,000/month for a single full-time support agent.

## Measuring Performance

Track these numbers:

- **Resolution rate:** Target 60-70% after month one
- **Average handle time:** Under 3 minutes for Layer 1-2
- **Escalation rate:** Below 30% is good, below 20% is excellent
- **Customer satisfaction:** Simple thumbs up/down
- **False resolution rate:** Customer came back for same issue

## Getting Started Today

You don't need all four layers at once. Start with Layer 1 (knowledge base) and Layer 4 (escalation). This gives you a bot that answers simple questions and gracefully hands off everything else.

Launch checklist:
1. Set up OpenClaw workspace for the support bot
2. Write your top 30 FAQ entries as a knowledge base skill
3. Configure an escalation skill that creates tickets
4. Connect to one support channel
5. Monitor for one week, identify top 5 non-FAQ questions
6. Build skills to handle those 5 cases
7. Repeat weekly

Within a month, you'll have a bot that handles the majority of incoming requests. Within three months, it'll know your product better than most of your team.

---

*Read the full article with complete code examples at [clamper.tech/blog/customer-support-bot-openclaw](https://clamper.tech/blog/customer-support-bot-openclaw)*
Enter fullscreen mode Exit fullscreen mode

Top comments (0)

Some comments may only be visible to logged-in visitors. Sign in to view all comments.