Support integrations

Get ticket messages

getTicketMessages()

This will return all tickets sorted by the last changed date. hostware uses this information to check if any tickets have new admin answers, which are then imported using another function (TODO).

Parameters

Type

Name

Description

mixed

ticketId

The ID of the ticked. The same you provided in getTickets()

Response

Collection of TicketMessageResponse() classes. Each class resembles a ticket message contains the following attributes:

Type

Name

Description

mixed

messageId

The ID of the ticked. Usually integer or UUID.

string

message

The message of the ticket. You can pass the raw message, no parsing necessary.

Carbon

createdAt

Int or Null

adminId

The id of the hostware (!) admin. You have to search the admin in the database. For other integrations, they are searched by email.

Collection

attachments

Collection of TicketMessageAttachmentResponse(). See below

TicketMessageAttachmentResponse()

This contains an array of all attachments which are attached to a given message. This contains the name, size and url to download the file. Usually, each ticket provider returns this information in the api response.

Type

Name

Description

mixed

id

The ID of the attachment.

string

name

The file name.

int

Size

The size in bytes of the file.

String or Null

url

The download url of the attachment files.

Example Code

Testing

You can test this function when executing the console command from Get tickets.

The console command gets all the tickets. If the $lastChangedAt parameter from the ticket is different than saved in the hostware database, the getTicketMessages() is executed. You can manipulate the lastChangedAt to trigger the execution.

The function gets called synchronously, you can dump() and debug as you like.

Was this helpful?