The data Enneo passes to your code (Input)
Copy
Ask AI
{
"q": "John Smith", // this is the value the user typed into the search field
"limit": 10, // in case of pagination, not currently used
"offset": 0 // in case of pagination, not currently used
}
The data structure which Enneo expects as a return value (Output)
Copy
Ask AI
[
{
"id": "100020" // customer id (not contract id) of the first contract that was found
},
{
"id": "200001" // second id
},
{
"id": "200002" // third id
},
{
"id": "200003" // n-th id. Enneo accepts up to 10 search results, any additional results will be ignored.
}
]
Example implementation
- PHP
Copy
Ask AI
<?php
// Load enneo SDK. Input is made available through $in
use EnneoSDK\ApiEnneo;
use EnneoSDK\Setting;
use EnneoSDK\Api;
require(getenv()['SDK']);
// The variable $in->q is made available to you. It is the search term provided by the agent when he types in a query in the top-right search form
// Usually agents search for:
// - contract IDs
// - customer IDs
// - E-Mail addresses
// - Names
// But any search term that agents might prefer can be supported.
// Then return the matching customers (not contracts!) in this data structure
$customerRawData = Api::call(method: 'GET', url: 'https://admin.enneo.ai/api/seed-customers/search?' . http_build_query($in));
$searchResults = array_map(function($item) {
return [
'id' => $item, // e.g. "123"
];
}, $customerRawData);
// Enneo will then retrieve both the customer and all corresponding contracts based on the IDs returned using the code described above
echo json_encode($searchResults);