KUSChatListener Protocol reference for Kustomer Chat iOS Core API.

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.

public protocol KUSChatListener


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

func onChatMessageReceived(conversationId: String, chatMessage: KUSChatMessage)


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

func onConversationCreated(conversationId: String, conversation: KUSConversation)


When a conversation ends

func onConversationEnded(conversationId: String, conversation: KUSConversation)


When an ended conversation is reopened

func onConversationReOpened(conversationId: String, conversation: KUSConversation) { }


When the open conversation count changes

func onOpenConversationCountChange(count: Int)


When the total unread count changes

func onUnreadCountChange(count: Int)


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

func onUnreadCountChange(conversationId: String, count: Int)


When a new KUSUser (customer support agent) joins a conversation.

func onUserJoined(conversationId: String, user: KUSUser)


When a KUSUser starts typing. Only fires if the conversation detail screen for this conversationId is open in the UI.

func onUserIsTyping(conversationId: String, user: KUSUser, timetoken: KUSPNTtoken?)


When a KUSUser stops typing. Only fires if the conversation detail screen for this conversationId is open in the UI.

func onUserStopsTyping(conversationId: String, user: KUSUser, timetoken: KUSPNTtoken?)


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

func onPreviewChanged(conversationId: String, preview: String, previewDetails: PreviewDetails?)


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

func onAssistantEnded(conversation: KUSConversation)


When a conversation is merged into another conversation

func onConversationMerged(sourceConversation: KUSConversation, targetConversation: KUSConversation)


When a satisfaction survey is received for a conversation

func onSatisfactionEventReceived(conversationId: String, satisfaction: KUSSatisfaction)


When a conversation is deleted by the agent

func onConversationDeleted(conversationId: String, conversation: KUSConversation)


When the customer is deleted by the agent

func onCustomerDeleted()