Help Ticket API

Create and manage support tickets

POST
/api/users/user/{userId}/help

Description

Create a new help ticket. This endpoint allows users to submit support requests.

Request Body

{
  "subject": "Problem with mood tracking",
  "message": "I'm having trouble saving my mood entries for today.",
  "category": "technical" // optional
}

Response

{
  "success": true,
  "ticketId": "kjzl6hvfrbw6c8b9wqj0xxj9j4wcqrv1vj8h3",
  "message": "Help ticket created successfully"
}

Error Responses

Missing User ID (400 Bad Request)

{
  "error": "Missing user ID parameter"
}

Missing Subject (400 Bad Request)

{
  "error": "Subject is required"
}

Missing Message (400 Bad Request)

{
  "error": "Message is required"
}

Implementation Notes

  • The help ticket system allows users to create support tickets and communicate with staff.
  • Each ticket has a status that can be updated throughout its lifecycle: open, in-progress, closed, or resolved.
  • Users can add replies to their own tickets, and staff can reply to any ticket.
  • When staff reply to an open ticket, it automatically changes to "in-progress" status.
  • Tickets include a conversation history with timestamps and user information.
  • Administrators can view all tickets from all users through the admin endpoint.
  • Dates are formatted in the dd/mm/yyyy format for better readability.