Opening to a specific chatflow on the page

Users can create a button or link to open to a specific chatflow on page refresh.

chatflow_example

The on page code for this example is as follows:

JavaScript
<button onclick="window.history.pushState({}, 'hs_bot', '?hs_bot=true'); window.HubSpotConversations.widget.refresh({openToNewThread: true});"> open to custom chatflow</button>
<button onclick="window.history.pushState({}, 'hs_bot2', '?hs_bot2=true'); window.HubSpotConversations.widget.refresh({openToNewThread: true});"> open to custom chatflow 2</button>
<button onclick="window.history.pushState({}, 'hs_bot3', '?hs_bot3=true'); window.HubSpotConversations.widget.refresh({openToNewThread: true});"> open to custom chatflow 3</button>

For each chat on a page, you can set it to show with a specific query parameter, and hide on all others.

chatflows_targeting

Tip: you can select “open the chat widget” in chatflows display settings to ensure that this opens the widget.

chatflows_display_settings