Files
GNX-WEB/gnx-react/backend/support/README.md
Iliyan Angelov d48c54e2c5 update
2025-10-07 22:10:27 +03:00

4.9 KiB

Support Center Module

Enterprise Support Center for handling customer support tickets, knowledge base articles, and support settings.

Features

  • Ticket Management

    • Create and track support tickets
    • Multiple ticket types (technical, billing, feature requests, etc.)
    • Priority and status management
    • Ticket categories and tags
    • SLA deadline tracking
    • Message and activity history
  • Knowledge Base

    • Categorized articles
    • Search functionality
    • Featured articles
    • Article feedback (helpful/not helpful)
    • View count tracking
    • Rich content support
  • Public API

    • Create tickets without authentication
    • Check ticket status by ticket number
    • Browse knowledge base articles
    • Search articles

Setup

1. Run Migrations

python manage.py migrate

2. Populate Initial Data

python manage.py populate_support_data

This will create:

  • 5 ticket statuses (Open, In Progress, Pending Response, Resolved, Closed)
  • 4 ticket priorities (Low, Medium, High, Critical)
  • 6 ticket categories
  • 6 knowledge base categories
  • 6 sample knowledge base articles

3. Admin Access

Access the Django admin panel to manage:

  • Support tickets
  • Ticket categories, statuses, and priorities
  • Knowledge base categories and articles
  • Support settings

API Endpoints

Tickets

  • GET /api/support/tickets/ - List all tickets
  • POST /api/support/tickets/ - Create a new ticket
  • GET /api/support/tickets/{id}/ - Get ticket details
  • POST /api/support/tickets/check-status/ - Check ticket status by ticket number
  • POST /api/support/tickets/{id}/add-message/ - Add a message to a ticket

Categories

  • GET /api/support/categories/ - List all ticket categories
  • GET /api/support/statuses/ - List all ticket statuses
  • GET /api/support/priorities/ - List all ticket priorities

Knowledge Base

  • GET /api/support/knowledge-base/ - List all published articles
  • GET /api/support/knowledge-base/{slug}/ - Get article details
  • GET /api/support/knowledge-base/featured/ - Get featured articles
  • GET /api/support/knowledge-base/by-category/{category_slug}/ - Get articles by category
  • POST /api/support/knowledge-base/{slug}/mark-helpful/ - Mark article as helpful/not helpful
  • GET /api/support/knowledge-base-categories/ - List all KB categories

Settings

  • GET /api/support/settings/ - List all active support settings
  • GET /api/support/settings/{setting_name}/ - Get specific setting

Models

SupportTicket

Main model for support tickets with full tracking capabilities.

TicketStatus

Ticket status options (Open, In Progress, Resolved, etc.)

TicketPriority

Priority levels with SLA hours (Low, Medium, High, Critical)

TicketCategory

Categorize tickets for better organization

TicketMessage

Messages and updates on tickets

TicketActivity

Audit trail of all ticket changes

KnowledgeBaseCategory

Categories for knowledge base articles

KnowledgeBaseArticle

Knowledge base articles with rich content

SupportSettings

Configurable support center settings

Usage Examples

Create a Ticket

import requests

data = {
    "title": "Cannot login to my account",
    "description": "I've been trying to login but getting error 500",
    "ticket_type": "technical",
    "user_name": "John Doe",
    "user_email": "john@example.com",
    "user_phone": "+1234567890",
    "company": "Acme Corp",
    "category": 1  # Technical Support category ID
}

response = requests.post('http://localhost:8000/api/support/tickets/', json=data)
ticket = response.json()
print(f"Ticket created: {ticket['ticket_number']}")

Check Ticket Status

import requests

data = {
    "ticket_number": "TKT-20231015-ABCDE"
}

response = requests.post('http://localhost:8000/api/support/tickets/check-status/', json=data)
ticket = response.json()
print(f"Status: {ticket['status_name']}")

Search Knowledge Base

import requests

response = requests.get('http://localhost:8000/api/support/knowledge-base/', params={'search': 'login'})
articles = response.json()
for article in articles:
    print(f"- {article['title']}")

Frontend Integration

The support center is integrated with the Next.js frontend at /support-center with:

  • Ticket submission form
  • Knowledge base browser with search
  • Ticket status checker
  • Modern, responsive UI

Email Notifications

To enable email notifications for tickets, configure email settings in settings.py and implement email templates in support/templates/support/.

Security

  • All endpoints are public (AllowAny permission)
  • Ticket numbers are randomly generated and hard to guess
  • Internal notes and messages are hidden from public API
  • Rate limiting recommended for production

Future Enhancements

  • Live chat integration
  • File attachments for tickets
  • Email notifications
  • Ticket assignment and routing
  • SLA breach alerts
  • Advanced analytics dashboard
  • Webhook notifications