> ## Documentation Index
> Fetch the complete documentation index at: https://memberpulseptyltd.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Ticket Management

> Handle member support tickets with assignment, responses, and tracking

Manage member support requests with ticket queues, assignment, response tracking, and resolution workflows.

## Capabilities

| Action             | ROLE\_CLIENT\_ADMIN | ROLE\_CLIENT\_USER |
| ------------------ | ------------------- | ------------------ |
| View all tickets   | ✅                   | ✅                  |
| Respond to tickets | ✅                   | ✅                  |
| Assign tickets     | ✅                   | ❌                  |
| Change priority    | ✅                   | ❌                  |
| Close tickets      | ✅                   | ✅                  |

## Features

### Ticket Queue

View and filter tickets by:

* Status (open, in progress, waiting, resolved, closed)
* Priority (low, medium, high)
* Category
* Assigned agent
* Date range

Ticket categories are configurable (see **Ticket Categories** below).

#### Acceptance Criteria

##### Frontend

* [ ] UI supports the workflows described in this feature.

##### Backend / API

* [ ] Backend behavior supports this feature as documented.

##### Permissions

* [ ] Access is restricted per the Capabilities matrix on this page (or equivalent role rules).

##### Business Rules

* [ ] Ticket history preserved
* [ ] Resolution time tracking
* [ ] Escalation on breach
* [ ] Member notified on status change

##### Error Handling

* [ ] Error states return clear messages and appropriate HTTP status codes.

### Ticket Workflow

```
Open → In Progress → Waiting (on member) → Resolved → Closed
```

#### Acceptance Criteria

##### Frontend

* [ ] UI supports the workflows described in this feature.

##### Backend / API

* [ ] Backend behavior supports this feature as documented.

##### Permissions

* [ ] Access is restricted per the Capabilities matrix on this page (or equivalent role rules).

##### Business Rules

* [ ] All business rules for this feature are enforced.

##### Error Handling

* [ ] Error states return clear messages and appropriate HTTP status codes.

### Response Management

* Reply to member
* Internal notes (not visible to member)
* Canned responses
* File attachments
* Response templates

#### Acceptance Criteria

##### Frontend

* [ ] UI supports the workflows described in this feature.

##### Backend / API

* [ ] Backend behavior supports this feature as documented.

##### Permissions

* [ ] Access is restricted per the Capabilities matrix on this page (or equivalent role rules).

##### Business Rules

* [ ] First response SLA tracking

##### Error Handling

* [ ] Error states return clear messages and appropriate HTTP status codes.

### Assignment

* Auto-assignment rules
* Manual assignment
* Round-robin distribution
* Workload balancing

#### Acceptance Criteria

##### Frontend

* [ ] UI supports the workflows described in this feature.

##### Backend / API

* [ ] Backend behavior supports this feature as documented.

##### Permissions

* [ ] Access is restricted per the Capabilities matrix on this page (or equivalent role rules).

##### Business Rules

* [ ] All business rules for this feature are enforced.

##### Error Handling

* [ ] Error states return clear messages and appropriate HTTP status codes.

### Ticket Categories

Support tickets use a controlled category list for routing and reporting (e.g. Billing, Membership, Events, LMS, Directory).

Categories are managed by the association/client and used for:

* Member-facing category picker
* Staff queue filtering
* Assignment/routing rules
* Reporting by category

#### Acceptance Criteria

##### Frontend

* [ ] Admin UI supports category CRUD (create/edit/archive) and ordering.

##### Backend / API

* [ ] Categories are persisted and returned to member ticket forms.

##### Permissions

* [ ] Only `ROLE_CLIENT_ADMIN` can manage ticket categories.

##### Business Rules

* [ ] Category names are unique per client.
* [ ] Archiving a category does not delete existing tickets.

##### Error Handling

* [ ] Validation errors are shown inline.

### CRM Notes (optional)

When CRM sync is enabled, ticket activity can be logged back to the member’s CRM contact.

* Minimum: create a note/engagement containing the **ticket number** and current status
* Optional: update the note when the ticket is resolved/closed

## Implementation Contracts

### Backend (API)

```
GET    /api/tickets                          # List tickets
GET    /api/tickets/{id}                     # Get ticket details
PUT    /api/tickets/{id}                     # Update ticket
POST   /api/tickets/{id}/responses           # Add response
PUT    /api/tickets/{id}/assign              # Assign ticket
PUT    /api/tickets/{id}/status              # Update status

GET    /api/tickets/queue                    # Queue statistics
GET    /api/tickets/canned-responses         # List templates
GET    /api/tickets/categories               # List ticket categories
POST   /api/tickets/categories               # Create category
PUT    /api/tickets/categories/{id}          # Update category
DELETE /api/tickets/categories/{id}          # Archive category
```

## AI-Powered Support Features

### Ticket Summarization

The system automatically generates summaries of each ticket and the entire conversation thread, similar to Read.AI functionality.

#### Summary Types

<Tabs>
  <Tab title="Ticket Summary">
    A concise overview of the support ticket:

    * **Issue Description**: What the member is reporting/requesting
    * **Key Details**: Important information extracted from the ticket
    * **Current Status**: Where the ticket stands in the resolution process
    * **Action Items**: Outstanding tasks or next steps
  </Tab>

  <Tab title="Conversation Summary">
    A summary of the entire conversation thread:

    * **Timeline**: Chronological summary of interactions
    * **Resolution Attempts**: What solutions have been tried
    * **Member Sentiment**: Overall tone and satisfaction indicators
    * **Key Decisions**: Important decisions made during the conversation
  </Tab>
</Tabs>

#### Summary Features

* **Auto-Generated**: Summaries update automatically as conversations progress
* **Quick Scan**: Support staff can quickly understand ticket context
* **Handoff Ready**: Summaries facilitate smooth ticket transfers between agents
* **Historical Context**: Previous related tickets referenced when relevant

#### Acceptance Criteria (Summarization)

##### Frontend

* [ ] Summary panel displayed on ticket detail view
* [ ] Expandable/collapsible summary sections
* [ ] "Refresh Summary" button to regenerate
* [ ] Summary history showing changes over time
* [ ] Copy summary to clipboard option

##### Backend / API

* [ ] Automatic summary generation on ticket updates
* [ ] AI service integration for natural language summarization
* [ ] Summary storage and versioning

##### Permissions

* [ ] All support staff can view summaries
* [ ] Summaries are internal-only (not visible to members)

##### Business Rules

* [ ] Summaries regenerate when significant new content is added
* [ ] PII and sensitive data handled appropriately in summaries
* [ ] Summaries indicate when they were last updated

##### Error Handling

* [ ] If AI service unavailable, show "Summary unavailable" with retry option
* [ ] Fallback to basic ticket metadata if summarization fails

### AI Draft Response

A feature that allows support staff to generate a draft response with a single button click, using AI to analyze the ticket context and suggest an appropriate reply.

<Steps>
  <Step title="Click Draft Response">
    Support staff clicks the "Draft Response" button on any ticket
  </Step>

  <Step title="AI Analysis">
    System analyzes ticket content, conversation history, and knowledge base
  </Step>

  <Step title="Generate Draft">
    AI produces a contextually appropriate draft response
  </Step>

  <Step title="Review & Edit">
    Staff reviews, edits as needed, and sends the response
  </Step>
</Steps>

#### Draft Response Features

* **Context-Aware**: Draft considers entire conversation history
* **Knowledge Base Integration**: References relevant help articles and documentation
* **Tone Matching**: Maintains professional and empathetic tone
* **Personalization**: Includes member name and relevant details
* **Canned Response Enhancement**: Can enhance existing canned responses with context

#### Acceptance Criteria (Draft Response)

##### Frontend

* [ ] "Draft Response" button prominently displayed in response area
* [ ] Loading indicator while AI generates draft
* [ ] Draft appears in response text editor for review/editing
* [ ] Option to regenerate with different tone (formal, friendly, concise)
* [ ] Keyboard shortcut for quick draft generation

##### Backend / API

* [ ] AI service integration for response generation
* [ ] Knowledge base search for relevant content
* [ ] Response tone and style configuration

##### Permissions

* [ ] All support staff can use draft response feature
* [ ] `ROLE_CLIENT_ADMIN` can configure default tone and style settings

##### Business Rules

* [ ] Draft responses are never sent automatically (always require human review)
* [ ] AI indicates confidence level in generated response
* [ ] System tracks usage metrics for AI draft feature
* [ ] Generated drafts respect organization-specific terminology

##### Error Handling

* [ ] If AI service unavailable, show error with option to use canned responses
* [ ] If context is unclear, AI asks clarifying questions in draft

### Implementation Contracts (AI Support)

```
GET    /api/tickets/{id}/summary             # Get ticket summary
POST   /api/tickets/{id}/summary/refresh     # Regenerate summary
POST   /api/tickets/{id}/draft-response      # Generate draft response
GET    /api/tickets/{id}/conversation-summary # Get conversation summary
PUT    /api/settings/support-ai              # Configure AI settings
```

**Draft Response Request:**

```json theme={null}
{
  "tone": "professional",  // professional, friendly, concise
  "includeKnowledgeBase": true,
  "cannedResponseId": "optional-base-template"
}
```

**Draft Response:**

```json theme={null}
{
  "draft": "Dear [Member Name],\n\nThank you for reaching out...",
  "confidence": 0.87,
  "suggestedAttachments": [
    {
      "type": "knowledge_base",
      "id": "article-uuid",
      "title": "How to Reset Your Password"
    }
  ],
  "tone": "professional"
}
```

**Ticket Summary:**

```json theme={null}
{
  "ticketId": "ticket-uuid",
  "summary": "Member reporting login issues after password reset...",
  "keyPoints": [
    "Unable to login since Dec 10",
    "Password reset attempted twice",
    "Using Chrome browser on Windows"
  ],
  "sentiment": "frustrated",
  "suggestedActions": [
    "Verify account status",
    "Check for browser cache issues"
  ],
  "generatedAt": "2025-01-15T10:30:00Z"
}
```
