Answered

Is it possible to change a contact's "external_id" via the API?


As far as I understand the "external_id" represent the "User id" we see in a user's or lead's profile.

Is it possible to change a contact's "external_id" with a "PUT /contacts/<id>"?

I tried but it doesn't seem to work. I can change other properties like "email" just fine, but "external_id" doesn't change in the contact model in the response to the call, despite the status code being "200 OK".

Is there any other way to change the "user_id" of a contact otherwise?

icon

Best answer by Roy 15 April 2021, 09:39

View original

13 replies

Userlevel 1
Badge

Hello @andrea c​ 👋, Welcome to Interconnect = )

 

Q - Is it possible to change a contact's "external_id" with a "PUT /contacts/<id>"?

A - I just now test this out, Yes it's possible to change User_ID via API.

 

Can you post your request? I'll be happy to take a look.

Thanks @roy s11​ ,

I am using axios - I can get you the http raw request if this doesn't make sense.

 

const headers = {

  'Content-Type': 'application/json',

  'Accept' : 'application/json',

  'Authorization': 'Bearer ' + accessToken

};

 

axios.put(

'https://api.intercom.io/contacts/' + internalId,

    { external_id: '******' },

    { headers: headers }

);

Userlevel 1
Badge

@andrea c​ , Here's the my request:

==========================

curl --location --request PUT 'https://api.intercom.io/contacts/b>ContactID' \

--header 'Authorization: Bearer token' \

--header 'Content-Type: application/json' \

--data-raw '{

    "external_id": "9900"

}'

==========================

It's updating user_id without any problem.

 

Can you try to test this via using Postman?

Tried your curl and the outcome is the same: "external_id" won't change. If I add to the "data-raw" another attribute, for example "email" that works... 😵

Userlevel 1
Badge

@andrea c​ , e-mail address is added for this user?

Userlevel 1
Badge

@andrea c​ , Can you also check your API version?

To check this follow:

1) Go to https://developers.intercom.com/

2) Your apps

3) Select app from the list

4) Api Version:

App

Yep, the email is updated as expected...

Api version is 2.3

Userlevel 1
Badge

@andrea c​ , As I mentioned, from my end it's working fine:

useridupdateI'm suggesting to contact Intercom Support directly about this case.

@roy s11​ I think I am missing something, it looks like this is not working for leads. Or at least, it doesn't work for the specific lead I was trying to change.

 

It works fine on contacts with role "user".

Userlevel 1
Badge

@andrea c​ ,

 

User id is a unique user identifier for logged in visitors, It's not possible to set user_id for leads (Intercom generates random User ID for leads).

 

I hope this will be helpful.

Thanks @roy s11​ this explains why it wouldn't allow changing it in my case. I must say, an error message of some kind would have been helpful there 😅

Userlevel 1
Badge

😂 Hah, Yeah Agree, You should submit this as a feature request in @Product Wishlist​ group.

 

Have a great day ☀️

Reply