I am encountering the following issue: I have users and deals on my side (not yet on HubSpot) and I want to create them in HubSpot using the API.
One contact can be linked to a deal, but for that I need the vid (HubSpot id) of the contact, so here is what I do:
1 - Batch creating all the users using their email
2 - Getting all the users newly created (because I need their vid and the batch create does not return them)
3 - Creating the deals with their associated users thanks to the previously get vids
The issue I am having is that on step 2, contacts are not finished being created on HubSpot. It takes up to 30s with 4 contacts (didn't try more). So if I immediately create then get, the get returns nothing. A sleep of 30s solves the issue but that's not a good solution.
I wondered if I am doing something wrong, or if this is a known issue, and if there is a solution out there?
You're not doing anything wrong; this is expected behavior. As David touches on here, contact records are not created immediately and may not be available for a few seconds.
Delaying the GET request seems to be the only solution, per similar topics.
I recognize that the process could be streamlined, though. If you feel inclined, I recommend posting your feedback on the HubSpot Community Ideas Forum, especially receiving the contact vids in the bulk endpoint's response.
You're not doing anything wrong; this is expected behavior. As David touches on here, contact records are not created immediately and may not be available for a few seconds.
Delaying the GET request seems to be the only solution, per similar topics.
I recognize that the process could be streamlined, though. If you feel inclined, I recommend posting your feedback on the HubSpot Community Ideas Forum, especially receiving the contact vids in the bulk endpoint's response.
I used a fetcher on a timed loop on our end to make that work (fetching data of n contacts by emails, and if all the data is not returned, retrying n seconds later). With of course a limited number of retries. It works pretty well.
I do not find it pretty but if you say it is the only option, I guess we will do with that.
I'll post something on the community ideas forum, see if this can help.