APIs & Integrations

tljthatrocks
Member

hs_analytics_source_data_1 and hs_analytics_source_data_2 Contact properties not populated

I created an app with Webhook that subscribes for "contact.creation" event. So whenever I get a new lead from our Facebook Lead Gen Ad, it calls my Hubspot webhook endpoint on my server. It then grabs the the contact id from the webhook response and then sends a Contacts API request to get details of the created contact by passing the contact id using the following request URL:

 

https://api.hubapi.com/crm/v3/objects/contacts/XXXXX?hapikey=XXXXXXX&properties=
firstname,lastname,email,first_conversion_event_name,hs_analytics_source_data_1,hs_analytics_source_data_2
 
It works fine and I get the details of the created contact but for some reason, hs_analytics_source_data_1 and hs_analytics_source_data_2 properties are not populated. They are present in the response but their values are empty. The other properties are populated correctly. But when I manually try running the above URL in the browser, I can see those 2 properties properly populated in the API response. I also see them in the Contacts interface for the created contact.
 
So why are those 2 properties empty when executing the API request from my callback script? Is this a timing issue and these 2 properties only get populated by Hubspot at a later time and not immediately available right after the contact is created?
 
Any help is greatly appreciated. Thanks!
 
0 Upvotes
1 Reply 1
tljthatrocks
Member

hs_analytics_source_data_1 and hs_analytics_source_data_2 Contact properties not populated

It looks like my suspicion of timing issue was correct. I added a 5-second delay before I send the Contacts API request after I received the webhook request callback and it worked! I can now see the hs_analytics_source_data_1 and hs_analytics_source_data_2 properties populated.