Skip to main content

Data that Enneo passes 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 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 are used by Enneo's AI and customer identification logic. Default to null if not set
    "firstname": "John", // first name of customer, it can be null
    "email": "[email protected]",
    "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",

    // Any other properties that Enneo should be aware of can be defined here.
    // See below some examples as inspiration from the energy sector
    "salutation": "Mrs."
}

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 provides the option to have different data
// Example is a holding at the customer level, but subsidiaries with different legal entities at the 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 company or private person
'lastname' => $customerRawData->processedData->lastname, // last name of customer, it can be null ONLY if business is true
'company' => $customerRawData->processedData->company, // company name, e.g. "ACME Corp.", it 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, // first name of customer, it 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,
];

// Any 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);