Reference

Reference: website and @zean-chat/js

The Install code’s window.zean and the @zean-chat/js package: every option, method and type.

Updated October 18, 2026

The samples show app_your_app_key. Open this guide from App settings > Developers > Getting started to see your App’s key in them.

The Install code and the @zean-chat/js package give the same methods. The Install code puts them on window.zean; the package exports them, for a site built with a bundler and without React or Vue.

Terminal
npm install @zean-chat/js
JSX
import { loadZean, zean } from "@zean-chat/js";loadZean({ appKey: "app_your_app_key" });// Later, anywhere in your codezean.open();
  • loadZean() adds the chat’s loader once, whatever the number of calls. A call with another key is ignored, and the console says so.
  • The methods of zean work before the chat has loaded: calls wait for it.
  • On the server, nothing happens: the package can be imported in code that renders there.
  • When the Install code is on the page too, loadZean() uses the chat it loaded.

Exports

NameTypeDescription
loadZean()(options: ZeanOptions) => ZeanApiShows the chat on the page and returns its methods.
zeanZeanApiThe chat’s methods, usable before loadZean().
ZeanApiinterfaceThe chat’s methods, below.
ZeanSettingsinterfaceWhat window.zean holds before the chat loads.
ZeanOptionsinterfaceThe options of loadZean().
ZeanUserinterfaceThe signed-in person, below.
ZeanAttributesRecord<string, ZeanAttributeValue>The Contact’s attributes: { city: "Douala", orders: 12 }.
ZeanAttributeValuestring | number | booleanOne attribute’s value.
ZeanLocale'fr' | 'en'One of the chat’s languages.

window.zean, before the chat loads

The Install code sets window.zean before it adds the loader:

HTML
<script>  window.zean = { appKey: "app_your_app_key", locale: "fr" };</script><script async src="https://widget.zean.chat/loader.js"></script>
NameTypeDescription
appKeystringRequired. The App’s public key, in App settings > Developers > Getting started.
userZeanUserOptional. The signed-in person, { id, name, email }. Same as calling identify() once the chat has loaded. See Identify your Contacts.
locale'fr' | 'en'Optional. The chat’s language. Without it: the browser’s, when the chat speaks it, else the App’s default language. Read when the page loads.
tabAlertbooleanOptional. The Tab alert: while the Contact has replies to read, your tab’s title starts with their count and its icon gets a red dot. On by default; false turns it off. See Show the unread count.

Options of loadZean()

NameTypeDescription
appKeystringRequired. The App’s public key, in App settings > Developers > Getting started.
userZeanUserOptional. The signed-in person, { id, name, email }. Same as calling identify() once the chat has loaded. See Identify your Contacts.
locale'fr' | 'en'Optional. The chat’s language. Without it: the browser’s, when the chat speaks it, else the App’s default language. Read when the page loads.
tabAlertbooleanOptional. The Tab alert: while the Contact has replies to read, your tab’s title starts with their count and its icon gets a red dot. On by default; false turns it off. See Show the unread count.

Methods

NameTypeDescription
open()() => voidOpens the chat.
close()() => voidCloses the chat.
toggle()() => voidOpens the chat when closed, closes it otherwise.
getUnreadCount()() => numberThe number of replies the Contact has not read. 0 before the chat loads.
onUnreadChange()(listener: (count: number) => void) => () => voidCalls listener each time that number changes. Returns the function that stops listening.
identify()(user: ZeanUser) => voidThe person signed in. The first device to bring their ID joins their Conversation at once; another one first asks them for a code sent by email. See Identify your Contacts.
signOut()() => voidThe person signed out: the chat starts over, anonymous.
setAttributes()(attributes: ZeanAttributes) => voidJoined to the attributes sent before. Refused values are reported in the console. See Custom attributes.

ZeanUser

NameTypeDescription
idstring | numberRequired. Your own ID for the person, as text or a number, 200 characters at most. The same ID on your website and in your mobile app is one person.
namestringOptional. Their name, on their Contact profile.
emailstringOptional. The code that adds another device goes to this address: without it, a second device can never join the Contact.
phonestringOptional. Their phone, on their Contact profile.
languagestringOptional. Their language, any one, as a tag such as pt or pt-BR. Without it, their device’s is kept. It does not change the chat’s language.

On window.zean, the methods only exist once the loader has run: call them after the page has loaded. The methods of @zean-chat/js wait for the chat.