Documentation
JavaScript API
Gatherly.open, close, and invalidate.
window.Gatherly
After the embed loads, a global Gatherly object is available. Methods return the same object so calls can be chained.
Gatherly.open().close();open()
Opens the feedback panel. Safe to call before mount; the widget waits for the DOM and opens when ready.
Gatherly.open();close()
Closes the panel if it is open. Escape also closes the panel.
Gatherly.close();invalidate()
Re-reads data-auth-token, email, username, and auth mode from the embed script tag, then re-applies audience rules (show or hide the launcher). Use this after login or logout in an SPA so the widget updates without a full page refresh.
// After logout: clear identity attrs, then invalidate
const script = document.querySelector('script[data-key][src*="embed"]');
if (script) {
script.removeAttribute("data-auth-token");
script.removeAttribute("data-auth-email");
script.removeAttribute("data-auth-username");
}
Gatherly.invalidate();
// After login: set a fresh JWT, then invalidate
script.setAttribute("data-auth-token", identityJwt);
script.setAttribute("data-auth-email", user.email);
script.setAttribute("data-auth-username", user.username);
Gatherly.invalidate();If the token value changes, Gatherly also closes the panel and clears in-memory chat state so the next session starts clean.
key
Gatherly.key mirrors the data-key from the script tag. It is read-only for debugging; change the attribute on the script to switch projects.