Skip to main content
Destroys the web chat instance and removes it from the page, cleaning up all associated resources and event listeners.

Syntax

instance.destroy();

Parameters

None

Returns

void
Returns a void operator.

Examples

The following examples show different ways to destroy the chat instance:
// Destroy chat when user logs out
const handleLogout = () => {
    instance.destroy();
    // Perform other logout actions
};

// Destroy chat when navigating away
window.addEventListener('beforeunload', () => {
    instance.destroy();
});

Do you need practical examples?

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