Live Chat Messenger Events & Logger

Updated 

The Live Chat Logger in the Live Chat SDK provides a structured mechanism for capturing and managing real-time SDK events and system logs. It enables developers to monitor chat interactions, track user actions, and diagnose issues efficiently by logging critical events and system statuses. 

Add Events Logger to SDK Events 

To track and manage various events efficiently, the SDK provides a logging system that can be configured according to your requirements. The logging system supports different log levels to help debug issues effectively. 

Configure the Logger 

Use the following snippet to enable logging and define custom log transports: 

Note: It is recommended to call setLoggerConfig before takeOff to avoid missing logs emitted during initialization.

import MessengerClient from '@sprinklrjs/chat-native-client'; 

 

MessengerClient.setLoggerConfig({ 

  enableLogs: true, // Required to enable logs 

  logLevel: 4, // Optional, default is INFO (4) 

  transports: [ 

    { 

      write(level, ...logs) { 

        // Implement your custom logger transport here 

      }, 

    }, 

  ], // Optional, default transport is console 

}); 

setLoggerConfig Parameters 

Parameter 

Required/Optional 

 

Value 

Description 

 

enableLogs 

Required 

Boolean (true/false) 

This parameter is required to enable or disable logging. When set to true, logging is enabled, allowing the application to record log messages. If set to false, logging is disabled. 

logLevel 

Optional 

Integer (0 to 7) 

This parameter sets the level of logging detail. The default value is 4, which corresponds to the INFO level. Refer to the table below for more details on Log Level 

transports

Optional

List of objects with a write method.

write(level, …logs){}

  • level: Level of the log

  • …logs: List of logs as strings

This parameter allows defining multiple transporters that get called parallelly.

 

Available Log Levels 

The SDK supports the following log levels: 

Log Level 

Value  

Description 

OFF 

Disables all logging. No log messages will be recorded. 

FATAL 

Logs only the most severe error events that will presumably lead the application to abort. 

ERROR 

Logs things that went wrong so that either something failed or the system had to resort to a fallback that the user may have noticed. 

WARN 

Logs things that went wrong, but were recoverable so that a user should not have noticed. 

INFO 

Logs primarily large business-logic steps as the SDK connects, sends, and receives messages. 

DEBUG 

Logs details of the inner workings of the SDK logic and network stack. 

TRACE 

Logs high-traffic logs; tracks many objects as they move through the SDK. 

ALL 

Enables all logging levels, capturing every log message. 

 
As is standard with most logging systems, each of these settings also includes all levels below it. Setting the SDK Logging Level to OFF disables SDK logging entirely. 

Add Messenger Events Listener to SDK Events 

To track various SDK-related events, register an event listener using the registerEventsListener method. 

Register an Events Listener 

Note: It is recommended to call registerEventsListener before takeOff to avoid missing events during initialization.

import MessengerClient from '@sprinklrjs/chat-native-client'; 

 

MessengerClient.registerEventsListener(this.eventsListener); 

 

eventsListener = (eventGroup, eventType, payload) => { 

  // Handle events here 

}; 

Supported Events  

The SDK emits events under different event groups. Below is the list of supported event groups and their event types:

Event Type  

Description  

SDK Method 

BOOT_FAILED  

Messenger boot process failed.  

 takeOff 

BOOT_STARTING  

Messenger boot process started.  

takeOff 

BOOT_COMPLETE  

Messenger boot process completed successfully.  

takeOff 

USER_LOGOUT  

User logged out.  

cleanup 

UPDATE_USER_STARTING  

Updating user information started.  

updateUser/ updateCustomUser  

UPDATE_USER_FAILED  

Updating user information failed.  

updateUser/ updateCustomUser  

UPDATE_USER_SUCCESS  

User information updated successfully.  

updateUser/ updateCustomUser  

UPDATE_USER_CONTEXT_FAILED  

Updating user context failed.  

updateUserContext  

UPDATE_CLIENT_CONTEXT_FAILED  

Updating client context failed.  

updateClientContext  

ANONYMOUS_SESSION_CREATION_STARTING  

Anonymous session creation started.  

cleanup  

ANONYMOUS_SESSION_CREATION_SUCCESS  

Anonymous session created successfully.  

cleanup  

ANONYMOUS_SESSION_CREATION_FAILED  

Anonymous session creation failed.  

cleanup 

AUTH_SESSION_STATUS 

Authentication session status changed 

getAuthSessionStatus/any Authenticated API Call 

ANONYMOUS_SESSION_CLEARED 

Anonymous session cleared successfully 

cleanup 

ANONYMOUS_SESSION_CLEAR_FAILED 

Anonymous session clear failed 

cleanup 

 

Event Type 

Description 

INTERNET_CONNECTION_STATUS_CHANGED 

Internet connection status changed. 

Event Type 

Description 

SDK Method 

PUSH_NOTIFICATION_REGISTRATION_EXISTS 

Push notification registration already exists. 

updatePushToken 

PUSH_NOTIFICATION_REGISTRATION_SUCCESS 

Push notification registration successful. 

updatePushToken 

PUSH_NOTIFICATION_REGISTRATION_FAILED 

Push notification registration failed. 

updatePushToken 

PUSH_NOTIFICATION_UNREGISTRATION_SUCCESS 

Push notification unregistered successfully. 

updatePushToken 

PUSH_NOTIFICATION_UNREGISTRATION_FAILED 

Push notification unregistration failed. 

updatePushToken 

Event Type  

Description  

NEW_CONVERSATION_INITIATION_FAILED  

Failed to initiate a new conversation.  

NEW_CONVERSATION_CREATED  

New conversation created.  

NEW_CONVERSATION_STARTED 

New conversation started.  

EXISTING_CONVERSATION_OPENED 

Existing conversation opened.  

CONVERSATION_WINDOW_OPENED 

Conversation window opened.  

CONVERSATION_WINDOW_CLOSED 

Conversation window closed.  

CONVERSATION_EXPORTED 

Conversation exported.  

CONVERSATION_CLOSED  

Conversation closed.  

CONVERSATION_DELETED  

Conversation deleted.  

CONVERSATION_CLOSE_FAILED  

Failed to close the conversation.  

CONVERSATION_DELETE_FAILED  

Failed to delete the conversation.  

CONVERSATION_CLOSED_BY_AGENT  

Conversation was closed by an agent.  

CONVERSATION_BACK_PRESSED 

Conversation back pressed.  

CONVERSATION_LIST_BACK_PRESSED 

Conversation list back pressed.  

CONVERSATIONS_DELETED 

Conversations deleted.  

CONVERSATIONS_CLOSED 

Conversations closed.  

ALL_CONVERSATIONS_DELETED  

All conversations deleted successfully.  

ALL_CONVERSATIONS_CLOSED  

All conversations closed successfully.  

ALL_CONVERSATIONS_CLOSE_FAILED  

Failed to close all conversations.  

ALL_CONVERSATIONS_DELETE_FAILED  

Failed to delete all conversations. 

Event Type 

Description 

VIDEO_CALL_INITIATED 

Video call initiated by user. 

VIDEO_CALL_STARTED 

Video call session started successfully. 

VIDEO_CALL_ENDED 

Video call session ended. 

VIDEO_CALL_FAILED 

Video call connection failed. 

VIDEO_CALL_OUTGOING_STARTING

Video call outgoing starting. 

VIDEO_CALL_CARD_CTA_CLICKED

CTA clicked from video call card. 

VIDEO_CALL_LAUNCH_CLICKED

Video call launch clicked. 

VIDEO_CALL_LAUNCHED

Video call launched. 

VIDEO_CALL_JOIN_CTA_CLICKED 

Video call join CTA clicked. 

VIDEO_CALL_JOIN_BACK_CTA_CLICKED

Video call join back CTA clicked. 

VIDEO_CALL_END_CLICKED

Video call end clicked. 

Event Type 

Description 

AUDIO_CALL_OUTGOING_STARTING 

Audio call outgoing starting. 

AUDIO_CALL_CARD_CTA_CLICKED 

CTA clicked from audio call card. 

AUDIO_CALL_LAUNCH_CLICKED 

Audio call launch clicked. 

AUDIO_CALL_LAUNCHED 

Audio call launched. 

AUDIO_CALL_JOIN_CTA_CLICKED 

Audio call join CTA clicked. 

AUDIO_CALL_JOIN_BACK_CTA_CLICKED 

Audio call join back CTA clicked. 

AUDIO_CALL_END_CLICKED 

Audio call end clicked. 

Event Type 

Description 

CALL_PAGE_MINIMISED

Call page minimised. 

CALL_PAGE_MAXIMISED

Call page maximised. 

CALL_ENDED

Call ended. 

CALL_DECLINED

Call declined. 

CALL_MISSED

Call missed. 

CALL_FAILED

Call failed. 

Event Type 

Description 

MQTT_CLIENT_ERROR 

MQTT client connection error occurred 

MQTT_CLIENT_CLOSED 

MQTT client connection closed 

MQTT_CLIENT_OFFLINE 

MQTT client went offline 

MQTT_CLIENT_RECONNECT 

MQTT client attempting to reconnect 

MQTT_CLIENT_CONNECTED 

MQTT client connected successfully 

MQTT_CLIENT_DISCONNECTED 

MQTT client disconnected 

Event Type

Description

ANSWER_CALL_INITIATED 

VoIP call answer action initiated

Event Type

Description

COBROWSE_SESSION_STARTED 

Co-browse session started with agent 

COBROWSE_SESSION_ENDED 

Co-browse session ended

Event Type 

Description 

SURVEY_BACK_PRESSED 

Survey back pressed. 

SURVEY_SUBMITTED 

Survey submitted. 

SURVEY_CANCELLED 

Survey cancelle

Event Type 

Description 

GUIDED_WORKFLOW_BACK_PRESSED 

Guided workflow back pressed. 

GW_CLICKED 

Guided workflow clicked. 

Event Type 

Description 

KNOWLEDGE_BASE_LIST_BACK_PRESSED 

Knowledge base list back pressed. 

KNOWLEDGE_BASE_BACK_PRESSED 

Knowledge base back pressed. 

KB_ARTICLE_CLICKED 

KB article clicked. 

KB_FOLDER_CLICKED 

KB folder clicked. 

Event Type

Description

INFO_CARD_OPENED

Info card opened.

INFO_CARD_CLOSED

Info card closed.

Event Type

Description

USER_PROFILE_UPDATED

User profile updated.

USER_PROFILE_UPDATE_FAILED

User profile update failed.

USER_UPDATED

User updated.

USER_UPDATE_FAILURE

User update failure.

Event Type

Description

WIDGET_MAXIMIZED

Widget maximized.

WIDGET_MINIMIZED

Widget minimized.

PAGE_OPENED

Page opened.

Event Type

Description

PROACTIVE_PROMPT_TRIGGERED

Proactive prompt triggered.

PROACTIVE_PROMPT_ENGAGED

Proactive prompt engaged.

PROACTIVE_PROMPT_CLOSED

Proactive prompt closed.

PROACTIVE_CONVERSATION_TRIGGERED

Proactive conversation triggered.

PROACTIVE_CONVERSATION_ENGAGED

Proactive conversation engaged.

PROACTIVE_CONVERSATION_CLOSED

Proactive conversation closed.

Event Type

Description

TRIGGER_VISIBLE

Trigger visible.

TRIGGER_DRAGGED

Trigger dragged.

CHAT_TRIGGER_REMOVED

Chat trigger removed.

CHAT_TRIGGER_CLICKED

Chat trigger clicked.

Event Type

Description

BUTTON_CLICKED

Button clicked.

ATTACHMENT_BUTTON_CLICKED

Attachment button clicked.

SEND_BUTTON_CLICKED

Send button clicked.

LINK_CLICKED

Link clicked.

Event Type

Description

TTS_CLICKED

Text‑to‑speech clicked.

TTS_FAILED

Text‑to‑speech failed.

STT_CLICKED

Speech‑to‑text clicked.

STT_FAILED

Speech‑to‑text failed.

Event Type

Description

LOCATION_SHARING_CLICKED

Location sharing clicked.

Event Type

Description

PERSONAL_SHOPPER_LAUNCH

Personal Shopper launched.

PERSONAL_SHOPPER_BACK_PRESSED

Personal Shopper back pressed.

CART_OPEN

Cart page open.

Event Type 

Description 

SESSION_ACTIVE 

Session active. 

SPRINKLR_ENTITIES_BACK_PRESSED

Sprinklr Entities back pressed. 

FORM_ERROR

Form error. 

Additional Resources

See All Integration Steps