Listen for chat events

Learn how to add listeners for chat events.

The Kustomer Chat React Native SDK provides a number of events that you can listen for via the KustomerEventEmitter object. You can use these events to respond to changes, such as when a new message is received or when the unread count changes.

Usage

import { KustomerEventEmitter } from 'kustomer-react-native';

KustomerEventEmitter.addListener('onChatMessageReceived', (data) => {
  console.log('onChatMessageReceived', data);
});

Supported events

Event NameDataDescription
onChatMessageReceived{ conversationId: string; message: string }A new message was received
onAgentIsTyping{ conversationId: string; typingIndicator: boolean }An agent is typing
onUnreadCountChange{ conversationId: string; unreadCount: number }The unread count for a conversation changed
onUnreadTotalChange{ count: number }The total unread count changed
onAgentJoined{ conversationId: string; agent: KustomerUser }An agent joined the conversation
onConversationLastMessageAtChanged{ conversationId: string; lastMessageAt: number }The last message timestamp changed
onConversationCreatedKustomerConversationA new conversation was created
onConversationEndedKustomerConversationA conversation was ended
onConversationDeletedKustomerConversationA conversation was deleted
onConversationResumedKustomerConversationA conversation was resumed
onCustomerMerged{ customerId: string }A customer was merged with another
onCustomerDeletedvoidA customer was deleted
onAssistantEnded{ conversationId: string }The assistant ended the conversation
onConversationMerged{ source: KustomerConversation; target: KustomerConversation }A conversation was merged
onOpenConversationCountChange{ count: number }The number of open conversations changed