Enneo

Events & Webhooks

Example: Data Export for Reporting

Transmission of data to a reporting system as an example

Scenario

Assume there is a reporting system where the status information for the tickets from Enneo should be displayed. The third-party system has a technical interface (API) where this 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.

Possible Solution

Every ticket status change triggers a "TicketUpdated" event. To configure this process, go to Settings -> Integration Into Miscellaneous Systems -> Events and create a new event hook by selecting the "TicketUpdated" event. Configuration can begin afterwards.

Viewing Data in the Event

The data provided in the event can be viewed on one of the tickets. Here is an example of the data:

{
  "userId": 123,
  "changes": {
    "status": "closed"
  },
  "ticketId": 456
}

In this case, the ticket with ID 456 was closed by the user with ID 123.

Example of Customer-Specific Code

If the data provided in the event is not sufficient, further data can be loaded using the Enneo SDK in the customer-specific code.

Configured input parameters are loaded by Enneo and are available in the Input variable. A valid JSON_object is expected as output, which will be displayed in the technical details of the activity log on the ticket after execution.

Info

In this code example, error handling is deliberately omitted for clarity.

<?php

use 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;

// Calling the third-party system with the 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);
TBD