Kundenerkennung
Suche nach Kundennummer
Datenstruktur
Daten welche enneo an ihren Code übergibt (Input)
{
"customerId": "C-abcd-123"
}Datenstruktur welche enneo als Rückgabewert erwartet (Output)
{
// Mandatory properties. Must be defined or enneo to work
"id": "C-abcd-123", // must be integer or string up to 50 chars
"business": false, // boolean, if the customer is a company or private person
"lastname": "Smith", // last name of customer, 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 is used by enneo's AI and customer identification logic. Default to null if not set
"firstname": "John", // first name of customer, can be null
"email": "john@smith.com",
"deliveryAddress": "Horst-Kohl-Str. 15a, 12157 Berlin", // address of customer
"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
// You may define any other properties you want enneo to be aware of here.
// See below some examples as inspiration from the energy sector
"salutation": "Mrs."
}Anmerkungen:
- Falls der Kunde nicht existiert, geben Sie
nullzurück (ein leeres Objekt{}oder ein leeres Array[]werden identisch behandelt). Enneo behandelt den Kunden dann als „nicht gefunden“ und meldet keinen Fehler. languageCodeist optional (zwei Zeichen oder regionale Variante mit fünf Zeichen). Die Inhaltsübersetzung nutzt es als Fallback, wenn die Ticketsprache noch nicht erkannt ist.
Beispielimplementierung
<?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 or 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 company or private person
'lastname' => $customerRawData->processedData->lastname, // last name of customer, 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 contract 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 is used by enneo's AI and customer identification logic. Default to null if not set
'firstname' => $customerRawData->processedData->firstname, // first name of customer, can be null
'email' => $customerRawData->processedData->email,
'deliveryAddress' => $customerRawData->processedData->deliveryAddress, // address of customer
'billingAddress' => $customerRawData->processedData->billingAddress, // Optional separate billing address. If null, then billing address is the same as delivery address
'phone' => $customerRawData->processedData->phone,
];
// You may define any other properties you want enneo to be aware of here.
$customer = [
...$customer,
...array_diff_key((array) $customerRawData->processedData, $customer)
];
echo json_encode($customer);