Skip to content
BRAND & CHANNELS

Website buttons and widget controls

Connect your own support button, control visibility, and clean up the widget in a single-page application.

About 5 min to read

How to do it

  1. 01

    Install the generated script once. Keep defer for a normal HTML embed. Duplicate executions for the same RelayDesk origin and widget ID reuse the existing instance.

  2. 02

    For your own support button, call window.RelayDesk.open() from its click handler after the SDK is available. Use close() or toggle() to change the panel; show() and hide() control the whole widget. Hiding is a visual choice and does not disable tracking or networking.

  3. 03

    Listen for relaydesk:ready on window before loading the script, or check window.RelayDesk if it already loaded. This event means the website API is available. relaydesk:loaded means the initial widget configuration has arrived. Neither event proves inbox delivery or server availability.

  4. 04

    Use getState() for widget ID, runtime version, configuration-loaded, open, visible and destroyed flags. Window events relaydesk:open, relaydesk:close, relaydesk:visibility and relaydesk:destroy contain the widget ID and RelayDesk origin, without visitor credentials or message content.

  5. 05

    For a launcher hidden initially, add data-start-hidden="true" to the script, then call open() from your own support button. To disable automatic page tracking, use data-track-pages="false". If consent must precede every RelayDesk request, delay loading the script until your consent manager permits it.

  6. 06

    Keep one mounted widget across ordinary SPA route changes and use the existing trackPage() API when appropriate. Call destroy() only when removing the integration; it closes connections and removes listeners and the launcher. Reload the script to mount again. Destroy does not erase saved visitor history.

  7. 07

    Use each relaydesk-chat element’s relaydesk property for multiple widgets. The window.RelayDesk shortcut points to the first available instance. Keep signed identity generation on your server; never put signing secrets in the embed code.