Daten welche Enneo an ihren Code übergibt (Input)
Kopieren
KI fragen
{
"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
}
Datenstruktur welche Enneo als Rückgabewert erwartet (Output)
Kopieren
KI fragen
[
{
"id": "100020" // customer id (not contract id) of 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.
}
]
Beispielimplementierung
- PHP
Kopieren
KI fragen
<?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 you are free to support any search term your agents might prefer
// 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 get both the customer and all corresponding contracts based on the IDs you returned using the code you described above
echo json_encode($searchResults);