How to access contacts created via JS library

Hi Intercom,

My company installed the JS script to our website and we are using the following code to identify users…

  analytics.identify(, {

We used this for about 1 month without any server side code. Now we are trying to improve our integration by creating/syncing users server side via your API – but we are running into a few issues.

The biggest issue has to do with the userId. It seems that we cannot pass in the same userId that we use for identify to any of the API endpoints.

For example, calling with userID being an ID that is used and works fine with the identify method, we get a "Contact Not Found" error.

Looking at the docs, it seems that the problem is we need to use “The unique identifier for the contact which is given by Intercom”

But how do we do that, when the contact was originally created via the frontend identify method?

Any help would be appreciated :grin:

the user id you’re passing via the JS lib is YOUR user id right?

Assuming this is the case – consider using the contact search endpoint. Here’s an example of me calling my “external_id” (the ID we assign the user from our systems vs. the id intercom assigns)

Worth noting that you may need to specify the API version as a “Intercom-Version:2.0” header, otherwise you could be calling the OLD contacts endpoint which I don’t believe supports this operation.

Got it, thank you.

So I’ll need to use the search endpoint to find the contact, grab the Intercom ID, and then use that ID for the other endpoints?

It would be soooo nice if I could just rely on our own ID VS needing to use intercoms internal ID.

For an example, attaching a company to a contact, requires the use of intercoms internal ID’s (not unless I am missing something). I can’t pass in our ID’s that we are using in the identify method.

Ya, I think that’s the approach. I think the prob w/ using your id is you may tech be able to pass in two users w/ the same external ID (not totally sure there).