The Enneo SDK offers a comprehensive collection of tools that facilitate the development of specific code for customer-specific solutions in the field of AI-supported customer support. The SDK supports the implementation of rule-based logic for AI agents, event-based integrations, custom webhooks and user-defined functions. The SDK is automatically loaded and the functions are directly available.

Integration of the SDK in Code

To integrate the Enneo SDK into your code, the following code snippet can be used:

<?php

require(getenv()['SDK'] ?? 'sdk.php');

Enneo API Wrapper

The Enneo SDK provides wrappers for the Enneo API endpoints, which allow convenient access to the API:

  • Loading of contract data using the contract ID

  • Loading ticket data using the ticket ID

  • Execution of user-defined functions

  • Invocation of any Enneo API endpoints (GET | POST | PATCH | PUT | DELETE)

    <?php
    
    use EnneoSDK\ApiEnneo;
    
    require(getenv()['SDK'] ?? 'sdk.php');
    
    /**
     * Loads the contract data for the contract with the ID 123
     */
    $contract = ApiEnneo::getContract(contractId: 123);
    
    /**
     * Loads ticket data for the ticket with the ID 456
     */
    $ticket = ApiEnneo::getTicket(ticketId: 456);
    
    /**
     * Executes the user-defined function 'user-defined-function'.
     * (see documentation of user-defined functions)
     * Entered parameters are passed to the user-defined function
     * and can be loaded there using \EnneoSDK\Input::load().
     */
    $response = ApiEnneo::executeUdf(
        name: 'user-defined-function',
        parameters: [
            'method' => 'POST',
            'api' => 'redirect',
            'params' => $payload
        ]
    );
    
    
    ##########################################################################
    ## The methods get | post | patch | put | delete can be used,
    ## to call any Enneo API endpoints
    ## (see API documentation)
    ##########################################################################
    
    /**
     * Load the profile of the currently logged in user
     */
    $profile = ApiEnneo::get(endpoint: '/api/mind/profile');
    
    /**
     * OCR meter reading recognition for given ticket ID and URL to ticket attachment
     */
    $response = ApiEnneo::post(
        endpoint: '/api/cortex/ocrMeter',
        body: [
            'ticketId' => $ticketId,
            'fileUrl' => $_ENV['ENNEO_API_URL'] . $attachment->url,
        ]
    );
    
    /**
     * Close ticket
     */
    $response = ApiEnneo::patch(
        endpoint: '/api/mind/ticket/' . $ticketId,
        body: ['status' => 'closed']
    );
    

Calling Custom Functions

Custom functions in the code are called using executeUdf:

<?php

// Load Enneo SDK
require(getenv()['SDK']);

// Prepare payload for the API call of the third-party system
$payload = [
    'ticket-id' => 123,
    'key' => 'value'
];

// Call the custom function "third-party-api-call"
// this function takes an object as an input parameter:
// [
//      'method' => 'POST',
//      'api' => 'item',
//      'params' => [
//          'ticket-id' => 123,
//           'key' => 'value'
//      ]
// ]
EnneoSDK\ApiEnneo::executeUdf(
    'third-party-api-call',
    ['method' => 'POST', 'api' => 'item', 'params' => $payload]
);