Show Developer Menu

Custom Triggering

Problem Description

With Reamaze.js installed, you might want to proactively open an integrated Shoutbox or Lightbox. For example, you may want to do this as part of a client-side application that triggers the chat interface when a certain action is taken by a user. Alternatively, you may want to open a specific help article under certain circumstances.

Besides the shoutbox and lightbox triggers mentioned in the documentation, Reamaze functionality is invocable via client-side JavaScript.

Prerequisite Code

Make sure you have the Reamaze.js snippet installed from the Installation Step.

Reamaze.popup();

At any time, you can force Reamaze to open a lightbox. Without any parameters, Reamaze will open the contact lightbox.

Reamaze.popup("/kb/topic/article");

You can also force Reamaze to open a help article inside a lightbox. The parameter should be the URL path of the KB article you wish to open. This is useful for programmatically opening help articles based on the user's state in the application.

Reamaze.popup("/conversation/slug");

Similarly, you can also force Reamaze to open a specific conversation. The parameter should be the URL path of the conversation you wish to open. Note that this requires SSO and the current authenticated user must have permission to view that conversation.

You can combine this with the Conversation API to create dynamic prompts or engagement points.

Re:amaze Event Listener

If you need to trigger a callback on your website only after Re:amaze has been initiated we have a CustomEvent, "Reamazeinit" that you can listen for. This event is emitted on every load so if calling Reamaze.reload() anywhere in your triggered code, a flag must be set.

document.addEventListener("Reamazeinit", function() {
    // callback code
});