Skip to main content
Answered

Intercom messenger: Is it possible to check if the widget is already booted?


I’m currently integrating the intercom messenger widget in a SPA written with React (tsx files).

The application is currently executing window.intercom(“boot”, window.intercomSettings) whenever url changes.
Is there some clever way to check if the messenger widget is already booted as I don’t want to reboot the intercom widget every time a user navigates around in my application but instead call window.intercom(“update”, window.intercomSettings).

Best answer by Nathan Sudds

@Martin Puge  Wondering if you’ve already followed the instructions for integrating the Intercom Messenger into a Single Page Application? If not, I’d recommend starting there and it may address the issue you are having already -- if not let us know!

Hope this helps

 

View original
Did this topic help you find an answer to your question?

2 replies

Nathan Sudds
Expert User ✨
Forum|alt.badge.img+5
  • Top Expert
  • 288 replies
  • Answer
  • August 29, 2023

@Martin Puge  Wondering if you’ve already followed the instructions for integrating the Intercom Messenger into a Single Page Application? If not, I’d recommend starting there and it may address the issue you are having already -- if not let us know!

Hope this helps

 


  • New Participant
  • 1 reply
  • July 12, 2024

Hacky, but if you must:

  const intercomWidget = document.querySelector<HTMLElement>(
    'div.intercom-lightweight-app-launcher, iframe.intercom-launcher-frame',
  )
  if (intercomWidget) console.log('Intercom widget is loaded!')
  else console.log('Intercom widget is NOT loaded.')

This checks the presence of the button in the bottom right corner.

Note: `<HTMLElement>` is a TypeScript annotation. Remove it if using plain JavaScript.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings