Skip to content

Customer Webhook Notifications ​

v1 Only

This webhook has no v2 version. v1 is the current and only version.

The Customer Updates Webhook from MyLION provides notifications about changes to customer information within the MyLION ERP system. By subscribing to this webhook, you can stay informed about new customer registrations, updated customer profiles, and deleted customer records. This article will explore the payload structure of the webhook notification and how to interpret the data to keep your customer records synchronized with MyLION.

Payload Structure ​

The Customer Updates Webhook sends a single JSON object with three arrays. Each array contains customers of one change type. Every customer object follows the CustomerSyncDTO structure described below.

json
{
  "newCustomers": [
    {
      "id": {
        "myLionId": 1001,
        "externalId": "CUST-0001"
      },
      "legalEntity": true,
      "name": "Example Trading Ltd.",
      "firstName": null,
      "lastName": null,
      "taxNumber": "HU12345678",
      "groupTaxNumber": "HU12345678-1-41",
      "euTaxNumber": "HU12345678",
      "emailAddresses": ["info@example-trading.com"],
      "phoneNumbers": ["+36 1 234 5678"],
      "billingAddress": {
        "countryCode": "HU",
        "city": "Budapest",
        "zipCode": "1051",
        "street": "Example",
        "streetType": "utca",
        "addressNumber": "12",
        "building": "B",
        "floor": "2",
        "door": "5",
        "fullStreetAddress": "Budapest, Example utca 12. B lph. 2/5"
      },
      "postalAddress": {
        "countryCode": "HU",
        "city": "Budapest",
        "zipCode": "1051",
        "street": "Example",
        "streetType": "utca",
        "addressNumber": "12",
        "building": "",
        "floor": "",
        "door": "",
        "fullStreetAddress": "Budapest, Example utca 12."
      },
      "categoryDiscounts": [
        {
          "categoryId": 15,
          "discountPercentage": 10.00
        }
      ],
      "partnerTypes": [
        {
          "myLionId": 3,
          "externalId": "PT_RESELLER"
        }
      ],
      "customerGroup": {
        "myLionId": 7,
        "externalId": "GRP_B2B"
      },
      "contacts": [
        {
          "identifiers": {
            "myLionId": 2001,
            "externalId": "CONT-0001"
          },
          "firstName": "Anna",
          "lastName": "Kovacs",
          "emails": ["anna.kovacs@example-trading.com"],
          "phones": ["+36 30 123 4567"],
          "registeredToNewsletters": true,
          "language": {
            "myLionId": 1,
            "externalId": "hu"
          }
        }
      ]
    }
  ],
  "updatedCustomers": [],
  "deletedCustomers": []
}
{
  "newCustomers": [
    {
      "id": {
        "myLionId": 1001,
        "externalId": "CUST-0001"
      },
      "legalEntity": true,
      "name": "Example Trading Ltd.",
      "firstName": null,
      "lastName": null,
      "taxNumber": "HU12345678",
      "groupTaxNumber": "HU12345678-1-41",
      "euTaxNumber": "HU12345678",
      "emailAddresses": ["info@example-trading.com"],
      "phoneNumbers": ["+36 1 234 5678"],
      "billingAddress": {
        "countryCode": "HU",
        "city": "Budapest",
        "zipCode": "1051",
        "street": "Example",
        "streetType": "utca",
        "addressNumber": "12",
        "building": "B",
        "floor": "2",
        "door": "5",
        "fullStreetAddress": "Budapest, Example utca 12. B lph. 2/5"
      },
      "postalAddress": {
        "countryCode": "HU",
        "city": "Budapest",
        "zipCode": "1051",
        "street": "Example",
        "streetType": "utca",
        "addressNumber": "12",
        "building": "",
        "floor": "",
        "door": "",
        "fullStreetAddress": "Budapest, Example utca 12."
      },
      "categoryDiscounts": [
        {
          "categoryId": 15,
          "discountPercentage": 10.00
        }
      ],
      "partnerTypes": [
        {
          "myLionId": 3,
          "externalId": "PT_RESELLER"
        }
      ],
      "customerGroup": {
        "myLionId": 7,
        "externalId": "GRP_B2B"
      },
      "contacts": [
        {
          "identifiers": {
            "myLionId": 2001,
            "externalId": "CONT-0001"
          },
          "firstName": "Anna",
          "lastName": "Kovacs",
          "emails": ["anna.kovacs@example-trading.com"],
          "phones": ["+36 30 123 4567"],
          "registeredToNewsletters": true,
          "language": {
            "myLionId": 1,
            "externalId": "hu"
          }
        }
      ]
    }
  ],
  "updatedCustomers": [],
  "deletedCustomers": []
}

Top-level fields ​

FieldTypeDescription
newCustomersArray of CustomerSyncDTOCustomers created since the last notification.
updatedCustomersArray of CustomerSyncDTOCustomers changed since the last notification.
deletedCustomersArray of CustomerSyncDTOCustomers deleted since the last notification.

The arrays are always present. An array without changes is empty ([]).

CustomerSyncDTO ​

FieldTypeDescription
idIdDTOIdentifier of the customer in MyLION and in the external system.
legalEntityBooleantrue if the customer is a legal entity (company), false if it is a private person.
nameStringName of the customer. Used for legal entities.
firstNameStringFirst name of the customer. Used for private persons.
lastNameStringLast name of the customer. Used for private persons.
taxNumberStringTax number of the customer.
groupTaxNumberStringGroup tax number of the customer.
euTaxNumberStringEU VAT number of the customer.
emailAddressesArray of StringE-mail addresses of the customer.
phoneNumbersArray of StringPhone numbers of the customer.
billingAddressAddressDTOBilling address of the customer.
postalAddressAddressDTOPostal address of the customer.
categoryDiscountsArray of CategoryDiscountDiscounts granted to the customer per product category.
partnerTypesArray of IdDTOPartner types assigned to the customer.
customerGroupIdDTOCustomer group the customer belongs to.
contactsArray of EmployeeDTOContact persons of the customer.

IdDTO ​

FieldTypeDescription
myLionIdIntegerInternal MyLION identifier.
externalIdStringIdentifier of the record in the external system.

AddressDTO ​

Used by billingAddress and postalAddress.

FieldTypeDescription
countryCodeStringCountry code of the address.
cityStringCity.
zipCodeStringPostal code.
streetStringStreet name.
streetTypeStringStreet type, for example utca or út.
addressNumberStringHouse number.
buildingStringBuilding. Empty if not applicable.
floorStringFloor. Empty if not applicable.
doorStringDoor. Empty if not applicable.
fullStreetAddressStringComplete street address as one string.

CategoryDiscount ​

Used by categoryDiscounts.

FieldTypeDescription
categoryIdIntegerIdentifier of the product category.
discountPercentageDecimalDiscount in percent for this category.

EmployeeDTO ​

Used by contacts.

FieldTypeDescription
identifiersGenericIdentifiersDTOIdentifiers of the contact person (externalId and myLionId).
firstNameStringFirst name of the contact person.
lastNameStringLast name of the contact person.
emailsArray of StringE-mail addresses of the contact person.
phonesArray of StringPhone numbers of the contact person.
registeredToNewslettersBooleantrue if the contact person subscribed to newsletters.
languageIdDTOPreferred language of the contact person.

Receiving and Processing ​

To process the Customer Webhook Notification from MyLION, you need to set up a receiving endpoint in your application. The endpoint URL should follow this format:

bash
https://<your_base_url>/rest/mylion/v1/customers
https://<your_base_url>/rest/mylion/v1/customers

When MyLION sends a webhook notification, it will make a POST request to the specified endpoint with the payload containing the updated customers. The expected response is HTTP OK (200).

Response payload ​

The response should be in the following format:

json
[
  {
    "myLionId": 123,
    "externalId": "EXT_PROD_123"
  }
]
[
  {
    "myLionId": 123,
    "externalId": "EXT_PROD_123"
  }
]
java
@Data
public class MLProductResponseListDTO extends ArrayList<MLProductResponseDTO>{
}

@Data
public class MLProductResponseDTO {
  private Integer myLionId;
  private String externalId;
}
@Data
public class MLProductResponseListDTO extends ArrayList<MLProductResponseDTO>{
}

@Data
public class MLProductResponseDTO {
  private Integer myLionId;
  private String externalId;
}