KUSChatListener

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

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.

func onChatMessageReceived(conversationId: String, chatMessage: KUSChatMessage)

onConversationCreated(conversationId:conversation:)

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

func onConversationCreated(conversationId: String, conversation: KUSConversation)

onConversationEnded(conversationId:conversation:)

When a conversation ends

func onConversationEnded(conversationId: String, conversation: KUSConversation)

onConversationReOpened(conversationId:conversation:)

When an ended conversation is reopened

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

onOpenConversationCountChange(count:)

When the open conversation count changes

func onOpenConversationCountChange(count: Int)

onUnreadCountChange(count:)

When the total unread count changes

func onUnreadCountChange(count: Int)

onUnreadCountChange(conversationId:count:)

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)

onUserJoined(conversationId:user:)

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

func onUserJoined(conversationId: String, user: KUSUser)

onUserIsTyping(conversationId:user:timetoken:)

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?)

onUserStopsTyping(conversationId:user:timetoken:)

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?)

onPreviewChanged(conversationId:preview:previewDetails:)

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?)

onAssistantEnded(conversation:)

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

func onAssistantEnded(conversation: KUSConversation)

onConversationMerged(sourceConversation:targetConversation:)

When a conversation is merged into another conversation

func onConversationMerged(sourceConversation: KUSConversation, targetConversation: KUSConversation)

onSatisfactionEventReceived(conversationId:satisfaction:)

When a satisfaction survey is received for a conversation

func onSatisfactionEventReceived(conversationId: String, satisfaction: KUSSatisfaction)

onConversationDeleted(conversationId:conversation:)

When a conversation is deleted by the agent

func onConversationDeleted(conversationId: String, conversation: KUSConversation)

onCustomerDeleted()

When the customer is deleted by the agent

func onCustomerDeleted()