Jan 27, 2022 1:31 PM
Our company is currently leveraging the new associations using the v4 of the API (link). We do realize this is still in BETA and is subject to change, but just had a few thoughts/feedback I would like to share.
1. There is no endpoint to remove a single association. You currently have to wipe all the assocations and re-add them (which is what we are doing). This is a bit inconvenient and can also have some downstream consequences if workflows are built off specific assocations being added/removed.
2. It would also be very useful if assocations could be applied at the same time that a contact is created/updated as it's own URL parameter in the API call, rather than making a separate call to do associations. We are having to generate a lot of API calls just to handle assocations. I could see passing in the associations as just overriding whatever is set up at the time. If the associations all match, nothing would get updated (on HubSpots end). Sending back the current associations in the Contact lookup would also be super useful.
Note: Why so many API calls? We have our own unique identifier for Contact objects. But unfortunately, the API doesn't let you make unique properties on a contact object specifically at this time, so we are stuck using the email. We first have to get the HubSpot ID from a contact record using the email to see if it exists to call the correct endpoint (x1 API). Then we trigger an create/update depending on if that ID could be pulled (x1 API). Next, we have to lookup the Company HS_ID for associations (x1 API). We then pull the existing associations to see if they even need updating (x1 API). If they do need updating, we have to wipe the associations (x1 API) and then reapply them (x1 API). This is a total of 4-6 API calls per contact update/create and it's no surprise we are starting to get rate limited on our rolling 10s window.
Jan 27, 2022 7:07 PM - edited Jan 27, 2022 7:08 PM
Unfortunately, there is a pretty big difference between how associations work with v3/v4 from what we could tell. V4 uses associations with labels. We actually tried V3 initially, but it didn't fit the needs of what we were trying to do.
We are applying multiple different associations (currently 4 - with different labels) to contacts and companies for various business reasons. We also needed the ability to be able associate multiple companies to contacts. If we moved to v3 of the API, that would actually increase the amount of API requests we are going to be making. Let's say for instance we create a contact and need to associate that contact to two companies with all the different labels we have set up. We have to make 8 API requests just to do that with the v3 API because we would be making individual calls for adding each association as opposed to lumping them all into one call.
Another point to mention, is that in the V3 API there is no way to differentiate between a USER_DEFINED and HUBSPOT_DEFINED association and they can both can have the same id and name. So doing this in an automated way is not really viable. When we first started out integration, we did have overlapping names and ids (we were still figuring things out), for instance, we created a `contact_to_company` association which was set to an id=1 (this association has been removed).
I hope this added context helps! This post was mostly just to provide feedback on the v4 API
Jan 27, 2022 6:30 PM - edited Jan 27, 2022 6:31 PM
I might be missing something but this seems straight forward using the V3 objects api? Not to dimish the work you and your team have done.
Maybe worth rethinking the approach. Specifically using the V3 endpoints?
I'd be happy to riff on the idea anytime!