📖 Project Overview
Customer Service Bot is a comprehensive support automation solution built with Python. It is designed to streamline customer service operations by automating FAQ responses, managing support tickets, and routing inquiries intelligently based on priority and sentiment. Features a modern Flask web interface for both end-users and administrators.
⚡ Quick Facts
✨ Features
Core Functionality
🤖 Automated FAQ Handling
Instantly answers common questions about hours, pricing, and services using fuzzy matching logic.
🎫 Ticket Management
Complete system to create, track, and manage support tickets with unique IDs and status tracking.
🧠 Intent Detection
Intelligently distinguishes between simple queries and complex issues requiring human intervention.
😊 Sentiment Analysis
Analyzes user tone (frustrated, urgent, happy) to prioritize tickets automatically.
Advanced Capabilities
🚨 Urgent Priority Routing
Detects keywords like "emergency" or "manager" to escalate issues immediately.
👥 Admin Dashboard
Comprehensive admin panel to view ticket statistics, status, and export data.
💾 Data Persistence
Uses SQLite (via SQLAlchemy) to securely store tickets and user interactions.
📊 CSV Export
Export ticket data to CSV format for external analysis and reporting.
💬 Adaptive Tone
Bot adjusts its responses based on the user's sentiment (e.g., apologizing if user is angry).
🌐 RESTful API
API endpoints for chat, ticket creation, and status updates for external integrations.
🛠️ Technologies
Python 3.8+
Core backend logic
LanguageFlask
Web server and API
FrameworkSQLAlchemy
ORM for Database interactions
DatabaseSQLite
Lightweight relationship database
StorageHTML5/CSS3
Responsive frontend design
FrontendJavaScript
Interactive chat interface
Frontend📦 Installation Guide
Simple Setup
Get up and running in minutes.
Step 1: Install Dependencies
pip install -r requirements.txt
Step 2: Run the Application
python app.py
The application will start on http://localhost:5000.
📚 Usage Examples
Starting the Chat
When you open the bot, it will welcome you. You can ask general questions or report issues.
Common Commands
- "Help" - Shows available options.
- "hours" - Checks operating hours.
- "refund" - Asks about refund policy.
- "ticket" - Initiates the ticket creation process.
Admin Panel
Access http://localhost:5000/admin to view the dashboard.
💻 Code Structure
Bot Logic (Fuzzy Matching)
def get_response(message):
msg = message.lower().strip()
# 1. Analyze Sentiment
sentiment_score, priority = analyze_sentiment(msg)
# 2. Check for keywords (Fuzzy Match)
keys = list(FAQ_KB.keys())
# ... logic to find best match ...
# 3. Intent Detection
if "ticket" in msg or "issue" in msg:
return {
"text": "Would you like to raise a support ticket?",
"type": "option",
"options": ["Yes", "No"]
}
Creating a Ticket via API
@app.route('/api/ticket', methods=['POST'])
def ticket():
data = request.json
issue = data.get('issue')
contact = data.get('contact')
# Analyze sentiment
score, priority = analyze_sentiment(issue)
ticket_id = create_ticket(issue, contact, priority, score)
return jsonify({
'status': 'success',
'ticket_id': ticket_id,
'priority': priority
})
🔗 API Endpoints
| Endpoint | Method | Description |
|---|---|---|
| /api/chat | POST | Send a message to the bot and get a response. |
| /api/ticket | POST | Create a new support ticket. |
| /api/ticket/{id}/close | POST | Close an existing ticket. |
| /admin/export | GET | Download tickets as CSV. |
🤝 Support & Contact
For custom development, integration help, or commercial use, please contact RSK World.
- Website: rskworld.in
- Email: help@rskworld.in
- GitHub: RSK World Repos