Enneo

AI Agents & Automation

SDK

Enneo SDK - Documentation

The Enneo SDK offers a comprehensive collection of tools facilitating 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 loaded automatically, and the functions are directly available.

Integration of the SDK into Code

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

<?php

require(getenv()['SDK'] ?? 'sdk.php');
file_path = os.getenv('SDK', 'sdk.py')
spec = importlib.util.spec_from_file_location('sdk', file_path)
sdk = importlib.util.module_from_spec(spec)
spec.loader.exec_module(sdk)

Enneo API Wrapper

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

  • Loading contract data based on the contract ID
  • Loading ticket data based on the ticket ID
  • Execution of user-defined functions
  • Invocation of any Enneo API endpoints (GET | POST | PATCH | PUT | DELETE)
  • Reading secrets (getSecret)
  • Loading files from Enneo storage (getFileFromStorage, in Python get_file_from_storage)

By default, API calls run on behalf of the user who started the script, with that user's permissions. With the optional parameter authorizeAs: 'serviceWorker' they run with the service worker's permissions instead. This also determines who the work is attributed to in time tracking and reporting.

<?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 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 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']
);
# Loads the contract data for the contract with ID 123
contract = sdk.ApiEnneo.get_contract(123)

# Loads ticket data for the ticket with ID 456
ticket = sdk.ApiEnneo.get_ticket(456)

# Executes the user-defined function 'user-defined-function'
response = sdk.ApiEnneo.executeUdf(
    'user-defined-function',
    {'method': 'POST', 'api': 'redirect', 'params': payload}
)

# Load profile of the currently logged in user
profile = sdk.ApiEnneo.get('/api/mind/profile')

# Close ticket
response = sdk.ApiEnneo.patch(f'/api/mind/ticket/{ticket_id}', {'status': 'closed'})

SDK building blocks

Building blockPurpose
InputLoad the script's input data (Input::load(), in Python load_input_data()); check whether a chatbot or voicebot is currently handling the conversation (isBotConversation)
ApiEnneoCall the Enneo API (see above)
ApiCall external interfaces via HTTP
SettingRead and write settings
Interaction, IntentInfo, IntentOption, FormBuild the output of a rule-based AI agent: hints, form fields and buttons
NotificationShow an operator a message (see below)
HelpersHelper functions, e.g. formatting a date or formatting and validating an IBAN
AppInfo, AppStorageInformation about your own app and its data storage – see Develop apps

Showing a message to an operator

With Notification.send your code – an event hook, for example – can show an operator a message right on their screen, as a card in the top-right corner. Use it for hints about a changed process, for errors, or for results, exactly where the work is happening.

The message goes straight to the operator's open tabs and is not stored: if they are offline or reload the page, they do not see it later, and it does not appear in the notification bell.

ParameterDefaultMeaning
userId–ID of the operator to show the message to
body–Text of the message, up to 2000 characters
severityinfosuccess, info, warning or error – sets the colour and icon
actionUrl–A path inside Enneo, e.g. /tickets/123, offered as a button. Links to other sites are refused
duration0Whole seconds before the card closes itself, up to 3600; 0 keeps it until it is closed
key–A stable name for the message – letters A–Z without accents, digits and _ . : -, up to 100 characters. Sending it again replaces the card instead of showing a second one
showDontShowAgainfalseOffers "Don't show again", remembered per operator in their browser. Only works together with key; to show a hidden message again, use a new key
allowHtmlfalseRenders body as HTML or Markdown: bold, italic, lists, code and links. Without it, the text is shown as is, tags included

In Python the parameters are called user_id, action_url, show_dont_show_again and allow_html; in Node.js the optional parameters are passed as an object.

By default an operator gets at most 10 messages a minute, from all hooks together, hidden ones included. send throws an error when the message is refused: a field is invalid, the limit is reached, or the code does not run in the Enneo sandbox – a local run of your script always gets this error. If the message is not essential, catch the error so the hook carries on. In the response, roomInfo.hasReceivers says whether the operator had Enneo open, not whether they saw the card.

Warning

Use allowHtml only with your own fixed text. Ticket and customer data – subject, name, message text – come from outside and can contain HTML themselves. Never put them into an HTML message. Only formatting and links are kept; what the message says is up to your code. Links to other sites open in a new tab; a path inside Enneo belongs in actionUrl.

<?php

use EnneoSDK\Notification;

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

Notification::send(
    userId: $userId,
    body: 'Please assign the AI agent instead of the tag – the tag is added automatically.',
    severity: 'warning',
    key: 'assign-agent-not-tag',
    showDontShowAgain: true,
);
sdk.Notification.send(
    user_id,
    'Please assign the AI agent instead of the tag – the tag is added automatically.',
    severity='warning',
    key='assign-agent-not-tag',
    show_dont_show_again=True,
)
const { Notification } = require(process.env.SDK || 'sdk.js');

(async () => {
  await Notification.send(userId, 'Please assign the AI agent instead of the tag – the tag is added automatically.', {
    severity: 'warning',
    key: 'assign-agent-not-tag',
    showDontShowAgain: true,
  });
})();

Invoking Custom Functions

Custom functions are invoked in the code 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'
];

// Invocation of the custom function "third-party-api-call"
// this function receives 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]
);

SDK Code

The SDKs are available at:

The above URLs work without authorization, meaning they can be directly incorporated into your scripts.