Control the Webchat widget

The following table shows the Proto script that can be used to control the display of the widget:

ScriptDescription

window.proto.open()

To open the widget

window.proto.close()

To close the widget

window.proto.hide()

To hide the bot avatar and widget

window.proto.show()

To show the bot avatar and widget

window.proto.startchat()

To start the webchat directly

window.proto.isOpen()

To check if the widget is open

If you want to check if the widget is open or closed, you can also use the following code:

window.protoSettings = {
      id,
      ...
      onOpen: () => console.log('Webchat opened'),
      onClose: () => console.log('Webchat closed'),
    };

Last updated