HubSpot Chat

HubSpot chat integration requires some coding on your side because HubSpot chat API is quite limited. It prevents us to create a full integration on our side.

This integration takes advantage of their chat embedding feature. You have to create an element, host the HubSpot chat in it and handle the display state.

First, select the Custom provider option in the Life Ring Button settings.

Now, here starts the coding part.

This is a small working example of the integration with comments (the code should be in <body>):

<!-- Define the HubSpot chat panel root element. This element will be holding the HubSpot chat frame -->
<div id="hubspot-chat-holder" style="position: fixed; right: 30px; bottom: 30px; background-color: white; visibility: hidden">
	<button onclick="onHubspotClosed()">Close</button>
	<!-- This element will be holding the HubSpot chat -->
    <div id="hubspot-chat" style="height: 500px; width: 300px;">
<!-- Add some styles. This enlarges the HubSpot chat itself. -->
    #hubspot-conversations-inline-iframe {
        width: 300px;
        height: 500px;
<!-- This is HubSpot configuration object. It tells HubSpot to embed the chat to the #hubspot-chat element (we created it above) -->
	window.hsConversationsSettings = {
    	loadImmediately: true,
    	inlineEmbedSelector: '#hubspot-chat'
	// This code handles the Custom Chat provider settings. See the Custom Provider section in our help docs.
    const hubspotHolder = document.getElementById('hubspot-chat-holder');
    window.addEventListener('productfruits_button_ext_widget_init', () => { = ''; // if we get signal from PF Life Ring button, show the HubSpot element
/* This method is called by the Close button, it hides the HubSpot element and shows the Life Ring button again */
    function onHubspotClosed() { = 'hidden';
<!-- This part is about getting a notification, when the HubSpot chat is closed and the user will get a message -->
<script type="text/javascript">
   	function onConversationsAPIReady() {
       	window.HubSpotConversations.on('unreadConversationCountChanged', payload => {
   			if (payload.unreadCount > 0) {
   				// You should notify the user about the new chat, if the popup with the chat is closed.
   				// For instance, you can show another element.

   	if (window.HubSpotConversations) {
   	} else {
		window.hsConversationsOnReady = [onConversationsAPIReady];
<!-- Start of HubSpot Embed Code -->
<script type="text/javascript" id="hs-script-loader" async defer src="//"></script>
<!-- End of HubSpot Embed Code -->    



  • You have to create holder elements for the HubSpot chat
  • You will use the inlineEmbedSelector feature of the HubSpot chat. It will embed the chat into your element
  • You can be listening to the unreadConversationCountChanged event and show notifications