Show and Hide the Chat Button in Messaging for Web

When setting up your website, you can determine whether the chat button is initially hidden or shown. Also, you can programmatically show or hide the button after initialization.

By default, the chat button is always shown if no business hours are specified. If business hours are specified, the chat button is shown during business hours and hidden outside of business hours. To learn how to configure business hours, see Set Business Hours in Messaging for In-App and Web.

If you want to override this default behavior, set the embeddedservice_bootstrap.settings.hideChatButtonOnLoad flag (to either true or false) before the embeddedservice_bootstrap.init line in your code snippet. For example:

The chat button returns to this same initial state after the chat window closes.

To change the chat button state after initialization, use the following methods: embeddedservice_bootstrap.utilAPI.showChatButton and embeddedservice_bootstrap.utilAPI.hideChatButton.

You can't hide the chat button if the chat window is already showing. Also, these methods don't have session continuity; for example, after a refresh, the button returns to its initial state. If business hours are specified, these calls only override the current visibility until the next business hours interval.

See the Messaging for Web reference documentation for details.