How to Close Intercom Messenger on Click Outside Panel? | Community
Skip to main content
Submitted

How to Close Intercom Messenger on Click Outside Panel?

Related products:Messenger
  • July 21, 2024
  • 2 replies
  • 28 views

I want the messenger window to close once I click outside it anywhere. Currently, it only closes when I press the downwards arrow, which is not good for UX.

 

If possible, please tell how I can do this within the Intercom code. I have tried some custom hacks in JavaScript by finding the clickable HTML element, but they are not working.

 

The open window is in the attached screenshot.

 

The relevant code for rendering this is this:

Intercom({

      app_id: 'ussh6hvz',

      user_id: data.id, // IMPORTANT: Replace "user.id" with the variable you use to capture the user's ID

      name: data.userProfile.name, // IMPORTANT: Replace "user.name" with the variable you use to capture the user's name

      email: data.userProfile.email, // IMPORTANT: Replace "user.email" with the variable you use to capture the user's email address

      created_at: data.userProfile.created_at // IMPORTANT: Replace "user.createdAt" with the variable you use to capture the user's sign-up date

    });

 

 

2 replies

mateusz.leszkiewicz
Intercom Team
Forum|alt.badge.img+7

Hi Jason From Dropella, It’s Mat from the Support Engineering Team 😀


To close the Intercom messenger window when clicking on any element of your website, you can use the Intercom('hide') JavaScript API method. This method allows you to programmatically close or 'hide' the Messenger window. You would need to set up an event listener in your website's code that triggers the Intercom('hide') method when a click occurs outside the Messenger window element. It's important to note that this would be a custom solution and how it's implemented can vary depending on the specifics of your website's setup. Intercom does not provide out-of-the-box functionality for this behavior or documentation on how to implement such a workaround.

Please let me know if you have any questions about this 😸


Jennifer K
Intercom Team
Forum|alt.badge.img+3
  • Intercom Team
  • July 25, 2024
NewDiscussion ongoing