Answered

Migrate from 1.4 to 2.2 - how to update user/contact by external user id

  • 12 November 2020
  • 2 replies
  • 187 views

In api v1.4 we used external user id to do all the user manipulations. Now in 2.2 to update a user/contact we should use:

https://api.intercom.io/contacts/lt;id>

 

<id > is explained in the docs (https://developers.intercom.com/intercom-api-reference/reference#identifiers-and-urls:

 

The company and user objects deserve special mention when it comes to identity for two reasons -

  • They allow you send your own external identifiers

 

When we try calling https://api.intercom.io/contacts/lt;id> with external user id as <id> - we get error 404:

 

{"type":"error.list","request_id":"...","errors":[{"code":"not_found","message":"User Not Found"}]}

 

So either there is something wrong in the docs or we are missing some information. How to properly update user/contact in api 2.2? Do we need to first search for user by external user id to get the "intercom user id"?

 

icon

Best answer by Roy 13 November 2020, 02:04

View original

2 replies

Userlevel 1
Badge

Hello @user470​ , Let me try to explain this:

 

Once Intercom update API, there no longer user and lead, it's become as contacts.

1.4 API allowed you to retrieve a user via:

ID - https://api.intercom.io/users/ID

UserID - https://api.intercom.io/users?user_id=***/p>

e-Mail - https://api.intercom.io/users?email=test%40roy.com/p>

 

Now in 2.2, you can only retrieve a contact via ID:

https://api.intercom.io/contacts/ID/p>

 

It's the same id as:

IntercomIt's also in 1.4 API response:

{

"type": "user",

"id": "5714dd359a3fd47136000001",

"user_id": "25",

"anonymous": false,

"email": "wash@serenity.io",

"phone": "555671243",

"name": "Hoban Washburne",

"pseudonym": null,

"avatar": {

"type": "avatar",

"image_url": "https://secure.gravatar.com/avatar/0c3c17fd49f45c43f482730782b36d36?s=24amp;d=identicon"

},

 

You can use search API - Use External ID to find and retrieve a ID. I'm suggesting to use 1.4 API - retrieve all users ID's, insert it in your database and change the request: Instead of External ID, send ID.

Thanks Roy, all clear. In our case we'll stick to search api for now and we'll look into adding intercom IDs to our DB later on (as we create Intercom contacts by web integration and then we need intercom user ID only occasionally to update some properties).

Reply