API Events

ujet.on(eventName, callback)

ujet.off(eventName, callback)


When Web SDK widget is created. Usually this happens when you click the launcher.

You can use this event to send authentication token:

const ujet = new UJET({
  // ...
  // authenticate: getAuthToken

// when you didn't use `authenticate` option, you need to call
// `.authenticate` method manually

ujet.on('created, () => {
  fetch('/token').then(resp => {
    return resp.json()
  }).then(data => {
    ujet.authenticate({ token: data.token })


This event happens when .authenticate method is called and responded with a token to Web SDK.


Web SDK has fetched company information, it is ready to use now.


Emit unread chat message count:

ujet.on('unread', function(num) {
  console.log('has ' + num + ' unread messages')


When Web SDK has been closed. This event happens when you click "close" button in the SDK, or click the launcher to close SDK.