Skip to main content
Answered

Intercom2 not a function error with messenger sdk

  • 8 July 2024
  • 1 reply
  • 54 views

EDIT: I’m silly and missed the most obvious thing. Turns out the import is different for Remix apps.

import should be this:
import {Intercom} from '@intercom/messenger-js-sdk';

I’m embedding the an Intercom messenger onto a Remix (react) app. Just following along with the installation instructions it states that I should place this snippet in the client side code of the Component. I’ve done this so far, the snippet looking like this:

import Intercom from '@intercom/messenger-js-sdk';
 
export default function Home() {
        Intercom({
            app_id: 'app-id-here',
            user_id: …,
            name: …,
            email: …,
            created_at:
        });
    
    return(

        <h1>Test Component</h1>
    )
}

However, when this component is rendered on the page, it causes this error to be thrown:
TypeError: Intercom2 is not a function

I cant seem to find a reason for this besides something from the Intercom function not working correctly
Any advice would be helpful. Thank you!

1 reply

Userlevel 3
Badge +5

Hi Sam Walkerz It’s Mat from the Support Engineering Team 😀

It looks like there is an issue with the implementation of the installation snippet into the app.

I would highly recommend looking at this guide on installing Intercom in web.

We also have a brand new way of installing Intercom via NodeJS.

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

Reply