Skip to main content
Once the snippet is on the page, window.$talqui controls the chat. It uses the same commands and events as the React Native and Flutter SDKs.

Use $talqui before it is ready

The snippet loads async, so your code may run before the chat. Declare $talqui as an array and push commands into it: they run in order as soon as the chat loads.
After loading, every command is also a method: $talqui.open(). The push form keeps working, so both styles are safe at any time.

Methods

Open and close the chat

Opens, closes or toggles the chat window.

Show and hide the balloon

Hides the chat balloon, for pages that open the chat from their own button. hide() also closes the chat.

Identify the user

Tells the chat who the visitor is. With a userHash, the visitor becomes that user and finds their history on any device. See Identify users.
A userHash different from the current one switches the chat to that user: the previous visitor’s conversation is dropped from the page first. Never put a hash computed for one user on another user’s page.

Update contact details

Sets the name, email or phone without switching users. When these cover the fields your pre-chat form requires, the form is skipped.

Attach data to the contact or the conversation

setContactMeta describes the person and stays on their contact. setSessionMeta describes this conversation. See Metadata for the rules.

Suggest a message

Puts text in the message box. The visitor still decides to send it. Up to 1,000 characters.

Forget the visitor on logout

Clears the identity, the contact details and the metadata on this browser, starts a fresh anonymous visitor and closes the chat. Call it when the user logs out of your site.
Without reset(), the next person who logs in on the same browser sees the previous user’s conversation.

Listen to events

on("ready", callback) also fires right away when the chat has already loaded.

Events

preview holds the first 140 characters of a text reply and is empty for media. operatorName is the first name of the person who replied, or null for bots.

Reads

Errors and warnings

The API never throws into your page. An unknown command, an invalid argument or an unknown event name prints a [talqui] warning in the console with a link to this page. An exception thrown by one of your callbacks is logged and never breaks the chat. If another script already uses window.$talqui for something else, the chat leaves it alone and the API stays disabled; the console says so.

Example: open the chat from your own button

Hide the balloon, open the chat from a button in your header and show the unread count on it.

Example: identify after login in a single-page app