Customer data

Pass customer details and your own attributes to the conversation.

You can pass details about the customer, such as their name, email or locale, and your own attributes, such as a customer tier or an order number. Conversation SDK saves them with the conversation, so your processes can use them.

There are two ways to pass customer data:

  • Metadata: set in code on your website or in your app. Use it for any data.
  • JWT claims: signed by your backend. Use them for data you need to trust, such as the identity of a logged-in customer. See Authentication.

Metadata

FieldTypeDescription
firstNamestringCustomer's first name.
lastNamestringCustomer's last name.
namestringCustomer's full name.
emailstringCustomer's email address.
phoneNumberstringCustomer's phone number.
localestringCustomer's locale, for example en-US. It also selects the region, see Locale and region.
timezonestringCustomer's timezone in IANA format, for example Europe/Warsaw.
extraParamsRecord<string, string>Your own attributes as key-value pairs.

All fields are optional.

Pass metadata on the website

Pass metadata when you load the Widget or Embedded:

ZowieWidget.init("<your-instance-id>", {
  metadata: {
    firstName: "Ada",
    email: "[email protected]",
    locale: "en-US",
    extraParams: {
      tier: "vip",
      orderNumber: "ORD-1042",
    },
  },
});

To change the data later, for example after the customer logs in, call updateMetadata:

ZowieWidget.updateMetadata({
  firstName: "Ada",
  email: "[email protected]",
  extraParams: { tier: "vip" },
});

For Embedded, use ZowieEmbedded.init and ZowieEmbedded.updateMetadata in the same way.

When you don't pass locale or timezone, the Widget and Embedded detect them from the page and the customer's browser.

Pass metadata in mobile apps

All mobile SDKs accept the same fields in the metadata configuration option, and update them with updateMetadata on the chat controller. See the documentation of your SDK in Mobile.

Locale and region

If your AI Agent has more than one region, the customer's locale decides which region's configuration they see:

  1. Conversation SDK looks for a region with the language of the locale, for example de in de-AT.
  2. If several regions use that language, it picks the one that includes the country of the locale, for example AT.
  3. If no region matches, or the matching region is turned off, the customer sees the default region.

Set locale in metadata when you know the customer's language better than the browser does, for example from their account settings.

Use customer data in processes

In a Script Block or a condition of your process, read customer data with crm.getUser(). Attributes from extraParams are available as fields with the same name:

const user = crm.getUser();
user && user.tier === "vip";

You can also use your own attributes in the display conditions of the Widget, with the Custom parameter.


Did this page help you?