Embedded
Opening chat programmatically
Explains opening embedded Webchat from webpage code using browser events. Useful for custom buttons, page-triggered chats, and guided user journeys.
Overview
Open the webchat widget from your webpage by dispatching the stubber_webchat_chat_open event on the window. Use this to trigger the chat from a custom button, link, or other user interaction instead of the default launcher.
Usage
Dispatch a stubber_webchat_chat_open event on the window object:
On this event, the webchat widget will:
- Enable the webchat if it is not already enabled
- Open the chat window
- Establish a connection to the webchat service
Example
Opening chat from a custom button
Opening chat based on page behavior
Trigger the event from other conditions, such as time on page or scroll position: