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/jsJSX
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
zeanwork 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
| Name | Type | Description |
|---|---|---|
loadZean() | (options: ZeanOptions) => ZeanApi | Shows the chat on the page and returns its methods. |
zean | ZeanApi | The chat’s methods, usable before loadZean(). |
ZeanApi | interface | The chat’s methods, below. |
ZeanSettings | interface | What window.zean holds before the chat loads. |
ZeanOptions | interface | The options of loadZean(). |
ZeanUser | interface | The signed-in person, below. |
ZeanAttributes | Record<string, ZeanAttributeValue> | The Contact’s attributes: { city: "Douala", orders: 12 }. |
ZeanAttributeValue | string | number | boolean | One 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>| Name | Type | Description |
|---|---|---|
appKey | string | Required. The App’s public key, in App settings > Developers > Getting started. |
user | ZeanUser | Optional. 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. |
tabAlert | boolean | Optional. 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()
| Name | Type | Description |
|---|---|---|
appKey | string | Required. The App’s public key, in App settings > Developers > Getting started. |
user | ZeanUser | Optional. 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. |
tabAlert | boolean | Optional. 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
| Name | Type | Description |
|---|---|---|
open() | () => void | Opens the chat. |
close() | () => void | Closes the chat. |
toggle() | () => void | Opens the chat when closed, closes it otherwise. |
getUnreadCount() | () => number | The number of replies the Contact has not read. 0 before the chat loads. |
onUnreadChange() | (listener: (count: number) => void) => () => void | Calls listener each time that number changes. Returns the function that stops listening. |
identify() | (user: ZeanUser) => void | The 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() | () => void | The person signed out: the chat starts over, anonymous. |
setAttributes() | (attributes: ZeanAttributes) => void | Joined to the attributes sent before. Refused values are reported in the console. See Custom attributes. |
ZeanUser
| Name | Type | Description |
|---|---|---|
id | string | number | Required. 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. |
name | string | Optional. Their name, on their Contact profile. |
email | string | Optional. The code that adds another device goes to this address: without it, a second device can never join the Contact. |
phone | string | Optional. Their phone, on their Contact profile. |
language | string | Optional. 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.