APIs & Integrations

pgeimer
Participant

Contact Associations of new created Contact are only available after delay

I have enabled the "Create and associate companies with contacts" option in the Companies Settings, which automatically assigns created contacts to existing companies.

 

Now, when I create a contact via the API that Hubspot automatically associates with an existing company, I can only retrieve the associated companies of the contact via a GET Request after a break of currently 5 seconds (it may be less). If I call the GET Request immediately after creating the contact, I do not get the associations from that contact.

 

How can I get the associated companies directly when creating the contact and without waiting? And if this is not possible, how many seconds do I have to wait before calling the GET Request, to be sure the associations are available?

0 Upvotes
4 Replies 4
pgeimer
Participant

Contact Associations of new created Contact are only available after delay

Hi @Jaycee_Lewis , @weiliang_lee ! Thank you for your fast answers.

 

@weiliang_leehow do I know when to stop the poll? On the first GET Request without any waiting there was no "associations" property on that contact. But after the 5 seconds delay it was there. Does this mean as soon as there is a "associations" property on the contact that I can stop the poll? Or is it possible that there is a empty "associations" property and the HubSpot System is still searching for associations?

weiliang_lee
Top Contributor | Diamond Partner
Top Contributor | Diamond Partner

Contact Associations of new created Contact are only available after delay

Hi @Jaycee_Lewis thanks for the tag!

 

Hey there @pgeimer,

 

How I understand this feature is that whenever a contact is created, HubSpot would check the email against the companies in your portal, and create a new one if not found. You'd realize that if you create test@apple.com it will also create Apple as the company and have its logo automatically set. This would mean there is also a global set of data that is constantly scrubbed/updated in HubSpot. 

 

From a systems standpoint, the delay is natural. Once the contact is created, internally some scripts are running to fetch these data before associating them. Hence you can't do a back-to-back API call. I agree with Jaycee that usually it would be less than 5s based on what I've observed.

 

To be honest I've not done an implementation similar to yours, but I suggest a 5s delay to be safe. Or if you'd want to be completely safe about it, maybe do a 2s poll to ensure there's always going to be a result.

 

Cheers
WL

pgeimer
Participant

Contact Associations of new created Contact are only available after delay

Hi @weiliang_lee , thank you for your answer!

Does this mean as soon as there is a "associations" property on the contact that I can stop the poll? Or is it possible that there is a empty "associations" property and the HubSpot System is still searching for associations?

Jaycee_Lewis
Community Manager
Community Manager

Contact Associations of new created Contact are only available after delay

Hi, @pgeimer 👋 Thanks for the question. There isn't a public document that details the exact delay interval to be expected. I found comments from other community managers and the product team that the goal is to keep it < 5s, but this isn't an official document.

 

Hey, @weiliang_lee, do you have any thoughts here? Aside from accounting for the delay and setting up some form of retrying, what other creative ways can we think about this? 

 

Best,

Jaycee

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot