Show and Hide the Chat Button in Messaging for Web
This release is in preview. Features described here don't become generally available until the latest general availability date that Salesforce announces for this release. Make your purchase decisions only on the basis of generally available products and features.
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 Configure a Messaging for Web Deployment.
If you want to override this default behavior, set the
embeddedservice_bootstrap.settings.hideChatButtonOnLoad flag (to either
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:
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 more detail.