Customers
  • 13 May 2024
  • 8 Minutes to read
  • Contributors
  • Dark
    Light

Customers

  • Dark
    Light

Article summary

This section describes how to provide Customer data to Wasabi.

Customer Import Schema

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "object",
  "properties": {
    "eventType": {
      "type": "string"
    },
    "eventAction": {
      "type": "string",
      "enum": [
        "CREATED",
        "UPDATED"      
      ]
    },
    "version": {
      "type": "number"
    },
    "body": {
      "type": "object",
      "properties": {
        "customerId": {
          "type": "string"
        },
        "dateOfBirth": {
          "type": "string",
          "format": "date",
          "optional": true
        },
        "status": {
          "type": "string",
          "enum": [
            "ACTIVE",
            "DELETED"
          ],
          "optional": true
        },
        "marketingOptIn": {
          "type": "boolean",
          "optional": true
        },
        "smsOptIn": {
          "type": "boolean",
          "optional": true
        },
        "dependents": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "dependentId": {
                "type": "string"
              },
              "dateOfBirth": {
                "type": "string",
                "format": "date"
              },
              "type": {
                "type": "string"
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "optional": true
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time",
                "optional": true
              }
            },
            "required": [
              "dependentId",
              "dateOfBirth",
              "type"
            ]
          },
          "optional": true
        },
        "addresses": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "addressId": {
                "type": "string"
              },
              "line1": {
                "type": "string"
              },
              "line2": {
                "type": "string",
                "optional": true
              },
              "city": {
                "type": "string"
              },
              "province": {
                "type": "string",
                "optional": true
              },
              "zipCode": {
                "type": "string"
              },
              "countryCode": {
                "type": "string"
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "optional": true
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time",
                "optional": true
              }
            },
            "required": [
              "addressId",
              "line1",
              "city",
              "zipCode",
              "countryCode"
            ]
          }
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time"
        }
      },
      "required": [
        "customerId",
        "addresses",
        "createdAt",
        "updatedAt"
      ]
    }
  },
  "required": [
    "eventType",
    "eventAction",
    "version",
    "body"
  ]
}

Field Descriptions

  • eventType: Specifies the event category. For this schema, the event type is CUSTOMER, indicating the record belongs to a customer and their characteristics.

  • eventAction: Indicates the particular action that was executed on the customer record. Allowed values are CREATED and UPDATED.

  • version: Denotes the schema version in use, facilitating tracking of updates or changes. Current schema version: 1.0.

  • body: Acts as a container for the detailed event data, encapsulating all related customer information within this event.

    • customerId: A unique identifier assigned to the customer, ensuring the distinct recognition of each customer within the system.

    • dateOfBirth [optional]: Records the birth date of the customer. This field is optional and can be used to provide additional personal information about the customer. It should be in the YYYY-MM-DD format, which represents the year, month, and day without time information.

    • status [optional]: Describes the current status of the customer's account . The options for customer status is ACTIVE, indicating ongoing engagement; DELETED, signifying a terminated account.

    • marketingOptIn [optional]: A boolean flag indicating whether the customer has agreed to receive marketing communications. This field is optional and respects customer preferences regarding promotional content.

    • smsOptIn [optional]: A boolean flag that shows whether the customer has consented to receive communications via SMS. Like the marketing opt-in, this field is optional and caters to customer preferences on communication channels.

    • dependents [optional]: An array that lists objects detailing information about the customer's dependents. This field is optional and allows for the inclusion of dependent data such as children or pets.

      • dependentId: A distinct identifier for each dependent, ensuring their unique identification within the system.

      • dateOfBirth: Specifies the birth date of the dependent. This information is optional and can provide insight into the age-related aspects of the dependent. It should be in the YYYY-MM-DD format, which represents the year, month, and day without time information.

      • type: Categorises the nature of the dependent relationship, such as child, pet (e.g., "cat"), or other forms of dependency.

      • createdAt [optional]: Marks the timestamp when the dependent's record was initially created. If not provided, it's assumed to be the same as the parent record's creation timestamp. This should formatted as date-time, in ISO 8601 format.

      • updatedAt [optional]: Indicates the last timestamp when the dependent's record was updated. If absent, the parent record's update timestamp is assumed. This should formatted as date-time, in ISO 8601 format.

    • addresses: Incorporates an array of objects that contain detailed address information for the customer.

      • addressId: Serves as a unique identifier for each address linked to the customer.

      • line1: The primary street address or equivalent primary residence identifier.

      • line2 [optional]: Optional additional address information, such as apartment or suite number, complementing the primary address line.

      • city: The city or locality part of the address.

      • province [optional]: The state, province, or regional component of the address, optional for regions where such differentiation is applicable.

      • zipCode: The postal or ZIP code of the address.

      • countryCode: A standardised country code representation, identifying the country of the address, conforming to the ISO 3166-1 alpha-2 code standard.

      • createdAt [optional]: The creation timestamp of the address record. If not provided, it defaults to the creation timestamp of the parent customer record. This should be formatted as date-time, in ISO 8601 format.

      • updatedAt [optional]: The last update timestamp of the address record. In its absence, the parent customer record's last update timestamp is utilised. This should formatted as date-time, in ISO 8601 format.

  • createdAt: The date and time when the customer's record was originally created, providing a temporal marker for the initiation of the customer's data record, formatted as date-time, in ISO 8601 format.

  • updatedAt: Marks the date and time when the customer's record was most recently updated, reflecting the latest changes or confirmations to the customer's information, formatted as date-time, in ISO 8601 format.

Example

{
  "eventType":         "CUSTOMER",
  "eventAction":       "CREATED",
  "version":           1.0,
  "body": {
    "customerId":      "123456789",
    "dateOfBirth":     "1998-02-01",
    "status":          "ACTIVE",
    "marketingOptIn":  true,
    "smsOptIn":        false,
    "dependents": [
      {
        "dependentId": "123456789",
        "dateOfBirth": "2024-01-01",
        "type":        "cat",
        "createdAt":   "2023-08-15T02:44:23.688Z",
        "updatedAt":   "2023-08-15T02:44:23.688Z"
      }
    ],
    "addresses": [
      {
        "addressId":   "987654321",
        "line1":       "42B Baker Street",
        "line2":       "Manchester-on-Thames",
        "city":        "London",
        "province":    "Some Borough",
        "zipCode":     "BB2H123",
        "countryCode": "GB",
        "createdAt":   "2023-08-15T02:44:23.688Z",
        "updatedAt":   "2023-08-15T02:44:23.688Z"
      }
    ],
    "createdAt":       "2023-08-15T02:44:23.688Z",
    "updatedAt":       "2023-08-15T02:44:23.688Z"
  }
}


Was this article helpful?