Dynamically manage widget via JS methods

Zowie Chat exposes JS methods that can be used to trigger certain actions on a widget.

Method

Description

Chatbotize.start()

Open widget and initialize conversation.

Chatbotize.open()

Open widget's window, keep icon visible.

Chatbotize.close()

Close widget's window, keep icon visible.

Chatbotize.show()

Show widget's window and icon if hidden.

Chatbotize.hide()

Hide widget's window and icon if visible.

Chatbotize.updateMetadata( Metadata )

Update customer's metadata passing object described above.

Chatbotize.updatePosition( Position )

Update widget's position passing object described above.

Chatbotize.sendReferral( string )

Send referral parameter which can be used to trigger configured scenario.

Chatbotize.setMessage( string )

Set message in customer's input.

Chatbotize.isAvailable()

Returns true if configured placement and availability policies allow displaying the widget. Returns false otherwise.

Chatbotize.setAccessTokenCallback(callback)

Register callback which will be invoked whenever user click on chat call to action to start a chat. Callback should be a function with following signature (onSuccess: string => void, onFailure: string => void). Call onSuccess and provide accessToken or call onFailure with error message. Zowie will wait with setting up a session until onSuccess/onFailure is being called.

Chatbotize.logout()

Logout current user and remove current chat session.