Subscribe to this to receive chat events. See [Build your own UI](🔗) for a guide to how to use KUSChatListener.

Changes to KUSChatListener events

As of iOS v2.8.0, when subscribing to KUSChatListener, events are no longer handled across all brands unless `KustomerOptions.showAllBrandsConversationHistory` is `true`. Only session events related to the provided `brandId` will be handled.



### onChatMessageReceived(conversationId:chatMessage:)

When a new chat message is received. Order not guaranteed. In your UI, sort by createdAt to recover the correct message order.



### onConversationCreated(conversationId:conversation:)

When a new conversation is created and successfully sent to the Kustomer servers



### onConversationEnded(conversationId:conversation:)

When a conversation ends



### onConversationReOpened(conversationId:conversation:)

When an ended conversation is reopened



### onOpenConversationCountChange(count:)

When the open conversation count changes



### onUnreadCountChange(count:)

When the total unread count changes



### onUnreadCountChange(conversationId:count:)

When the unread count changes for a particular conversation. `count` is the latest unread count for the conversation with id `conversationId`



### onUserJoined(conversationId:user:)

When a new [`KUSUser`](🔗) (customer support agent) joins a conversation.



### onUserIsTyping(conversationId:user:timetoken:)

When a [`KUSUser`](🔗) starts typing. Only fires if the conversation detail screen for this `conversationId` is open in the UI.



### onUserStopsTyping(conversationId:user:timetoken:)

When a [`KUSUser`](🔗) stops typing. Only fires if the conversation detail screen for this `conversationId` is open in the UI.



### onPreviewChanged(conversationId:preview:previewDetails:)

When the preview for a conversation changes (eg. a new message is sent or received for the conversation)



### onAssistantEnded(conversation:)

When a chat assistant completes for a conversation, and it is no longer in assistant mode



### onConversationMerged(sourceConversation:targetConversation:)

When a conversation is merged into another conversation



### onSatisfactionEventReceived(conversationId:satisfaction:)

When a satisfaction survey is received for a conversation



### onConversationDeleted(conversationId:conversation:)

When a conversation is deleted by the agent



### onCustomerDeleted()

When the customer is deleted by the agent