intercom-rails
intercom-rails copied to clipboard
How do I arbitrarily show/hide the intercom widget with js?
Something like Intercom.show(); Intercom.hide()
would be nice. What's the function call for this?
I found this: https://developers.intercom.com/installing-intercom/docs/intercom-javascript#section-intercomhide
This will hide the main Messenger panel if it is open. It will not hide the Messenger Launcher.
I'm trying to hide the Messenger Launcher. It gets in the way of my UI at some points. I'm not finding any function for this yet.
A semi functional solution is to just force it:
function setIntercomVisible(shouldShow) {
const intercomId = "intercom-container";
const domNode = document.getElementById(intercomId);
if (domNode) {
domNode.style.display = shouldShow ? "" : "none";
} else {
console.warn(`No element of id "${intercomId}" was found`);
}
}
If anyone is still looking for this, you can hide using the JS lib:
Intercom("update", { "hide_default_launcher": true });
Taken from https://www.intercom.com/help/en/articles/189-turn-off-show-or-hide-the-intercom-messenger