Skip to content

Ticket Actor Messages

A Ticket message is a method that modifies instances of a Ticket type. To message a Ticket, send a POST request with a valid JSON body to the path /resources/actors/custom/ticket/<TICKET ID>. {ticketId} is new when creating a new instance.

Valid messages for Ticket actors include:

applyCommandsApplies a list of commands to a Ticket. You can send in several commands in one request for [batch processing](/resources/actors/#:~:text=Commands%20are%20always%20processed). However, if one command fails, the entire message fails.
completeCompletes a ticket
createCreates a new Ticket.
queryQueries the ticket from the graph.
rejectCloses a Ticket and marks it as `rejected`. It also updates its `closedAt` property.

Every message response contains a Ticket's access URIs, which include:

  • Default GUID
  • Ticket Number
  • External Reference, if available

Therefore, you can also message a Ticket with its ticketNumber and externalReference using /resources/actors/custom/ticket/{ticketType}/<TICKET NUMBER OR EXTERNAL REFERENCE>

In addition, Ticket actors support previewing messages and sending multiple messages at once.

A general template for sending a Ticket message is:

json
[{
    "type": "<MESSAGE TYPE>",
    "body": {

    }
}]

Ensure you send a valid JSON body and use the correct access URI to avoid common errors.

Example: Create an Item and Tag on a new Ticket

Create an Item and Tag on a new Ticket In this example, we will apply multiple messages at once to an Exchange Ticket. The goal is to: 1. Create a new Ticket 2. Create an Exchange Item for it 3. Add a `newTicket` tag to the ticket **Request**
```json [ { "type": "create", "body": { "typeKey": "return", "externalReference": "return8" } }, { "type": "applyCommands", "body": { "commands": [ { "type": "createItem", "itemTypeKey": "exchange", "dynamic": { "message": "exchange this product" } }, { "type": "addTag", "key": "newTicket" } ] } } ] ```
**Response** ``` HTTP/1.1 200 OK --- { "paths": [ "resources/actors/custom/ticket/0199aa3f-31d0-7dd8-bf32-3a5fd3fd2627", "resources/actors/custom/ticket/return/RE100015", "resources/actors/custom/ticket/return/return8" ], "data": { "create": "OK", "applyCommands": "OK" } } ```

© 2024 Hantera AB. All rights reserved.