AI Business
Customer Support
Chatbot
Automation
Customer Experience

AI Customer Support: สร้าง Chatbot ช่วยลูกค้า

คู่มือสร้าง AI chatbot สำหรับ customer support ตั้งแต่วางแผน ออกแบบ conversation flows ไปจนถึงการ implement และวัดผล

AI Unlocked Team
24/01/2568
AI Customer Support: สร้าง Chatbot ช่วยลูกค้า

AI Customer Support: สร้าง Chatbot ช่วยลูกค้า

AI Chatbot สามารถช่วยธุรกิจตอบคำถามลูกค้าได้ 24/7 ลดภาระงาน support team และเพิ่มความพึงพอใจลูกค้า

ทำไมต้องใช้ AI Customer Support?

ปัญหาของ Support แบบดั้งเดิม

Traditional Support:
- รอสายนาน (เฉลี่ย 10+ นาที)
- เปิดเฉพาะเวลาทำการ
- Agent ตอบซ้ำๆ ทุกวัน
- ค่าใช้จ่ายสูง
- Inconsistent quality

ประโยชน์ของ AI Support

AI Chatbot:
✅ ตอบทันที 24/7
✅ ไม่มีเวลารอ
✅ Consistent quality
✅ ลดต้นทุน 40-60%
✅ Scale ได้ไม่จำกัด
✅ เก็บ data ทุก interaction

ROI ที่คาดหวังได้

Before AI:
- 10 agents × $3,000/month = $30,000
- Handle 5,000 tickets/month
- Cost per ticket: $6

After AI:
- AI handles 70% = 3,500 tickets
- 4 agents handle 30% = 1,500 tickets
- AI cost: ~$500/month
- Agent cost: $12,000/month
- Total: $12,500/month
- Cost per ticket: $2.50

Savings: ~$17,500/month (58%)

Planning Your Chatbot

Define Scope

Step 1: รวบรวม FAQ
- ลูกค้าถามอะไรบ่อย?
- อะไรที่ตอบได้ทันที?
- อะไรที่ต้องส่งต่อ human?

Common Support Categories:
1. Order tracking (25%)
2. Returns/refunds (20%)
3. Product questions (20%)
4. Account issues (15%)
5. Shipping info (10%)
6. Other (10%)

Set Goals

KPIs ที่ควรวัด:

1. Resolution Rate
   - % ที่ AI แก้ได้โดยไม่ต้อง human
   - Target: 60-70%

2. Customer Satisfaction
   - CSAT score หลัง chat
   - Target: 4.0+/5.0

3. First Response Time
   - เวลาตอบครั้งแรก
   - Target: < 5 seconds

4. Handling Time
   - เวลาแก้ปัญหาเฉลี่ย
   - Target: < 3 minutes

5. Escalation Rate
   - % ที่ต้องส่งต่อ human
   - Target: < 30%

Design Conversation Flow

Basic Flow

User: "ฉันต้องการคืนสินค้า"

Bot: สวัสดีค่ะ ยินดีช่วยเรื่องการคืนสินค้า
     กรุณาให้หมายเลขคำสั่งซื้อด้วยค่ะ

User: "ORD123456"

Bot: [ตรวจสอบคำสั่งซื้อ]
     พบคำสั่งซื้อแล้วค่ะ
     - สินค้า: iPhone Case
     - วันสั่ง: 15 ม.ค. 2025
     - สถานะ: ส่งมอบแล้ว

     เหตุผลที่ต้องการคืน:
     1. สินค้าชำรุด
     2. ได้ไม่ตรงตามสั่ง
     3. เปลี่ยนใจ
     4. อื่นๆ

User: "1"

Bot: เข้าใจค่ะ สินค้าชำรุด
     กรุณาส่งรูปถ่ายสินค้าที่ชำรุดให้ด้วยค่ะ

[User ส่งรูป]

Bot: ได้รับรูปแล้วค่ะ ขอโทษที่สินค้ามีปัญหา
     เราจะดำเนินการคืนเงินภายใน 3-5 วันทำการ
     และส่งสินค้าใหม่ให้ฟรี

     ต้องการความช่วยเหลืออื่นอีกไหมคะ?

Intent Classification

Common Intents:

order_status
- "สถานะออเดอร์"
- "ของถึงไหนแล้ว"
- "track order"

return_request
- "คืนสินค้า"
- "ขอคืนเงิน"
- "return policy"

product_question
- "ราคาเท่าไหร่"
- "มีสีอะไรบ้าง"
- "รุ่นไหนดี"

account_issue
- "เข้าไม่ได้"
- "ลืมรหัสผ่าน"
- "เปลี่ยน email"

Implementation

Using OpenAI

from openai import OpenAI

client = OpenAI()

SYSTEM_PROMPT = """
คุณเป็น AI Customer Support ของร้าน XYZ Shop

หน้าที่:
1. ตอบคำถามลูกค้าอย่างสุภาพและเป็นมิตร
2. ช่วยเรื่องคำสั่งซื้อ การคืนสินค้า และสอบถามทั่วไป
3. ถ้าไม่สามารถช่วยได้ ให้แจ้งว่าจะส่งต่อเจ้าหน้าที่

ข้อมูลสำคัญ:
- นโยบายคืนสินค้าภายใน 30 วัน
- จัดส่งฟรีเมื่อซื้อ 500 บาทขึ้นไป
- เวลาทำการ: จ-ศ 9:00-18:00

ตอบเป็นภาษาไทย สุภาพ กระชับ
"""

def get_support_response(user_message, conversation_history):
    messages = [
        {"role": "system", "content": SYSTEM_PROMPT}
    ]

    # Add conversation history
    for msg in conversation_history:
        messages.append(msg)

    # Add current message
    messages.append({"role": "user", "content": user_message})

    response = client.chat.completions.create(
        model="gpt-4o-mini",
        messages=messages,
        temperature=0.7,
        max_tokens=500
    )

    return response.choices[0].message.content

With RAG for Knowledge Base

from langchain_openai import OpenAIEmbeddings
from langchain_chroma import Chroma

# Load knowledge base
embeddings = OpenAIEmbeddings()
vectorstore = Chroma(
    persist_directory="./support_kb",
    embedding_function=embeddings
)

def get_support_response_with_context(user_message):
    # Retrieve relevant knowledge
    docs = vectorstore.similarity_search(user_message, k=3)
    context = "\n".join([doc.page_content for doc in docs])

    messages = [
        {
            "role": "system",
            "content": f"""
คุณเป็น AI Customer Support

ใช้ข้อมูลนี้ในการตอบ:
{context}

ถ้าไม่มีข้อมูลที่เกี่ยวข้อง ให้แจ้งว่าจะส่งต่อเจ้าหน้าที่
"""
        },
        {"role": "user", "content": user_message}
    ]

    response = client.chat.completions.create(
        model="gpt-4o-mini",
        messages=messages
    )

    return response.choices[0].message.content

Function Calling for Actions

tools = [
    {
        "type": "function",
        "function": {
            "name": "check_order_status",
            "description": "Check the status of an order",
            "parameters": {
                "type": "object",
                "properties": {
                    "order_id": {
                        "type": "string",
                        "description": "The order ID"
                    }
                },
                "required": ["order_id"]
            }
        }
    },
    {
        "type": "function",
        "function": {
            "name": "create_return_request",
            "description": "Create a return request for an order",
            "parameters": {
                "type": "object",
                "properties": {
                    "order_id": {"type": "string"},
                    "reason": {"type": "string"},
                    "refund_method": {"type": "string"}
                },
                "required": ["order_id", "reason"]
            }
        }
    },
    {
        "type": "function",
        "function": {
            "name": "escalate_to_human",
            "description": "Transfer the conversation to a human agent",
            "parameters": {
                "type": "object",
                "properties": {
                    "reason": {"type": "string"},
                    "priority": {"type": "string", "enum": ["low", "medium", "high"]}
                },
                "required": ["reason"]
            }
        }
    }
]

# Use with function calling
response = client.chat.completions.create(
    model="gpt-4o-mini",
    messages=messages,
    tools=tools,
    tool_choice="auto"
)

Human Handoff

When to Escalate

Escalate เมื่อ:

1. ลูกค้าขอคุยกับคน
   - "ขอคุยกับเจ้าหน้าที่"
   - "ให้คนมาตอบ"

2. ปัญหาซับซ้อน
   - Billing disputes
   - Legal issues
   - Technical problems

3. ลูกค้าไม่พอใจ
   - Sentiment detection
   - Repeated questions
   - Frustration signals

4. High-value customers
   - VIP members
   - Large orders

Handoff Implementation

def check_should_escalate(message, context):
    # Check explicit request
    escalate_phrases = [
        "คุยกับคน", "เจ้าหน้าที่", "agent",
        "ไม่เข้าใจ", "ไม่ตอบตรงคำถาม"
    ]

    if any(phrase in message.lower() for phrase in escalate_phrases):
        return True, "Customer requested human agent"

    # Check sentiment
    if analyze_sentiment(message) < 0.3:
        return True, "Negative sentiment detected"

    # Check loop detection
    if context.get("repeated_questions", 0) > 2:
        return True, "Possible conversation loop"

    return False, None

def escalate_to_agent(conversation_id, reason):
    # Create ticket in helpdesk
    ticket = create_support_ticket(
        conversation_id=conversation_id,
        reason=reason,
        priority="high"
    )

    # Notify available agents
    notify_agents(ticket)

    return f"""
ขอบคุณที่รอค่ะ
กำลังส่งต่อให้เจ้าหน้าที่ดูแลคุณ
หมายเลขเคส: {ticket.id}
เจ้าหน้าที่จะติดต่อกลับภายใน 5 นาทีค่ะ
"""

Measuring Success

Key Metrics Dashboard

class SupportMetrics:
    def calculate_metrics(self, period="day"):
        conversations = get_conversations(period)

        return {
            "total_conversations": len(conversations),

            "resolution_rate": self._resolution_rate(conversations),

            "avg_response_time": self._avg_response_time(conversations),

            "escalation_rate": self._escalation_rate(conversations),

            "csat_score": self._avg_csat(conversations),

            "top_intents": self._top_intents(conversations),

            "cost_savings": self._calculate_savings(conversations)
        }

    def _resolution_rate(self, convos):
        resolved = [c for c in convos if c.resolved_by_ai]
        return len(resolved) / len(convos)

    def _calculate_savings(self, convos):
        ai_handled = len([c for c in convos if c.resolved_by_ai])
        cost_per_agent_ticket = 6  # $6
        cost_per_ai_ticket = 0.10  # $0.10

        without_ai = len(convos) * cost_per_agent_ticket
        with_ai = (ai_handled * cost_per_ai_ticket +
                   (len(convos) - ai_handled) * cost_per_agent_ticket)

        return without_ai - with_ai

Best Practices

1. Start Small

Phase 1: FAQ Bot (Month 1-2)
- Answer top 10 questions
- No integrations
- Human backup ready

Phase 2: Integrated Bot (Month 3-4)
- Order status checking
- Basic actions
- Knowledge base

Phase 3: Full Support (Month 5-6)
- Full automation
- Complex workflows
- Proactive support

2. Continuous Improvement

Weekly:
- Review escalated cases
- Update knowledge base
- Improve prompts

Monthly:
- Analyze metrics
- Customer feedback review
- A/B test new features

3. Human Touch

แม้ใช้ AI ต้องรักษา human touch:
- ภาษาเป็นกันเอง
- Empathy ในการตอบ
- ง่ายต่อการติดต่อคน
- Follow-up after issues

สรุป

AI Customer Support Benefits:

  1. 24/7 Availability: ตอบได้ทุกเวลา
  2. Cost Reduction: ลดต้นทุน 40-60%
  3. Consistency: คุณภาพสม่ำเสมอ
  4. Scalability: รองรับได้ไม่จำกัด
  5. Data Insights: เก็บ data ทุก interaction

Implementation Steps:

  1. Analyze current support
  2. Design conversation flows
  3. Build with proper tools
  4. Test thoroughly
  5. Launch and iterate

Success Metrics:

  • Resolution rate > 60%
  • CSAT > 4.0
  • Response time < 5s
  • Escalation < 30%

อ่านเพิ่มเติม:


เขียนโดย

AI Unlocked Team