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 Name | Data | Description |
---|---|---|
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 |
onConversationCreated | KustomerConversation | A new conversation was created |
onConversationEnded | KustomerConversation | A conversation was ended |
onConversationDeleted | KustomerConversation | A conversation was deleted |
onConversationResumed | KustomerConversation | A conversation was resumed |
onCustomerMerged | { customerId: string } | A customer was merged with another |
onCustomerDeleted | void | A 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 |
Updated almost 2 years ago