Data Masking

Support Kustomer's Data Masking features for obfuscating sensitive data using the Cards SDK.

If your organization uses Kustomer's Data Masking feature, agents may be unable to see the contents of some fields if those fields are masked. This masking happens all over the application, including inside Klass Views. If you use <Card /> or <DynamicCard /> to embed the Cards SDK into a Klass View, you may need to handle masked data.

Whenever a field is masked, the code will see an object with this shape instead of the normal value:

{ isMasked: true, maskedPresentation: "********" }

The isMasked boolean lets you know that the field contents are masked, and the maskedPresentation string gives a display representation of that field. Depending on your data masking settings, maskedPresentation might show a partially masked representation of the underlying data, or it might be all asterisks.

Any fields you receive from the Klass View and any data you retrieve using Kustomer.request will be masked if those fields are set to masked in your organization's settings and if the current user doesn't have the permission to view them unmasked.

Exactly what you do in response to masked data will depend on your business goals, and how you do it will depend on what JavaScript libraries you're using. For example, if your card contains a link to some other internal integration in it that depends on the customer's email:

<body>
<a id="integration-link" rel="noopener noreferer">Look up customer on internal system</a>
<script>
Kustomer.initialize(context => {
  const { email } = context.customer.attributes.emails[0];
  document.getElementById("integration-link").setAttribute("href", `https://my-internal-integration.example.com/customer?email=${encodeURIComponent(email)}`);
});
</script>
</body>

You might change that link to disabled if the email is masked:

<body>
<a id="integration-link" rel="noopener noreferer">Look up customer on internal system</a>
<script>
Kustomer.initialize(context => {
  const { email } = context.customer.attributes.emails[0];
  if (email.isMasked) {
    document.getElementById("integration-link").textContent = `Can't access internal integration for ${email.maskedPresentation}`;
  } else {
    document.getElementById("integration-link").setAttribute("href", `https://my-internal-integration.example.com/customer?email=${encodeURIComponent(email)}`);
  }
});
</script>
</body>