Answered

External id is not being saved in create contact api. How to make it work?

  • 25 June 2022
  • 4 replies
  • 165 views

We are trying to create a contact with the role user, but on sending `external_id` in request, it's not getting returned in the response. Also it doesn't show up in the properties of the created contact in the dashboard. And using the search api with that `external_id` returns no results. Anything we might be doing wrong or some setting we have enable?

 

Here's the request and response object:

{
"role": "user",
"external_id": "27",
"email": "wash@serenity.io",
"unsubscribed_from_emails": false,
"custom_attributes": {
"conversion_score": 0.98,
"age_bucket": "0-14"
}
}
{
"type": "contact",
"id": "62b55ddacc687ae385777d76",
"user_id": "f4e6fa26-a66f-44ad-a9c8-48aae2428a5d",
"anonymous": true,
"email": "wash@serenity.io",
"phone": null,
"name": null,
"pseudonym": "Orange Scissors",
"avatar": {
"type": "avatar",
"image_url": null
},
"app_id": "km6bq31o",
"companies": {
"type": "company.list",
"companies": []
},
"location_data": {},
"last_request_at": null,
"created_at": 1656053210,
"remote_created_at": null,
"signed_up_at": null,
"updated_at": 1656053210,
"session_count": 0,
"social_profiles": {
"type": "social_profile.list",
"social_profiles": []
},
"owner_id": null,
"unsubscribed_from_emails": false,
"marked_email_as_spam": false,
"has_hard_bounced": false,
"tags": {
"type": "tag.list",
"tags": []
},
"segments": {
"type": "segment.list",
"segments": []
},
"custom_attributes": {
"conversion_score": 0.98,
"age_bucket": "0-14"
},
"referrer": null,
"utm_campaign": null,
"utm_content": null,
"utm_medium": null,
"utm_source": null,
"utm_term": null,
"do_not_track": null,
"last_seen_ip": null,
"user_agent_data": null
}

 

icon

Best answer by Aparna 28 June 2022, 16:02

View original

4 replies

Hey @ankit j​ ! Are contacts being created? Are you able to view them in UI (in the contacts page)? If so can you send me the API endpoing you are using to create and retrieve the user?

I am having the same issue, testing it out on Insomnia:

 

Request:

imageResponse:

{
"type": "contact",
"id": "62bb8256f4f80027556bf6b7",
"user_id": "65b002c5-2208-460f-adb9-851cba017aaf",
"anonymous": true,
"email": "wash@serenity.io",
"phone": null,
"name": null,
"pseudonym": "Rose Knight",
"avatar": {
"type": "avatar",
"image_url": null
},
"app_id": "q16mpu97",
"companies": {
"type": "company.list",
"companies": []
},
"location_data": {},
"last_request_at": null,
"created_at": 1656455766,
"remote_created_at": null,
"signed_up_at": null,
"updated_at": 1656455766,
"session_count": 0,
"social_profiles": {
"type": "social_profile.list",
"social_profiles": []
},
"owner_id": null,
"unsubscribed_from_emails": false,
"marked_email_as_spam": false,
"has_hard_bounced": false,
"tags": {
"type": "tag.list",
"tags": []
},
"segments": {
"type": "segment.list",
"segments": []
},
"custom_attributes": {},
"referrer": null,
"utm_campaign": null,
"utm_content": null,
"utm_medium": null,
"utm_source": null,
"utm_term": null,
"do_not_track": null,
"last_seen_ip": null,
"user_agent_data": null
}

I am unable to find the user on the Contacts page. In my NodeJS application I am on 'intercom-client' v3.1.5, it is replying with the same response as shown above. This issue appeared after I updated from v2.11.2, which still used the Users API. Users can still be created using the users endpoint as is shown below.

const user = {
email: parseUser.get('email'),
user_id: parseUser.id,
custom_attributes: {
admin: mkUserAdminUrl(parseUser.id),
},
companies: [
{
id: accountId,
custom_attributes: {
admin: mkAccountAdminUrl(accountId),
},
},
],
};
await intercom.users.create(user);

However, users is deprecated in v3.1.5 and the contacts API is not behaving the same. Please help

+1 on this issue, external_id is not working, not getting updated or I can't search with it :(

Same for me

I'm following this doc https://developers.intercom.com/intercom-api-reference/reference/create-contact

Anything in `external_id` is replaced with random uuid

Reply