Skip to main content
APIs involved: Chat Widget JS API Suppose a customer adds items to their cart, hesitates on the checkout page, and leaves without buying. You want to open the chat widget with a pre-filled message before they navigate away.
1

Set session variables when the cart is populated

2

Trigger the widget

After your own timing rule fires, call maximize with an optional messageDraft:
messageDraft pre-fills the chat input field. If a pre-chat form is configured, the draft is sent automatically when the customer submits it.
When the customer sends their first message, the chat opens in Text. The agent sees cart_value, items_in_cart, and page in the customer details panel — enough context to help without asking the customer to repeat themselves.