Isolate intercom usage using an iframe in Compass

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Intercom
    • None
    • 5
    • None
    • Developer Tools

      Update how we load the intercom script to happen in an iframe in Compass with restricted permissions (no file system access). Render the iframe conditionally via communication with the iframe and a badge that's shown outside of the iframe (when the iframe communicates that there's messages to show we show the badge/button).

      Context: https://docs.google.com/document/d/1m06P25lgV1znZJ_E__eOhwOYh7uT3jGyKMGq_7BXtf4/edit?tab=t.0 

       

      If/when we do this we can test it out more first with the intercom test workspace setup: https://app.intercom.com/a/apps/c5jegsvf/settings/channels/messenger/install?section=web-messenger-setup&tab=web Max gave me access to that org.

       

      A bit more detail on what the implementation would look like:
      We render an invisible iframe we setup a listener for the onShow or onUnreadCountChange event handlers. When that event happens we message the main renderer via postMessage. We then show a badge like the current one intercom shows to show there's a message/conversation (custom_launcher_selector). When it's clicked we message the main Compass process to either render the iframe visibly to show a chat, or spawn a new Browser window that creates a window on their os with restricted BrowserWindowConstructorOptions permissions. The iframe or the browser frame would isolate the script. We can then load the intercom script and communicate with the main process if we want to close it or it can't load or something.

      We should add logs around all the iframe communication and browser window setup/teardown.

      onUnreadCountChange docs: https://developers.intercom.com/installing-intercom/web/methods#intercomonunreadcountchange 
      https://www.npmjs.com/package/@intercom/messenger-js-sdk 

      I have a hacky branch I can send over if/when we work on this.

            Assignee:
            Rhys Howell
            Reporter:
            Rhys Howell
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: