Javascript API

Functions to programmatically control the Chat window.

Toggle Widget

The widget opens on click of the floating action button, however, you can also toggle it from the code below.

function toggleThenaWidget() {
  const thenaIframeEle = window.document.getElementById(
    'thena-iframe-element'
   ) 
  thenaIframeEle?.contentDocument?.dispatchEvent(
    new CustomEvent('TOGGLE_THENA_WIDGET')
   )
}
// call this function from your UI to toggle the widget