Skip to main content
Triggered before the conversation restarts. Use this event for alerting the user that the chat will reset, allowing them to complete any ongoing actions or save state before the restart occurs.

Event properties

type
string
required
Always 'pre:restartConversation'.

Example

instance.on('pre:restartConversation', (event, instance) => {
    console.log('Conversation is about to restart');
    
    // Show confirmation dialog
    const confirmed = confirm('Are you sure you want to start a new conversation?');
    if (!confirmed) {
        // Note: You cannot prevent the restart, but you can perform cleanup
        return;
    }
    
    // Save current conversation state
    saveConversationState();
    
    // Clear any pending operations
    clearPendingOperations();
});

Do you need practical examples?

Learn how to apply the features available for embedded chat into your implementation with guidance and examples.