Assume there is a reporting system in which the status information for the tickets from Enneo should be displayed. The third-party system has a technical interface (API) through which the information about the tickets can be transmitted. The third-party system requires the sender of the ticket and the status of the ticket as input parameters when calling the interface.
Every status change of a ticket triggers a “TicketUpdated” event. To configure this process, go to Settings -> Integration into Peripheral Systems -> Events and create a new event hook by selecting the “TicketUpdated” event. Then the configuration can begin.
If the data available in the event is not sufficient, additional data can be loaded in the customer-specific code using the Enneo SDK.Configured input parameters will be loaded by Enneo and will be available in the input variable. As output, a valid JSON object is expected, which will be displayed in the technical details of the activity log on the ticket after execution.
Error handling is deliberately omitted in this code example for clarity.
Copy
Ask AI
<?phpuse EnneoSDK\Api;use EnneoSDK\ApiEnneo;require(getenv()['SDK'] ?? 'sdk.php');/** @var stdClass $in - contains all defined input parameters from the event */// Loading the necessary data from enneo$ticket = ApiEnneo::getTicket($in['ticketId']);$sender = $ticket->sender;// Call of the third-party system with necessary parameters$result = Api::call( method: 'POST', url: 'https://third-party-system/api/ticket-status-update', headers: [ 'x-api-key: tokenExampleHere', 'Accept: application/json' ], params: [ 'ticketSender' => $sender, 'ticketStatus' => $in['status'] ]);echo json_encode($result);