Kustomer.describeCustomer()

Update information about a customer in Kustomer.

👍

First, initialize chat fully

Kustomer Chat must finish initializing fully with Kustomer.start() before you can execute any additional Web SDK methods.

Tip: Call other methods inside the callback of Kustomer.start() to ensure Kustomer Chat always completes initialization before the code tries to run other methods.

To learn more, see Troubleshooting: Kustomer method calls won't execute.

🚧

Order matters logging in

If you also use Kustomer.login(), make sure that your Kustomer.describeCustomer call happens in the callback of Kustomer.login(). This ensures that you wait for the customer to successfully login before updating that customer.

Examples

We're provided some examples of how you can call Kustomer.describeCustomer():

// Update custom attributes of the customer

Kustomer.describeCustomer({
  attributes: {
    sharedEmails: ['[email protected]']
  }
});

Kustomer.describeCustomer({
  attributes: {
    sharedEmails: ['[email protected]'],
    sharedPhones: ['5555555555'],
    sharedSocials: [{
      username: 'facebook_username',
      type: 'facebook
    }]
  }
});

// Update custom attributes of the customer and run a callback after

Kustomer.describeCustomer({
  customAttributes: {
    some_custom_attribute: 'some custom value'
  }
}, function (callbackResponse, error) {
  if (!error) {
    console.log('Updated information about the customer');
  }
});

Syntax

Kustomer.describeCustomer(options, function(callbackResponse, error))
ParameterTypeDescription
optionsObjectRequired

An object containing all of the properties you want to update on the customer inside Kustomer. A breakdown of the options object is listed below.
function(callbackResponse, error)FunctionOptional

A callback that is run after Kustomer.describeCustomer() completes.

callbackResponse is an object returned to the callback function. See the callbackResponse section below to see the properties of the object.

error is either undefined or a native JavaScript Error object.

🚧

Note: emails, phones, socials have been deprecated

emails, phones, and socials have been deprecated in favor of sharedEmails, sharedPhones, and sharedSocials for better transparency to the fields they update on the Customer.

options

{
  attributes: {
    sharedEmails: ['[email protected]', '[email protected]'],
    sharedPhones: ['5555555555', '8888888888'],
    sharedSocials: [
      {
        username: 'facebook_username',
        type: 'facebook'
      },
      {
        username: 'twitter_username',
        type: 'twitter'
      }
    ],
    // emails, phones, socials are deprecated in favor of shared
    emails: ['[email protected]', '[email protected]'],
    phones: ['5555555555', '8888888888'],
    socials: [
      {
        username: 'facebook_username',
        type: 'facebook'
      },
      {
        username: 'twitter_username',
        type: 'twitter'
      }
    ]
  },
  customAttributes: {
    some_custom_attribute: 'some_custom_value',
    some_custom_attribute2: 'some_custom_value2'
  }
}

📘

customAttributes

Before you can update a custom attribute with Kustomer.describeCustomer(), the custom attribute must first exist on the Customer Klass in your Kustomer organization.

You can learn more about Klasses and custom attributes in the Kustomer Help Center.

PropertyTypeDescription
attributesObjectOptional

An object containing the attributes of a customer. We allow describing emails, phones, or socials. See above for an example payload.
customAttributesObjectOptional

An object containing the custom attributes of the customer

callbackResponse

PropertyTypeDescription
sharedPhonesArrayRequired

An array of phone number strings.
sharedEmailsArrayRequired

An array of email address strings.
sharedSocialsArrayRequired

An array of objects describing the social media accounts connected to the customer.
customerIdStringRequired

The customer's unique ID in Kustomer's database.
customObjectOptional

An object containing the custom attributes of the customer.

{ some_custom_attribute: 'some_custom_value' }