Customer_status_changed never hits 'queued' case

I’m subscribing to the customer_status_changed event but don’t see it firing when a customer is put into a queued status. Using the example from the docs the code never hits the ‘queued’ case in the switch statement.

Anyone successfully hitting the queued case?

function onCustomerStatusChanged(data) {
  switch (data.status) {
case 'queued':
  // customer is in queue
  break
case 'chatting':
  // customer is currently chatting
  break
case 'invited':
  // customer received an invitation but didn't start the chat
  break
case 'browsing':
  // customer is in idle state, not queued, not chatting, and didn't receive an invitation
  break
  }
}

LiveChatWidget.on('customer_status_changed', onCustomerStatusChanged)
LiveChatWidget.off('customer_status_changed', onCustomerStatusChanged)

Hello! : :wave:

It may occur because you are subscribing and then immediately unsubscribing from that event

LiveChatWidget.on('customer_status_changed', onCustomerStatusChanged) LiveChatWidget.off('customer_status_changed', onCustomerStatusChanged)

Given that, you should only use

LiveChatWidget.on('customer_status_changed', onCustomerStatusChanged)

and it should work for you :slight_smile:
Let me know if that solves the problem :raised_hands:

Thanks for your reply. I’ve also tried without unsubscribing and it does not work. I reached out to support today and they confirmed there is an issue…waiting to hear back on a resolution.

1 Like

LiveChat was able to fix the issue with queued status. It’s now hitting that case in the ‘customer_status_changed’ event.

1 Like