Customer Recognition
Search by Customer Number
Data Structure
Data which Enneo provides to your code (Input)
{
"customerId": "C-abcd-123"
}Data structure that Enneo expects as a return value (Output)
{
// Mandatory properties. Must be defined for Enneo to work
"id": "C-abcd-123", // must be integer or string up to 50 chars
"business": false, // boolean, if the customer is a business or an individual
"lastname": "Smith", // customer's lastname, can be null ONLY if business is true
"company": null, // company name, e.g. "ACME Corp.", can be null ONLY if business is false
"contractIds": ["VN-00001", "VN-00002"], // array of contracts this customer has. Must be at least one contract (otherwise it's not a "customer")
// Recommended properties. Should be defined if possible and are used by Enneo's AI and customer identification logic. Default to null if not set
"firstname": "John", // customer's firstname, can be null
"email": "john@smith.com",
"deliveryAddress": "Horst-Kohl-Str. 15a, 12157 Berlin", // customer's address
"billingAddress": null, // Optional separate billing address. If null, then billing address is the same as delivery address
"phone": "+49190332332",
"languageCode": "de", // two-letter (de, en, fr, tr) or regional (de-CH). Fallback for content translation when the ticket language is not yet known
// Other properties that Enneo should be aware of can be defined here.
// See below for some examples as inspiration from the energy sector
"salutation": "Mrs."
}Notes:
- If the customer does not exist, return
null(an empty object{}or an empty array[]are treated identically). Enneo then treats the customer as "not found" and does not report an error. languageCodeis optional (two letters, or a five-character regional variant). Content translation uses it as a fallback when the ticket language is not yet known.
Sample Implementation
<?php
// Load Enneo SDK. Input is made available through $in
use EnneoSDK\ApiEnneo;
use EnneoSDK\Setting;
use EnneoSDK\Api;
require(getenv()['SDK']);
// Note: Customer data properties are largely the same as contract properties. In regular cases, they should be identical, but Enneo gives you the option to have different data
// Example is a Holding on customer level, but subsidiaries with different legal entities on contract level
// Insert your API-Calls here, as described in the previous section
$customerRawData = Api::call(method: 'GET', url: 'https://admin.enneo.ai/api/seed-customers/' . $in->customerId);
$customer = [
// Mandatory properties. Must be defined for Enneo to work
'id' => $in->customerId, // must be integer or string up to 50 chars
'business' => $customerRawData->processedData->business, // boolean, if the customer is a business or an individual
'lastname' => $customerRawData->processedData->lastname, // customer's lastname, can be null ONLY if business is true
'company' => $customerRawData->processedData->company, // company name, e.g. "ACME Corp.", can be null ONLY if business is false
'contractIds' => $customerRawData->processedData->contractIds, // array of contracts this customer has. Must be at least one contract (otherwise it's not a "customer") e.g. ['VN-00001','VN-00002']
// Recommended properties. Should be defined if possible and are used by Enneo's AI and customer identification logic. Default to null if not set
'firstname' => $customerRawData->processedData->firstname, // customer's firstname, can be null
'email' => $customerRawData->processedData->email,
'deliveryAddress' => $customerRawData->processedData->deliveryAddress, // customer's address
'billingAddress' => $customerRawData->processedData->billingAddress, // Optional separate billing address. If null, then billing address is the same as delivery address
'phone' => $customerRawData->processedData->phone,
];
// Other properties that Enneo should be aware of can be defined here.
$customer = [
...$customer,
...array_diff_key((array) $customerRawData->processedData, $customer)
];
echo json_encode($customer);