Is it possible to change a contact's "external_id" via the API? | Community
Skip to main content
Answered

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

  • Apr 14, 2021 2:58 PM UTC
  • 13 replies
  • 925 views

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?

Best answer by Roy

@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.

View original

13 replies

Roy
Top Expert ✨
Forum|alt.badge.img+7
  • Top Expert ✨
  • Apr 14, 2021 5:10 PM UTC

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.


  • Author
  • Connector
  • Apr 14, 2021 5:17 PM UTC

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 }

);


Roy
Top Expert ✨
Forum|alt.badge.img+7
  • Top Expert ✨
  • Apr 14, 2021 6:52 PM UTC

@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?


  • Author
  • Connector
  • Apr 14, 2021 7:37 PM UTC

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... 😵


Roy
Top Expert ✨
Forum|alt.badge.img+7
  • Top Expert ✨
  • Apr 14, 2021 8:21 PM UTC

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


Roy
Top Expert ✨
Forum|alt.badge.img+7
  • Top Expert ✨
  • Apr 14, 2021 8:22 PM UTC

@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


  • Author
  • Connector
  • Apr 14, 2021 8:23 PM UTC

Yep, the email is updated as expected...


  • Author
  • Connector
  • Apr 14, 2021 8:24 PM UTC

Api version is 2.3


Roy
Top Expert ✨
Forum|alt.badge.img+7
  • Top Expert ✨
  • Apr 14, 2021 9:58 PM UTC

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

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


  • Author
  • Connector
  • Apr 14, 2021 11:11 PM UTC

@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".


Roy
Top Expert ✨
Forum|alt.badge.img+7
  • Top Expert ✨
  • Answer
  • Apr 15, 2021 7:39 AM UTC

@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.


  • Author
  • Connector
  • Apr 15, 2021 8:56 AM UTC

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 😅


Roy
Top Expert ✨
Forum|alt.badge.img+7
  • Top Expert ✨
  • Apr 15, 2021 9:18 AM UTC

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

 

Have a great day ☀️