Skip to content

JavaScript API

View as Markdown

Set by messenger.js as soon as it runs.

Call Does
CustomerCatalystMessenger.open() Opens Messenger on its home screen.
CustomerCatalystMessenger.open('new') Opens the new-message screen.
CustomerCatalystMessenger.close() Closes Messenger and puts focus back where it was.
document.querySelector('#help-link').addEventListener('click', function (e) {
e.preventDefault();
CustomerCatalystMessenger.open('new');
});

If you call open() before Messenger has loaded its settings, it opens as soon as they arrive. When Messenger is off, or the page’s site isn’t on the key’s list, open() does nothing.

For buttons, the data-ccm-open attribute needs no JavaScript.

Optional. Set it before the Messenger script tag.

<script>
window.ccMessengerSettings = {
name: 'Maria Lund',
email: 'maria@example.com'
};
</script>
<script src="https://widget.customercatalyst.io/v1/messenger.js" data-key="pk_…" async></script>
Key Value
name Prefills the name on the new-message screen.
email Prefills the email on the new-message screen.
key Your public key, used when the script tag has no data-key.

Name and email only prefill the fields; the visitor can change them, and they don’t sign the visitor in. Once a browser has sent a message, Messenger uses the name and email it remembered instead.

form.js sets window.CustomerCatalystForm to mark that it loaded. It has no methods; open the form with data-open.