Omnix

TicketRpc

This RPC group provides ticket-related API operations for creating tickets, associating tickets with conversations, updating tickets, and retrieving tickets by query or identifier. All methods documented here are exposed through the JSON RPC transport at POST /api/rpc.

Endpoints

POST /api/rpc (Method: TicketRpc.create)

  • Description: Creates a new ticket, optionally linking it to a conversation.

  • Request Body:

    {
      "method": "TicketRpc.create",
      "params": {
        "conversationId": "string"
      }
    }
  • Parameters:

    Name Type Required Description
    conversationId String No Optional conversation identifier to link after the ticket is created.
    subject String Yes Ticket subject.
    status Enum No Ticket status. Accepted values: new, open, pending, solved, closed. Defaults to new.
    priority Enum No Ticket priority. Accepted values: low, normal, high, urgent. Defaults to normal.
    contactId String Yes Primary contact associated with the ticket.
    assigneeId String | Null No User ID of the assigned agent.
    linkedConversationIds Array<String> No Existing linked conversation IDs.
    autoResponseConfig.onStatusChange Boolean No Enables status-change notifications. Defaults to true.
    autoResponseConfig.onAssignment Boolean No Enables assignment-change notifications. Defaults to true.
  • Response:

    {
      "success": true,
      "data": {
        "_id": "string",
        "subscriptionId": "string",
        "ticketNumber": 1001,
        "subject": "string",
        "status": "new",
        "priority": "normal",
        "contactId": "string",
        "assigneeId": "string|null",
        "linkedConversationIds": [],
        "autoResponseConfig": {
          "onStatusChange": true,
          "onAssignment": true
        },
        "createdAt": "date-time",
        "updatedAt": "date-time"
      }
    }
  • Example (cURL):

    curl -X POST "${APP_BASE_URL}/api/rpc" \
      -H "Content-Type: application/json" \
      -d '{
        "method": "TicketRpc.create",
        "params": {
          "subject": "Customer cannot log in",
          "contactId": "65f0c9d8a3b2f4e1c9d12345",
          "priority": "high",
          "status": "new",
          "conversationId": "65f0c9d8a3b2f4e1c9d67890"
        }
      }'

POST /api/rpc (Method: TicketRpc.linkConversation)

  • Description: Links an existing ticket to a conversation.

  • Request Body:

    {
      "method": "TicketRpc.linkConversation",
      "params": {
        "ticketId": "string",
        "conversationId": "string"
      }
    }
  • Parameters:

    Name Type Required Description
    ticketId String Yes Ticket identifier to update.
    conversationId String Yes Conversation identifier to associate with the ticket.
  • Response:

    {
      "success": true,
      "data": null
    }
  • Example (cURL):

    curl -X POST "${APP_BASE_URL}/api/rpc" \
      -H "Content-Type: application/json" \
      -d '{
        "method": "TicketRpc.linkConversation",
        "params": {
          "ticketId": "65f0c9d8a3b2f4e1c9d12345",
          "conversationId": "65f0c9d8a3b2f4e1c9d67890"
        }
      }'

POST /api/rpc (Method: TicketRpc.update)

  • Description: Updates an existing ticket.

  • Request Body:

    {
      "method": "TicketRpc.update",
      "params": {
        "_id": "string"
      }
    }
  • Parameters:

    Name Type Required Description
    _id String Yes Ticket identifier to update.
    subject String No Updated ticket subject.
    status Enum No Updated status. Accepted values: new, open, pending, solved, closed.
    priority Enum No Updated priority. Accepted values: low, normal, high, urgent.
    contactId String No Updated primary contact identifier.
    assigneeId String | Null No Updated agent assignment.
    linkedConversationIds Array<String> No Updated set of linked conversation IDs.
    autoResponseConfig.onStatusChange Boolean No Updated status-change notification setting.
    autoResponseConfig.onAssignment Boolean No Updated assignment-change notification setting.
    subscriptionId String No Included in the schema but removed before the update is applied.
    ticketNumber Number No Included in the schema but removed before the update is applied.
    createdAt Date No Included in the schema but removed before the update is applied.
    updatedAt Date No Included in the schema but removed before the update is applied.
  • Response:

    {
      "success": true,
      "data": {
        "_id": "string",
        "subscriptionId": "string",
        "ticketNumber": 1001,
        "subject": "string",
        "status": "open",
        "priority": "high",
        "contactId": "string",
        "assigneeId": "string|null",
        "linkedConversationIds": [],
        "autoResponseConfig": {
          "onStatusChange": true,
          "onAssignment": true
        },
        "createdAt": "date-time",
        "updatedAt": "date-time"
      }
    }
  • Example (cURL):

    curl -X POST "${APP_BASE_URL}/api/rpc" \
      -H "Content-Type: application/json" \
      -d '{
        "method": "TicketRpc.update",
        "params": {
          "_id": "65f0c9d8a3b2f4e1c9d12345",
          "status": "open",
          "assigneeId": "65f0c9d8a3b2f4e1c9abcd12"
        }
      }'

POST /api/rpc (Method: TicketRpc.getData)

  • Description: Retrieves a list of tickets.

  • Request Body:

    {
      "method": "TicketRpc.getData",
      "params": {
        "filter": {},
        "sort": {},
        "page": 1,
        "pageSize": 25
      }
    }
  • Parameters:

    Name Type Required Description
    filter Object No Optional MongoDB-style filter object. The schema accepts an open object.
    sort Object No Optional MongoDB-style sort object. The schema accepts an open object.
    page Number No Page number, starting at 1. Defaults to 1.
    pageSize Number No Number of records per page. Defaults to 25.
  • Response:

    {
      "success": true,
      "data": {
        "data": [
          {
            "_id": "string",
            "subscriptionId": "string",
            "ticketNumber": 1001,
            "subject": "string",
            "status": "new",
            "priority": "normal",
            "contactId": "string",
            "assigneeId": "string|null",
            "linkedConversationIds": [],
            "autoResponseConfig": {
              "onStatusChange": true,
              "onAssignment": true
            },
            "createdAt": "date-time",
            "updatedAt": "date-time"
          }
        ],
        "totalCount": 0
      }
    }
  • Example (cURL):

    curl -X POST "${APP_BASE_URL}/api/rpc" \
      -H "Content-Type: application/json" \
      -d '{
        "method": "TicketRpc.getData",
        "params": {
          "filter": { "status": "open" },
          "sort": { "updatedAt": -1 },
          "page": 1,
          "pageSize": 25
        }
      }'

POST /api/rpc (Method: TicketRpc.findById)

  • Description: Retrieves a single ticket by its ID.

  • Request Body:

    {
      "method": "TicketRpc.findById",
      "params": {
        "_id": "string"
      }
    }
  • Parameters:

    Name Type Required Description
    _id String Yes Ticket identifier to look up.
  • Response:

    {
      "success": true,
      "data": {
        "_id": "string",
        "subscriptionId": "string",
        "ticketNumber": 1001,
        "subject": "string",
        "status": "new",
        "priority": "normal",
        "contactId": "string",
        "assigneeId": "string|null",
        "linkedConversationIds": [],
        "autoResponseConfig": {
          "onStatusChange": true,
          "onAssignment": true
        },
        "createdAt": "date-time",
        "updatedAt": "date-time"
      }
    }
  • Example (cURL):

    curl -X POST "${APP_BASE_URL}/api/rpc" \
      -H "Content-Type: application/json" \
      -d '{
        "method": "TicketRpc.findById",
        "params": {
          "_id": "65f0c9d8a