How to set a List (Multi Selection) custom attribute via JavaScript API (Secure Mode)

Hi there,

** Context**

  • Framework: React (Vite), vanilla JS for the Tawk API calls
  • Tawk: Secure Mode enabled; identity updates (name/email) work reliably
  • Custom attribute on the same property:
    • Name: Topics
    • Key: topics
    • Format: List (Multi Selection)
      -Options: “CCTV Systems”, “Access Control”, “Door Entry”, “Intruder Alarms”, “Fire Alarms”, “Electrical Services”, “Other”

What works
Identity with Secure Mode updates immediately:

const name='Diag', email='diag@gmail.com';
const { hash } = await fetch('/api/tawk/sign.php?scope=test', {
  method:'POST', headers:{'Content-Type':'application/json'},
  body: JSON.stringify({ email })
}).then(r=>r.json());

** What we tried for Topics**

  1. Array value (matches UI options exactly):
const topics = ['Access Control','Door Entry'];
window.Tawk_API.setAttributes({ topics, hash }, (err) => console.log('topics (array):', err || 'ok'));
  • Often returns: topics: “[JSAPI/setAttributes]: Invalid value for key topics: Access Control,Door Entry”
  1. CSV value:
const topicsCSV = 'Access Control, Door Entry';
window.Tawk_API.setAttributes({ topics: topicsCSV, hash }, (err) => console.log('topics (csv):', err || 'ok'));
  • Callback: “ok”, but the “Topics” field in the About panel still shows “Other” (no change).
  1. Split identity and custom attributes into two calls (to avoid identity being blocked by schema errors):
window.Tawk_API.setAttributes({ name, email, hash }, cb);
window.Tawk_API.setAttributes({ topics, hash }, cb); // or { topics: topicsCSV, hash }
  • Identity: ok
  • Topics: array → “Invalid value”;
    csv → “ok” but UI unchanged.

** Questions**
What is the officially supported value format for setting a List (Multi Selection) custom attribute via the JavaScript API?

  • Array of strings?
  • Comma-separated string?
  • Something else (IDs, lowercase normalized values, etc.)?