Ghost contacts and merges?

Hi, we have recently been implementing a worker to sync changes from our hub spot contacts to our local db contacts. We have been using the change-log endpoint: https://developers.hubspot.com/docs/methods/tickets/get-ticket-changes for contacts to get all our changes. We were unable to reliably use the get modified contacts endpoint for our case.
Whilst using the change-log endpoint we have experienced a few weird use cases.
1. First we have contacts which have canonical ids set to other contacts but show no merge history.
2. We have run into contacts that when fetched have is-contact set to false.
For our understanding can you explain how contacts get into these two states? Thanks.

Hey @craigclutch,

On my end, I’m not seeing any is-contact property or canonical ids when I use this endpoint Get a log of changes for tickets to retrieve changes to my portal ticket changes.

As such, could you share the following with me so that I can dig further into this:

1. The HubSpot portal ID in question

2. An example response that you are seeing on your end

Hi @WendyGoh

Thanks for getting back to me. To clarify the actual endpoint I’m using is:

https://api.hubapi.com/crm-objects/v1/change-log/contacts to get changes to our contacts. We then take the contact ids in this response, deduplicate them and call https://api.hubapi.com/contacts/v1/contact/vid/:vid/profile to get the full details for a contact. It is here we are seeing the odd properites.
The portal id in question is:

7002975
Example payload with no merged-vid but different ‘canonocial-id’:

{
 "vid": 842451,
 "canonical-vid": 842501,
 "merged-vids": [],
 "portal-id": 7002975,
 "is-contact": true,
}

Example payload where ‘is-contact’ is false.

{
 "vid": 895251,
 "canonical-vid": 895251,
 "merged-vids": [],
 "portal-id": 7002975,
 "is-contact": false,
}

Example response from change log endpoint:

[
 {
 "timestamp": 1583760509567,
 "changeType": "CHANGED",
 "objectId": 882101,
 "changes": {
 "changedProperties": [
 "num_contacted_notes",
 "notes_next_activity_date",
 "num_notes"
 ],
 "newAssociations": [],
 "removedAssociations": [],
 "newListMemberships": [],
 "removedListMemberships": []
 }
 },
 {
 "timestamp": 1583760553351,
 "changeType": "CHANGED",
 "objectId": 848251,
 "changes": {
 "changedProperties": [
 "hs_predictivecontactscore_v2"
 ],
 "newAssociations": [],
 "removedAssociations": [],
 "newListMemberships": [],
 "removedListMemberships": []
 }
 }
]

These payloads only have a snippet of the information but all that I thought was relevant as the full payload contains customer information.

Hey @craigclutch,

Let’s walk through the query one by one:

1. The reason why you’re seeing contact with canonical vid different from vid when there’s no merged-vids is because: It is possible that we first identify the contact in question as a visitor (which also known as is-contact: false, will touch on this in our second point) > When the visitor submit a form > It will be known as a contact within HubSpot; in this case, we’ll update the contact with the form submission data and also set another vid. Hence, you’re seeing canonical vid different from vid.

2. The reason why you’re seeing is-contact: false is because the visitor record is not a real contact. As Derek mentioned in details on this dev forum thread:

It’s possible for a usertoken to be associated with a contact record, or with a pseudo-record known as a visitor. This visitor record is not a real contact (i.e. it’s not visible in-app) but it still associated with analytics data and some other information. For most scenarios, if you can pull a usertoken from a visitor’s browser, you can pull either a full contact record or a visitor record. You can distinguish between the two by looking at the is-contact field.

I hope this helps to shed some lights and do let me know if there’s any further questions on this!

That does help clear things up, thanks @WendyGoh